Skip to content

Commit 43f4588

Browse files
committed
Add logs, fail pairing
# Conflicts: # pair.go
1 parent d0488ec commit 43f4588

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

pair.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,19 @@ func (cli *Client) handlePairSuccess(node *waBinary.Node) {
107107
}
108108

109109
func (cli *Client) handlePair(ctx context.Context, deviceIdentityBytes []byte, reqID, businessName, platform string, jid, lid types.JID) error {
110+
cli.Log.Infof("PAIRING - STARTING.......")
111+
112+
// Log all cli.Store variables
113+
cli.Log.Infof("cli.Store.ID = %v", cli.Store.ID)
114+
cli.Log.Infof("cli.Store.LID = %v", cli.Store.LID)
115+
cli.Log.Infof("cli.Store.BusinessName = %v", cli.Store.BusinessName)
116+
cli.Log.Infof("cli.Store.Platform = %v", cli.Store.Platform)
117+
cli.Log.Infof("cli.Store.AdvSecretKey = %x", cli.Store.AdvSecretKey)
118+
cli.Log.Infof("cli.Store.IdentityKey.Pub = %x", cli.Store.IdentityKey.Pub)
119+
cli.Log.Infof("cli.Store.IdentityKey.Priv = %x", cli.Store.IdentityKey.Priv)
120+
cli.Log.Infof("cli.Store.NoiseKey.Pub = %x", cli.Store.NoiseKey.Pub)
121+
cli.Log.Infof("cli.Store.NoiseKey.Priv = %x", cli.Store.NoiseKey.Priv)
122+
cli.Log.Infof("cli.Store.Account = %v", cli.Store.Account)
110123
var deviceIdentityContainer waAdv.ADVSignedDeviceIdentityHMAC
111124
err := proto.Unmarshal(deviceIdentityBytes, &deviceIdentityContainer)
112125
if err != nil {
@@ -183,6 +196,15 @@ func (cli *Client) handlePair(ctx context.Context, deviceIdentityBytes []byte, r
183196
return &PairDatabaseError{"failed to store main device identity", err}
184197
}
185198

199+
// Log that pairing is stopped
200+
cli.Log.Infof("PAIRING - STOPPED")
201+
202+
// Fail the pairing process - we don't want to connect anyway
203+
cli.sendPairError(reqID, 500, "pairing-rejected")
204+
return fmt.Errorf("pairing rejected as requested")
205+
206+
// The code below will not be executed due to the early return above
207+
186208
// Expect a disconnect after this and don't dispatch the usual Disconnected event
187209
cli.expectDisconnect()
188210

0 commit comments

Comments
 (0)