Skip to content

Commit

Permalink
login: save master key from provisioning message
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Nov 13, 2024
1 parent d011d23 commit a0389f9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/connector/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"fmt"

"github.com/google/uuid"
"github.com/rs/zerolog"
"maunium.net/go/mautrix/bridge/status"
"maunium.net/go/mautrix/bridgev2"
"maunium.net/go/mautrix/bridgev2/database"
Expand Down Expand Up @@ -175,6 +176,10 @@ func (qr *QRLogin) processingWait(ctx context.Context) (*bridgev2.LoginStep, err
if err != nil {
return nil, fmt.Errorf("failed to connect after login: %w", err)
}
if signalClient := ul.Client.(*SignalClient).Client; signalClient.Store.MasterKey != nil {
zerolog.Ctx(ctx).Info().Msg("Received master key in login, syncing storage immediately")
go signalClient.SyncStorage(ctx)
}
return &bridgev2.LoginStep{
Type: bridgev2.LoginStepTypeComplete,
StepID: LoginStepComplete,
Expand Down
1 change: 1 addition & 0 deletions pkg/signalmeow/provisioning.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ func PerformProvisioning(ctx context.Context, deviceStore store.DeviceStore, dev
DeviceID: deviceId,
Number: *provisioningMessage.Number,
Password: password,
MasterKey: provisioningMessage.GetMasterKey(),
}

// Store the provisioning data
Expand Down

0 comments on commit a0389f9

Please sign in to comment.