slidge-whatsapp 0.3.0b0__cp313-cp313-manylinux_2_36_aarch64.whl → 0.3.4__cp313-cp313-manylinux_2_36_aarch64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of slidge-whatsapp might be problematic. Click here for more details.
- slidge_whatsapp/contact.py +2 -0
- slidge_whatsapp/event.go +72 -22
- slidge_whatsapp/generated/_whatsapp.cpython-313-aarch64-linux-gnu.h +206 -206
- slidge_whatsapp/generated/_whatsapp.cpython-313-aarch64-linux-gnu.so +0 -0
- slidge_whatsapp/generated/build.py +166 -166
- slidge_whatsapp/generated/go.py +1 -1
- slidge_whatsapp/generated/whatsapp.c +1557 -1557
- slidge_whatsapp/generated/whatsapp.go +1227 -1227
- slidge_whatsapp/generated/whatsapp.py +1382 -1382
- slidge_whatsapp/generated/whatsapp_go.h +206 -206
- slidge_whatsapp/go.mod +11 -11
- slidge_whatsapp/go.sum +26 -26
- slidge_whatsapp/session.go +4 -4
- slidge_whatsapp/vendor/github.com/ebitengine/purego/README.md +21 -5
- slidge_whatsapp/vendor/github.com/ebitengine/purego/abi_loong64.h +60 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/cgo.go +1 -1
- slidge_whatsapp/vendor/github.com/ebitengine/purego/dlerror.go +1 -1
- slidge_whatsapp/vendor/github.com/ebitengine/purego/dlfcn.go +1 -1
- slidge_whatsapp/vendor/github.com/ebitengine/purego/dlfcn_netbsd.go +15 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/dlfcn_nocgo_netbsd.go +9 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/dlfcn_stubs.s +1 -1
- slidge_whatsapp/vendor/github.com/ebitengine/purego/func.go +113 -60
- slidge_whatsapp/vendor/github.com/ebitengine/purego/gen.go +6 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/go_runtime.go +1 -1
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/cgo/dlfcn_cgo_unix.go +2 -2
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/cgo/syscall_cgo_unix.go +2 -2
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/abi_loong64.h +60 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/asm_loong64.s +40 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/callbacks.go +1 -1
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/doc.go +1 -1
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/go_libinit.go +1 -1
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/go_linux_loong64.go +92 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/go_netbsd.go +106 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/go_setenv.go +1 -1
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/go_util.go +1 -1
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/iscgo.go +1 -1
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo.go +1 -1
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_darwin.go +4 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_freebsd.go +4 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_linux.go +4 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_netbsd.go +26 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/netbsd.go +23 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/setenv.go +1 -1
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/symbols.go +11 -1
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/symbols_darwin.go +1 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/symbols_freebsd.go +1 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/symbols_linux.go +1 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/symbols_netbsd.go +30 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_loong64.s +71 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_stubs.s +5 -1
- slidge_whatsapp/vendor/github.com/ebitengine/purego/nocgo.go +1 -1
- slidge_whatsapp/vendor/github.com/ebitengine/purego/struct_amd64.go +8 -4
- slidge_whatsapp/vendor/github.com/ebitengine/purego/struct_arm64.go +16 -6
- slidge_whatsapp/vendor/github.com/ebitengine/purego/struct_loong64.go +190 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/struct_other.go +6 -2
- slidge_whatsapp/vendor/github.com/ebitengine/purego/sys_amd64.s +1 -1
- slidge_whatsapp/vendor/github.com/ebitengine/purego/sys_arm64.s +1 -1
- slidge_whatsapp/vendor/github.com/ebitengine/purego/sys_loong64.s +96 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/sys_unix_arm64.s +1 -1
- slidge_whatsapp/vendor/github.com/ebitengine/purego/sys_unix_loong64.s +75 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/syscall.go +6 -3
- slidge_whatsapp/vendor/github.com/ebitengine/purego/syscall_cgo_linux.go +3 -3
- slidge_whatsapp/vendor/github.com/ebitengine/purego/syscall_sysv.go +13 -10
- slidge_whatsapp/vendor/github.com/ebitengine/purego/syscall_windows.go +1 -1
- slidge_whatsapp/vendor/github.com/ebitengine/purego/zcallback_amd64.s +2002 -2002
- slidge_whatsapp/vendor/github.com/ebitengine/purego/zcallback_arm64.s +4002 -4002
- slidge_whatsapp/vendor/github.com/ebitengine/purego/zcallback_loong64.s +4014 -0
- slidge_whatsapp/vendor/go.mau.fi/libsignal/session/SessionCipher.go +7 -2
- slidge_whatsapp/vendor/go.mau.fi/util/dbutil/log.go +1 -0
- slidge_whatsapp/vendor/go.mau.fi/util/dbutil/module.go +119 -0
- slidge_whatsapp/vendor/go.mau.fi/util/dbutil/upgradetable.go +3 -34
- slidge_whatsapp/vendor/go.mau.fi/util/exbytes/string.go +20 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exbytes/writer.go +78 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exslices/cast.go +42 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exslices/chunk.go +28 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exslices/deduplicate.go +67 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exslices/diff.go +63 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exsync/event.go +15 -1
- slidge_whatsapp/vendor/go.mau.fi/util/exsync/syncmap.go +48 -7
- slidge_whatsapp/vendor/go.mau.fi/util/exsync/syncset.go +13 -0
- slidge_whatsapp/vendor/go.mau.fi/util/jsontime/helpers.go +16 -5
- slidge_whatsapp/vendor/go.mau.fi/util/jsontime/integer.go +27 -12
- slidge_whatsapp/vendor/go.mau.fi/util/random/string.go +47 -7
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate/decode.go +1 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate/encode.go +60 -15
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate/hash.go +1 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate.go +20 -2
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/armadillomessage.go +2 -2
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/call.go +6 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/errors.go +1 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/group.go +63 -42
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/internals.go +31 -15
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/message.go +77 -26
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/msgsecret.go +23 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/notification.go +5 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/pair.go +22 -23
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/prekeys.go +21 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waAICommon/WAAICommon.pb.go +7747 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/{waBotMetadata/WABotMetadata.proto → waAICommon/WAAICommon.proto} +269 -9
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waDeviceCapabilities/WAProtobufsDeviceCapabilities.pb.go +128 -14
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waDeviceCapabilities/WAProtobufsDeviceCapabilities.proto +10 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waE2E/WAWebProtobufsE2E.pb.go +8953 -10087
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waE2E/WAWebProtobufsE2E.proto +216 -330
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waHistorySync/WAWebProtobufsHistorySync.pb.go +11 -2
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waHistorySync/WAWebProtobufsHistorySync.proto +1 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waStatusAttributions/WAStatusAttributions.pb.go +226 -83
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waStatusAttributions/WAStatusAttributions.proto +14 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waSyncAction/WASyncAction.pb.go +709 -449
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waSyncAction/WASyncAction.proto +24 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWa6/WAWebProtobufsWa6.pb.go +78 -24
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWa6/WAWebProtobufsWa6.proto +6 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWeb/WAWebProtobufsWeb.pb.go +528 -267
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWeb/WAWebProtobufsWeb.proto +24 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/receipt.go +47 -14
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/request.go +4 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/retry.go +6 -13
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/send.go +130 -62
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/sendfb.go +33 -32
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/clientpayload.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/noop.go +16 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sessioncache.go +125 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/signal.go +8 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/lidmap.go +82 -4
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/store.go +135 -55
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrades/00-latest-schema.sql +8 -7
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrades/11-redacted-phone-contacts.sql +2 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/store.go +24 -2
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/call.go +6 -5
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/jid.go +24 -9
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/message.go +7 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/user.go +3 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/user.go +43 -3
- slidge_whatsapp/vendor/golang.org/x/crypto/curve25519/curve25519.go +7 -4
- slidge_whatsapp/vendor/golang.org/x/net/http2/config.go +11 -6
- slidge_whatsapp/vendor/golang.org/x/net/http2/config_go125.go +15 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/config_go126.go +15 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/frame.go +24 -1
- slidge_whatsapp/vendor/golang.org/x/net/http2/http2.go +0 -1
- slidge_whatsapp/vendor/golang.org/x/net/http2/server.go +35 -26
- slidge_whatsapp/vendor/golang.org/x/net/http2/transport.go +4 -2
- slidge_whatsapp/vendor/golang.org/x/net/http2/writesched.go +2 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/{writesched_priority.go → writesched_priority_rfc7540.go} +52 -52
- slidge_whatsapp/vendor/golang.org/x/net/http2/writesched_priority_rfc9128.go +209 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/writesched_roundrobin.go +1 -1
- slidge_whatsapp/vendor/golang.org/x/net/internal/httpcommon/request.go +2 -2
- slidge_whatsapp/vendor/golang.org/x/net/internal/socks/socks.go +1 -1
- slidge_whatsapp/vendor/golang.org/x/sys/unix/affinity_linux.go +9 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/fdset.go +1 -3
- slidge_whatsapp/vendor/golang.org/x/sys/unix/ifreq_linux.go +1 -3
- slidge_whatsapp/vendor/golang.org/x/sys/unix/mkall.sh +1 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/syscall_linux.go +1 -3
- slidge_whatsapp/vendor/golang.org/x/sys/unix/syscall_netbsd.go +17 -0
- slidge_whatsapp/vendor/golang.org/x/sys/windows/syscall_windows.go +2 -0
- slidge_whatsapp/vendor/golang.org/x/sys/windows/types_windows.go +16 -0
- slidge_whatsapp/vendor/golang.org/x/sys/windows/zsyscall_windows.go +18 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/bidi/core.go +2 -9
- slidge_whatsapp/vendor/google.golang.org/protobuf/internal/filedesc/desc.go +35 -17
- slidge_whatsapp/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go +14 -0
- slidge_whatsapp/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go +20 -0
- slidge_whatsapp/vendor/google.golang.org/protobuf/internal/version/version.go +1 -1
- slidge_whatsapp/vendor/modules.txt +15 -13
- {slidge_whatsapp-0.3.0b0.dist-info → slidge_whatsapp-0.3.4.dist-info}/METADATA +4 -3
- {slidge_whatsapp-0.3.0b0.dist-info → slidge_whatsapp-0.3.4.dist-info}/RECORD +166 -138
- {slidge_whatsapp-0.3.0b0.dist-info → slidge_whatsapp-0.3.4.dist-info}/WHEEL +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waBotMetadata/WABotMetadata.pb.go +0 -5156
- {slidge_whatsapp-0.3.0b0.dist-info → slidge_whatsapp-0.3.4.dist-info}/entry_points.txt +0 -0
- {slidge_whatsapp-0.3.0b0.dist-info → slidge_whatsapp-0.3.4.dist-info/licenses}/LICENSE +0 -0
|
@@ -67,7 +67,11 @@ func (int *DangerousInternalClient) RequestAppStateKeys(ctx context.Context, raw
|
|
|
67
67
|
int.c.requestAppStateKeys(ctx, rawKeyIDs)
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
func (int *DangerousInternalClient)
|
|
70
|
+
func (int *DangerousInternalClient) SendAppState(ctx context.Context, patch appstate.PatchInfo, waitForSync bool) error {
|
|
71
|
+
return int.c.sendAppState(ctx, patch, waitForSync)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
func (int *DangerousInternalClient) HandleDecryptedArmadillo(ctx context.Context, info *types.MessageInfo, decrypted []byte, retryCount int) (handlerFailed, protobufFailed bool) {
|
|
71
75
|
return int.c.handleDecryptedArmadillo(ctx, info, decrypted, retryCount)
|
|
72
76
|
}
|
|
73
77
|
|
|
@@ -207,6 +211,10 @@ func (int *DangerousInternalClient) SendGroupIQ(ctx context.Context, iqType info
|
|
|
207
211
|
return int.c.sendGroupIQ(ctx, iqType, jid, content)
|
|
208
212
|
}
|
|
209
213
|
|
|
214
|
+
func (int *DangerousInternalClient) CacheGroupInfo(groupInfo *types.GroupInfo, lock bool) ([]store.LIDMapping, []store.RedactedPhoneEntry) {
|
|
215
|
+
return int.c.cacheGroupInfo(groupInfo, lock)
|
|
216
|
+
}
|
|
217
|
+
|
|
210
218
|
func (int *DangerousInternalClient) GetGroupInfo(ctx context.Context, jid types.JID, lockParticipantCache bool) (*types.GroupInfo, error) {
|
|
211
219
|
return int.c.getGroupInfo(ctx, jid, lockParticipantCache)
|
|
212
220
|
}
|
|
@@ -219,7 +227,7 @@ func (int *DangerousInternalClient) ParseGroupNode(groupNode *waBinary.Node) (*t
|
|
|
219
227
|
return int.c.parseGroupNode(groupNode)
|
|
220
228
|
}
|
|
221
229
|
|
|
222
|
-
func (int *DangerousInternalClient) ParseGroupCreate(parentNode, node *waBinary.Node) (*events.JoinedGroup, []store.LIDMapping, error) {
|
|
230
|
+
func (int *DangerousInternalClient) ParseGroupCreate(parentNode, node *waBinary.Node) (*events.JoinedGroup, []store.LIDMapping, []store.RedactedPhoneEntry, error) {
|
|
223
231
|
return int.c.parseGroupCreate(parentNode, node)
|
|
224
232
|
}
|
|
225
233
|
|
|
@@ -231,7 +239,7 @@ func (int *DangerousInternalClient) UpdateGroupParticipantCache(evt *events.Grou
|
|
|
231
239
|
int.c.updateGroupParticipantCache(evt)
|
|
232
240
|
}
|
|
233
241
|
|
|
234
|
-
func (int *DangerousInternalClient) ParseGroupNotification(node *waBinary.Node) (any, []store.LIDMapping, error) {
|
|
242
|
+
func (int *DangerousInternalClient) ParseGroupNotification(node *waBinary.Node) (any, []store.LIDMapping, []store.RedactedPhoneEntry, error) {
|
|
235
243
|
return int.c.parseGroupNotification(node)
|
|
236
244
|
}
|
|
237
245
|
|
|
@@ -287,8 +295,8 @@ func (int *DangerousInternalClient) MigrateSessionStore(ctx context.Context, pn,
|
|
|
287
295
|
int.c.migrateSessionStore(ctx, pn, lid)
|
|
288
296
|
}
|
|
289
297
|
|
|
290
|
-
func (int *DangerousInternalClient) DecryptMessages(ctx context.Context, info *types.MessageInfo, node *waBinary.Node)
|
|
291
|
-
|
|
298
|
+
func (int *DangerousInternalClient) DecryptMessages(ctx context.Context, info *types.MessageInfo, node *waBinary.Node) {
|
|
299
|
+
int.c.decryptMessages(ctx, info, node)
|
|
292
300
|
}
|
|
293
301
|
|
|
294
302
|
func (int *DangerousInternalClient) ClearUntrustedIdentity(ctx context.Context, target types.JID) error {
|
|
@@ -475,6 +483,10 @@ func (int *DangerousInternalClient) UploadPreKeys(ctx context.Context) {
|
|
|
475
483
|
int.c.uploadPreKeys(ctx)
|
|
476
484
|
}
|
|
477
485
|
|
|
486
|
+
func (int *DangerousInternalClient) FetchPreKeysNoError(ctx context.Context, retryDevices []types.JID) map[types.JID]*prekey.Bundle {
|
|
487
|
+
return int.c.fetchPreKeysNoError(ctx, retryDevices)
|
|
488
|
+
}
|
|
489
|
+
|
|
478
490
|
func (int *DangerousInternalClient) FetchPreKeys(ctx context.Context, users []types.JID) (map[types.JID]preKeyResp, error) {
|
|
479
491
|
return int.c.fetchPreKeys(ctx, users)
|
|
480
492
|
}
|
|
@@ -507,16 +519,20 @@ func (int *DangerousInternalClient) ParseReceipt(node *waBinary.Node) (*events.R
|
|
|
507
519
|
return int.c.parseReceipt(node)
|
|
508
520
|
}
|
|
509
521
|
|
|
522
|
+
func (int *DangerousInternalClient) BackgroundIfAsyncAck(fn func()) {
|
|
523
|
+
int.c.backgroundIfAsyncAck(fn)
|
|
524
|
+
}
|
|
525
|
+
|
|
510
526
|
func (int *DangerousInternalClient) MaybeDeferredAck(ctx context.Context, node *waBinary.Node) func(...*bool) {
|
|
511
527
|
return int.c.maybeDeferredAck(ctx, node)
|
|
512
528
|
}
|
|
513
529
|
|
|
514
|
-
func (int *DangerousInternalClient) SendAck(node *waBinary.Node) {
|
|
515
|
-
int.c.sendAck(node)
|
|
530
|
+
func (int *DangerousInternalClient) SendAck(node *waBinary.Node, error int) {
|
|
531
|
+
int.c.sendAck(node, error)
|
|
516
532
|
}
|
|
517
533
|
|
|
518
|
-
func (int *DangerousInternalClient) SendMessageReceipt(info *types.MessageInfo) {
|
|
519
|
-
int.c.sendMessageReceipt(info)
|
|
534
|
+
func (int *DangerousInternalClient) SendMessageReceipt(info *types.MessageInfo, node *waBinary.Node) {
|
|
535
|
+
int.c.sendMessageReceipt(info, node)
|
|
520
536
|
}
|
|
521
537
|
|
|
522
538
|
func (int *DangerousInternalClient) GenerateRequestID() string {
|
|
@@ -607,7 +623,7 @@ func (int *DangerousInternalClient) PrepareMessageNodeV3(ctx context.Context, to
|
|
|
607
623
|
return int.c.prepareMessageNodeV3(ctx, to, ownID, id, payload, skdm, msgAttrs, frankingTag, participants, timings)
|
|
608
624
|
}
|
|
609
625
|
|
|
610
|
-
func (int *DangerousInternalClient) EncryptMessageForDevicesV3(ctx context.Context, allDevices []types.JID, ownID types.JID, id string, payload *waMsgTransport.MessageTransport_Payload, skdm *waMsgTransport.MessageTransport_Protocol_Ancillary_SenderKeyDistributionMessage, dsm *waMsgTransport.MessageTransport_Protocol_Integral_DeviceSentMessage, encAttrs waBinary.Attrs) []waBinary.Node {
|
|
626
|
+
func (int *DangerousInternalClient) EncryptMessageForDevicesV3(ctx context.Context, allDevices []types.JID, ownID types.JID, id string, payload *waMsgTransport.MessageTransport_Payload, skdm *waMsgTransport.MessageTransport_Protocol_Ancillary_SenderKeyDistributionMessage, dsm *waMsgTransport.MessageTransport_Protocol_Integral_DeviceSentMessage, encAttrs waBinary.Attrs) ([]waBinary.Node, error) {
|
|
611
627
|
return int.c.encryptMessageForDevicesV3(ctx, allDevices, ownID, id, payload, skdm, dsm, encAttrs)
|
|
612
628
|
}
|
|
613
629
|
|
|
@@ -651,16 +667,16 @@ func (int *DangerousInternalClient) MakeDeviceIdentityNode() waBinary.Node {
|
|
|
651
667
|
return int.c.makeDeviceIdentityNode()
|
|
652
668
|
}
|
|
653
669
|
|
|
654
|
-
func (int *DangerousInternalClient) EncryptMessageForDevices(ctx context.Context, allDevices []types.JID, id string, msgPlaintext, dsmPlaintext []byte, encAttrs waBinary.Attrs) ([]waBinary.Node, bool) {
|
|
670
|
+
func (int *DangerousInternalClient) EncryptMessageForDevices(ctx context.Context, allDevices []types.JID, id string, msgPlaintext, dsmPlaintext []byte, encAttrs waBinary.Attrs) ([]waBinary.Node, bool, error) {
|
|
655
671
|
return int.c.encryptMessageForDevices(ctx, allDevices, id, msgPlaintext, dsmPlaintext, encAttrs)
|
|
656
672
|
}
|
|
657
673
|
|
|
658
|
-
func (int *DangerousInternalClient) EncryptMessageForDeviceAndWrap(ctx context.Context, plaintext []byte, wireIdentity, encryptionIdentity types.JID, bundle *prekey.Bundle, encAttrs waBinary.Attrs) (*waBinary.Node, bool, error) {
|
|
659
|
-
return int.c.encryptMessageForDeviceAndWrap(ctx, plaintext, wireIdentity, encryptionIdentity, bundle, encAttrs)
|
|
674
|
+
func (int *DangerousInternalClient) EncryptMessageForDeviceAndWrap(ctx context.Context, plaintext []byte, wireIdentity, encryptionIdentity types.JID, bundle *prekey.Bundle, encAttrs waBinary.Attrs, existingSessions map[string]bool) (*waBinary.Node, bool, error) {
|
|
675
|
+
return int.c.encryptMessageForDeviceAndWrap(ctx, plaintext, wireIdentity, encryptionIdentity, bundle, encAttrs, existingSessions)
|
|
660
676
|
}
|
|
661
677
|
|
|
662
|
-
func (int *DangerousInternalClient) EncryptMessageForDevice(ctx context.Context, plaintext []byte, to types.JID, bundle *prekey.Bundle, extraAttrs waBinary.Attrs) (*waBinary.Node, bool, error) {
|
|
663
|
-
return int.c.encryptMessageForDevice(ctx, plaintext, to, bundle, extraAttrs)
|
|
678
|
+
func (int *DangerousInternalClient) EncryptMessageForDevice(ctx context.Context, plaintext []byte, to types.JID, bundle *prekey.Bundle, extraAttrs waBinary.Attrs, existingSessions map[string]bool) (*waBinary.Node, bool, error) {
|
|
679
|
+
return int.c.encryptMessageForDevice(ctx, plaintext, to, bundle, extraAttrs, existingSessions)
|
|
664
680
|
}
|
|
665
681
|
|
|
666
682
|
func (int *DangerousInternalClient) RawUpload(ctx context.Context, dataToUpload io.Reader, uploadSize uint64, fileHash []byte, appInfo MediaType, newsletter bool, resp *UploadResponse) error {
|
|
@@ -57,12 +57,12 @@ func (cli *Client) handleEncryptedMessage(node *waBinary.Node) {
|
|
|
57
57
|
if len(info.PushName) > 0 && info.PushName != "-" && (cli.MessengerConfig == nil || info.PushName != "username") {
|
|
58
58
|
go cli.updatePushName(cli.BackgroundEventCtx, info.Sender, info, info.PushName)
|
|
59
59
|
}
|
|
60
|
-
var cancelled bool
|
|
61
|
-
defer cli.maybeDeferredAck(ctx, node)(&cancelled)
|
|
62
60
|
if info.Sender.Server == types.NewsletterServer {
|
|
61
|
+
var cancelled bool
|
|
62
|
+
defer cli.maybeDeferredAck(ctx, node)(&cancelled)
|
|
63
63
|
cancelled = cli.handlePlaintextMessage(ctx, info, node)
|
|
64
64
|
} else {
|
|
65
|
-
|
|
65
|
+
cli.decryptMessages(ctx, info, node)
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
}
|
|
@@ -95,12 +95,40 @@ func (cli *Client) parseMessageSource(node *waBinary.Node, requireParticipant bo
|
|
|
95
95
|
}
|
|
96
96
|
if from.Server == types.BroadcastServer {
|
|
97
97
|
source.BroadcastListOwner = ag.OptionalJIDOrEmpty("recipient")
|
|
98
|
+
participants, ok := node.GetOptionalChildByTag("participants")
|
|
99
|
+
if ok && source.IsFromMe {
|
|
100
|
+
children := participants.GetChildren()
|
|
101
|
+
source.BroadcastRecipients = make([]types.BroadcastRecipient, 0, len(children))
|
|
102
|
+
for _, child := range children {
|
|
103
|
+
if child.Tag != "to" {
|
|
104
|
+
continue
|
|
105
|
+
}
|
|
106
|
+
cag := child.AttrGetter()
|
|
107
|
+
mainJID := cag.JID("jid")
|
|
108
|
+
if mainJID.Server == types.HiddenUserServer {
|
|
109
|
+
source.BroadcastRecipients = append(source.BroadcastRecipients, types.BroadcastRecipient{
|
|
110
|
+
LID: mainJID,
|
|
111
|
+
PN: cag.OptionalJIDOrEmpty("peer_recipient_pn"),
|
|
112
|
+
})
|
|
113
|
+
} else {
|
|
114
|
+
source.BroadcastRecipients = append(source.BroadcastRecipients, types.BroadcastRecipient{
|
|
115
|
+
LID: cag.OptionalJIDOrEmpty("peer_recipient_lid"),
|
|
116
|
+
PN: mainJID,
|
|
117
|
+
})
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
98
121
|
}
|
|
99
122
|
} else if from.Server == types.NewsletterServer {
|
|
100
123
|
source.Chat = from
|
|
101
124
|
source.Sender = from
|
|
102
125
|
// TODO IsFromMe?
|
|
103
126
|
} else if from.User == clientID.User || from.User == clientLID.User {
|
|
127
|
+
if from.Server == types.HostedServer {
|
|
128
|
+
from.Server = types.DefaultUserServer
|
|
129
|
+
} else if from.Server == types.HostedLIDServer {
|
|
130
|
+
from.Server = types.HiddenUserServer
|
|
131
|
+
}
|
|
104
132
|
source.IsFromMe = true
|
|
105
133
|
source.Sender = from
|
|
106
134
|
recipient := ag.OptionalJID("recipient")
|
|
@@ -109,7 +137,7 @@ func (cli *Client) parseMessageSource(node *waBinary.Node, requireParticipant bo
|
|
|
109
137
|
} else {
|
|
110
138
|
source.Chat = from.ToNonAD()
|
|
111
139
|
}
|
|
112
|
-
if source.Chat.Server == types.HiddenUserServer {
|
|
140
|
+
if source.Chat.Server == types.HiddenUserServer || source.Chat.Server == types.HostedLIDServer {
|
|
113
141
|
source.RecipientAlt = ag.OptionalJIDOrEmpty("peer_recipient_pn")
|
|
114
142
|
} else {
|
|
115
143
|
source.RecipientAlt = ag.OptionalJIDOrEmpty("peer_recipient_lid")
|
|
@@ -125,9 +153,14 @@ func (cli *Client) parseMessageSource(node *waBinary.Node, requireParticipant bo
|
|
|
125
153
|
source.Chat = from
|
|
126
154
|
}
|
|
127
155
|
} else {
|
|
156
|
+
if from.Server == types.HostedServer {
|
|
157
|
+
from.Server = types.DefaultUserServer
|
|
158
|
+
} else if from.Server == types.HostedLIDServer {
|
|
159
|
+
from.Server = types.HiddenUserServer
|
|
160
|
+
}
|
|
128
161
|
source.Chat = from.ToNonAD()
|
|
129
162
|
source.Sender = from
|
|
130
|
-
if source.Sender.Server == types.HiddenUserServer {
|
|
163
|
+
if source.Sender.Server == types.HiddenUserServer || source.Chat.Server == types.HostedLIDServer {
|
|
131
164
|
source.SenderAlt = ag.OptionalJIDOrEmpty("sender_pn")
|
|
132
165
|
} else {
|
|
133
166
|
source.SenderAlt = ag.OptionalJIDOrEmpty("sender_lid")
|
|
@@ -263,23 +296,21 @@ func (cli *Client) migrateSessionStore(ctx context.Context, pn, lid types.JID) {
|
|
|
263
296
|
}
|
|
264
297
|
}
|
|
265
298
|
|
|
266
|
-
func (cli *Client) decryptMessages(ctx context.Context, info *types.MessageInfo, node *waBinary.Node)
|
|
299
|
+
func (cli *Client) decryptMessages(ctx context.Context, info *types.MessageInfo, node *waBinary.Node) {
|
|
267
300
|
unavailableNode, ok := node.GetOptionalChildByTag("unavailable")
|
|
268
301
|
if ok && len(node.GetChildrenByTag("enc")) == 0 {
|
|
269
302
|
uType := events.UnavailableType(unavailableNode.AttrGetter().String("type"))
|
|
270
303
|
cli.Log.Warnf("Unavailable message %s from %s (type: %q)", info.ID, info.SourceString(), uType)
|
|
271
|
-
|
|
304
|
+
cli.backgroundIfAsyncAck(func() {
|
|
272
305
|
cli.immediateRequestMessageFromPhone(ctx, info)
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
}
|
|
306
|
+
cli.sendAck(node, 0)
|
|
307
|
+
})
|
|
276
308
|
cli.dispatchEvent(&events.UndecryptableMessage{Info: *info, IsUnavailable: true, UnavailableType: uType})
|
|
277
309
|
return
|
|
278
310
|
}
|
|
279
311
|
|
|
280
312
|
children := node.GetChildren()
|
|
281
313
|
cli.Log.Debugf("Decrypting message from %s", info.SourceString())
|
|
282
|
-
handled := false
|
|
283
314
|
containsDirectMsg := false
|
|
284
315
|
senderEncryptionJID := info.Sender
|
|
285
316
|
if info.Sender.Server == types.DefaultUserServer && !info.Sender.IsBot() {
|
|
@@ -296,10 +327,12 @@ func (cli *Client) decryptMessages(ctx context.Context, info *types.MessageInfo,
|
|
|
296
327
|
cli.Log.Warnf("No LID found for %s", info.Sender)
|
|
297
328
|
}
|
|
298
329
|
}
|
|
330
|
+
var recognizedStanza, protobufFailed bool
|
|
299
331
|
for _, child := range children {
|
|
300
332
|
if child.Tag != "enc" {
|
|
301
333
|
continue
|
|
302
334
|
}
|
|
335
|
+
recognizedStanza = true
|
|
303
336
|
ag := child.AttrGetter()
|
|
304
337
|
encType, ok := ag.GetString("type", false)
|
|
305
338
|
if !ok {
|
|
@@ -346,22 +379,29 @@ func (cli *Client) decryptMessages(ctx context.Context, info *types.MessageInfo,
|
|
|
346
379
|
|
|
347
380
|
if errors.Is(err, EventAlreadyProcessed) {
|
|
348
381
|
cli.Log.Debugf("Ignoring message %s from %s: %v", info.ID, info.SourceString(), err)
|
|
349
|
-
|
|
382
|
+
continue
|
|
383
|
+
} else if errors.Is(err, signalerror.ErrOldCounter) {
|
|
384
|
+
cli.Log.Warnf("Ignoring message %s from %s: %v", info.ID, info.SourceString(), err)
|
|
385
|
+
continue
|
|
350
386
|
} else if err != nil {
|
|
351
387
|
cli.Log.Warnf("Error decrypting message %s from %s: %v", info.ID, info.SourceString(), err)
|
|
352
388
|
if ctx.Err() != nil || errors.Is(err, context.Canceled) {
|
|
353
|
-
handlerFailed = true
|
|
354
389
|
return
|
|
355
390
|
}
|
|
356
391
|
isUnavailable := encType == "skmsg" && !containsDirectMsg && errors.Is(err, signalerror.ErrNoSenderKeyForUser)
|
|
357
|
-
if encType
|
|
358
|
-
|
|
359
|
-
cli.
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
|
|
392
|
+
if encType == "msmsg" {
|
|
393
|
+
cli.backgroundIfAsyncAck(func() {
|
|
394
|
+
cli.sendAck(node, NackMissingMessageSecret)
|
|
395
|
+
})
|
|
396
|
+
} else if cli.SynchronousAck {
|
|
397
|
+
cli.sendRetryReceipt(ctx, node, info, isUnavailable)
|
|
398
|
+
// TODO this probably isn't supposed to ack
|
|
399
|
+
cli.sendAck(node, 0)
|
|
400
|
+
} else {
|
|
401
|
+
go cli.sendRetryReceipt(context.WithoutCancel(ctx), node, info, isUnavailable)
|
|
402
|
+
go cli.sendAck(node, 0)
|
|
363
403
|
}
|
|
364
|
-
|
|
404
|
+
cli.dispatchEvent(&events.UndecryptableMessage{
|
|
365
405
|
Info: *info,
|
|
366
406
|
IsUnavailable: isUnavailable,
|
|
367
407
|
DecryptFailMode: events.DecryptFailMode(ag.OptionalString("decrypt-fail")),
|
|
@@ -372,33 +412,38 @@ func (cli *Client) decryptMessages(ctx context.Context, info *types.MessageInfo,
|
|
|
372
412
|
cli.cancelDelayedRequestFromPhone(info.ID)
|
|
373
413
|
|
|
374
414
|
var msg waE2E.Message
|
|
415
|
+
var handlerFailed bool
|
|
375
416
|
switch ag.Int("v") {
|
|
376
417
|
case 2:
|
|
377
418
|
err = proto.Unmarshal(decrypted, &msg)
|
|
378
419
|
if err != nil {
|
|
379
420
|
cli.Log.Warnf("Error unmarshaling decrypted message from %s: %v", info.SourceString(), err)
|
|
421
|
+
protobufFailed = true
|
|
380
422
|
continue
|
|
381
423
|
}
|
|
424
|
+
protobufFailed = false
|
|
382
425
|
handlerFailed = cli.handleDecryptedMessage(ctx, info, &msg, retryCount)
|
|
383
|
-
handled = true
|
|
384
426
|
case 3:
|
|
385
|
-
|
|
427
|
+
handlerFailed, protobufFailed = cli.handleDecryptedArmadillo(ctx, info, decrypted, retryCount)
|
|
386
428
|
default:
|
|
387
429
|
cli.Log.Warnf("Unknown version %d in decrypted message from %s", ag.Int("v"), info.SourceString())
|
|
388
430
|
}
|
|
389
431
|
if handlerFailed {
|
|
390
432
|
cli.Log.Warnf("Handler for %s failed", info.ID)
|
|
433
|
+
return
|
|
391
434
|
}
|
|
392
|
-
if ciphertextHash != nil && cli.EnableDecryptedEventBuffer
|
|
435
|
+
if ciphertextHash != nil && cli.EnableDecryptedEventBuffer {
|
|
393
436
|
// Use the context passed to decryptMessages
|
|
394
437
|
err = cli.Store.EventBuffer.ClearBufferedEventPlaintext(ctx, *ciphertextHash)
|
|
395
438
|
if err != nil {
|
|
396
439
|
zerolog.Ctx(ctx).Err(err).
|
|
397
440
|
Hex("ciphertext_hash", ciphertextHash[:]).
|
|
441
|
+
Str("message_id", info.ID).
|
|
398
442
|
Msg("Failed to clear buffered event plaintext")
|
|
399
443
|
} else {
|
|
400
444
|
zerolog.Ctx(ctx).Debug().
|
|
401
445
|
Hex("ciphertext_hash", ciphertextHash[:]).
|
|
446
|
+
Str("message_id", info.ID).
|
|
402
447
|
Msg("Deleted event plaintext from buffer")
|
|
403
448
|
}
|
|
404
449
|
|
|
@@ -413,9 +458,15 @@ func (cli *Client) decryptMessages(ctx context.Context, info *types.MessageInfo,
|
|
|
413
458
|
}
|
|
414
459
|
}
|
|
415
460
|
}
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
461
|
+
cli.backgroundIfAsyncAck(func() {
|
|
462
|
+
if !recognizedStanza {
|
|
463
|
+
cli.sendAck(node, NackUnrecognizedStanza)
|
|
464
|
+
} else if protobufFailed {
|
|
465
|
+
cli.sendAck(node, NackInvalidProtobuf)
|
|
466
|
+
} else {
|
|
467
|
+
cli.sendMessageReceipt(info, node)
|
|
468
|
+
}
|
|
469
|
+
})
|
|
419
470
|
return
|
|
420
471
|
}
|
|
421
472
|
|
|
@@ -231,6 +231,29 @@ func (cli *Client) DecryptPollVote(ctx context.Context, vote *events.Message) (*
|
|
|
231
231
|
return &msg, nil
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
+
func (cli *Client) DecryptSecretEncryptedMessage(ctx context.Context, evt *events.Message) (*waE2E.Message, error) {
|
|
235
|
+
encMessage := evt.Message.GetSecretEncryptedMessage()
|
|
236
|
+
if encMessage == nil {
|
|
237
|
+
return nil, ErrNotSecretEncryptedMessage
|
|
238
|
+
}
|
|
239
|
+
if encMessage.GetSecretEncType() != waE2E.SecretEncryptedMessage_EVENT_EDIT {
|
|
240
|
+
return nil, fmt.Errorf("unsupported secret enc type: %s", encMessage.SecretEncType.String())
|
|
241
|
+
}
|
|
242
|
+
plaintext, err := cli.decryptMsgSecret(ctx, evt, EncSecretEventEdit, encMessage, encMessage.GetTargetMessageKey())
|
|
243
|
+
if err != nil {
|
|
244
|
+
return nil, fmt.Errorf("failed to decrypt message: %w", err)
|
|
245
|
+
}
|
|
246
|
+
var msg waE2E.Message
|
|
247
|
+
err = proto.Unmarshal(plaintext, &msg)
|
|
248
|
+
if err != nil {
|
|
249
|
+
return nil, fmt.Errorf("failed to decode message protobuf: %w", err)
|
|
250
|
+
}
|
|
251
|
+
if evt.Message.MessageContextInfo != nil && msg.MessageContextInfo == nil {
|
|
252
|
+
msg.MessageContextInfo = evt.Message.MessageContextInfo
|
|
253
|
+
}
|
|
254
|
+
return &msg, nil
|
|
255
|
+
}
|
|
256
|
+
|
|
234
257
|
func getKeyFromInfo(msgInfo *types.MessageInfo) *waCommon.MessageKey {
|
|
235
258
|
creationKey := &waCommon.MessageKey{
|
|
236
259
|
RemoteJID: proto.String(msgInfo.Chat.String()),
|
|
@@ -430,7 +430,7 @@ func (cli *Client) handleNotification(node *waBinary.Node) {
|
|
|
430
430
|
case "fbid:devices":
|
|
431
431
|
cli.handleFBDeviceNotification(ctx, node)
|
|
432
432
|
case "w:gp2":
|
|
433
|
-
evt, lidPairs, err := cli.parseGroupNotification(node)
|
|
433
|
+
evt, lidPairs, redactedPhones, err := cli.parseGroupNotification(node)
|
|
434
434
|
if err != nil {
|
|
435
435
|
cli.Log.Errorf("Failed to parse group notification: %v", err)
|
|
436
436
|
} else {
|
|
@@ -438,6 +438,10 @@ func (cli *Client) handleNotification(node *waBinary.Node) {
|
|
|
438
438
|
if err != nil {
|
|
439
439
|
cli.Log.Errorf("Failed to store LID mappings from group notification: %v", err)
|
|
440
440
|
}
|
|
441
|
+
err = cli.Store.Contacts.PutManyRedactedPhones(ctx, redactedPhones)
|
|
442
|
+
if err != nil {
|
|
443
|
+
cli.Log.Warnf("Failed to store redacted phones from group notification: %v", err)
|
|
444
|
+
}
|
|
441
445
|
cancelled = cli.dispatchEvent(evt)
|
|
442
446
|
}
|
|
443
447
|
case "picture":
|
|
@@ -26,10 +26,11 @@ import (
|
|
|
26
26
|
)
|
|
27
27
|
|
|
28
28
|
var (
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
AdvAccountSignaturePrefix = []byte{6, 0}
|
|
30
|
+
AdvDeviceSignaturePrefix = []byte{6, 1}
|
|
31
|
+
|
|
32
|
+
AdvHostedAccountSignaturePrefix = []byte{6, 5}
|
|
33
|
+
AdvHostedDeviceSignaturePrefix = []byte{6, 6}
|
|
33
34
|
)
|
|
34
35
|
|
|
35
36
|
func (cli *Client) handleIQ(node *waBinary.Node) {
|
|
@@ -113,11 +114,11 @@ func (cli *Client) handlePair(ctx context.Context, deviceIdentityBytes []byte, r
|
|
|
113
114
|
cli.sendPairError(reqID, 500, "internal-error")
|
|
114
115
|
return &PairProtoError{"failed to parse device identity container in pair success message", err}
|
|
115
116
|
}
|
|
116
|
-
isHostedAccount := deviceIdentityContainer.AccountType != nil && *deviceIdentityContainer.AccountType == waAdv.ADVEncryptionType_HOSTED
|
|
117
117
|
|
|
118
118
|
h := hmac.New(sha256.New, cli.Store.AdvSecretKey)
|
|
119
|
-
if
|
|
120
|
-
h.Write(
|
|
119
|
+
if deviceIdentityContainer.GetAccountType() == waAdv.ADVEncryptionType_HOSTED {
|
|
120
|
+
h.Write(AdvHostedAccountSignaturePrefix)
|
|
121
|
+
//cli.Store.IsHosted = true
|
|
121
122
|
}
|
|
122
123
|
h.Write(deviceIdentityContainer.Details)
|
|
123
124
|
|
|
@@ -134,13 +135,6 @@ func (cli *Client) handlePair(ctx context.Context, deviceIdentityBytes []byte, r
|
|
|
134
135
|
return &PairProtoError{"failed to parse signed device identity in pair success message", err}
|
|
135
136
|
}
|
|
136
137
|
|
|
137
|
-
if !verifyDeviceIdentityAccountSignature(&deviceIdentity, cli.Store.IdentityKey, isHostedAccount) {
|
|
138
|
-
cli.sendPairError(reqID, 401, "signature-mismatch")
|
|
139
|
-
return ErrPairInvalidDeviceSignature
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
deviceIdentity.DeviceSignature = generateDeviceSignature(&deviceIdentity, cli.Store.IdentityKey, isHostedAccount)[:]
|
|
143
|
-
|
|
144
138
|
var deviceIdentityDetails waAdv.ADVDeviceIdentity
|
|
145
139
|
err = proto.Unmarshal(deviceIdentity.Details, &deviceIdentityDetails)
|
|
146
140
|
if err != nil {
|
|
@@ -148,6 +142,13 @@ func (cli *Client) handlePair(ctx context.Context, deviceIdentityBytes []byte, r
|
|
|
148
142
|
return &PairProtoError{"failed to parse device identity details in pair success message", err}
|
|
149
143
|
}
|
|
150
144
|
|
|
145
|
+
if !verifyAccountSignature(&deviceIdentity, cli.Store.IdentityKey, deviceIdentityDetails.GetDeviceType() == waAdv.ADVEncryptionType_HOSTED) {
|
|
146
|
+
cli.sendPairError(reqID, 401, "signature-mismatch")
|
|
147
|
+
return ErrPairInvalidDeviceSignature
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
deviceIdentity.DeviceSignature = generateDeviceSignature(&deviceIdentity, cli.Store.IdentityKey)[:]
|
|
151
|
+
|
|
151
152
|
if cli.PrePairCallback != nil && !cli.PrePairCallback(jid, platform, businessName) {
|
|
152
153
|
cli.sendPairError(reqID, 500, "internal-error")
|
|
153
154
|
return ErrPairRejectedLocally
|
|
@@ -224,7 +225,7 @@ func concatBytes(data ...[]byte) []byte {
|
|
|
224
225
|
return output
|
|
225
226
|
}
|
|
226
227
|
|
|
227
|
-
func
|
|
228
|
+
func verifyAccountSignature(deviceIdentity *waAdv.ADVSignedDeviceIdentity, ikp *keys.KeyPair, isHosted bool) bool {
|
|
228
229
|
if len(deviceIdentity.AccountSignatureKey) != 32 || len(deviceIdentity.AccountSignature) != 64 {
|
|
229
230
|
return false
|
|
230
231
|
}
|
|
@@ -232,19 +233,17 @@ func verifyDeviceIdentityAccountSignature(deviceIdentity *waAdv.ADVSignedDeviceI
|
|
|
232
233
|
signatureKey := ecc.NewDjbECPublicKey(*(*[32]byte)(deviceIdentity.AccountSignatureKey))
|
|
233
234
|
signature := *(*[64]byte)(deviceIdentity.AccountSignature)
|
|
234
235
|
|
|
235
|
-
prefix :=
|
|
236
|
-
if
|
|
237
|
-
prefix =
|
|
236
|
+
prefix := AdvAccountSignaturePrefix
|
|
237
|
+
if isHosted {
|
|
238
|
+
prefix = AdvHostedAccountSignaturePrefix
|
|
238
239
|
}
|
|
239
240
|
message := concatBytes(prefix, deviceIdentity.Details, ikp.Pub[:])
|
|
241
|
+
|
|
240
242
|
return ecc.VerifySignature(signatureKey, message, signature)
|
|
241
243
|
}
|
|
242
244
|
|
|
243
|
-
func generateDeviceSignature(deviceIdentity *waAdv.ADVSignedDeviceIdentity, ikp *keys.KeyPair
|
|
244
|
-
prefix :=
|
|
245
|
-
if isHostedAccount {
|
|
246
|
-
prefix = AdvHostedPrefixDeviceIdentityDeviceSignatureVerification
|
|
247
|
-
}
|
|
245
|
+
func generateDeviceSignature(deviceIdentity *waAdv.ADVSignedDeviceIdentity, ikp *keys.KeyPair) *[64]byte {
|
|
246
|
+
prefix := AdvDeviceSignaturePrefix
|
|
248
247
|
message := concatBytes(prefix, deviceIdentity.Details, ikp.Pub[:], deviceIdentity.AccountSignatureKey)
|
|
249
248
|
sig := ecc.CalculateSignature(ecc.NewDjbECPrivateKey(*ikp.Priv), message)
|
|
250
249
|
return &sig
|
|
@@ -93,6 +93,27 @@ func (cli *Client) uploadPreKeys(ctx context.Context) {
|
|
|
93
93
|
return
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
+
func (cli *Client) fetchPreKeysNoError(ctx context.Context, retryDevices []types.JID) map[types.JID]*prekey.Bundle {
|
|
97
|
+
if len(retryDevices) == 0 {
|
|
98
|
+
return nil
|
|
99
|
+
}
|
|
100
|
+
bundlesResp, err := cli.fetchPreKeys(ctx, retryDevices)
|
|
101
|
+
if err != nil {
|
|
102
|
+
cli.Log.Warnf("Failed to fetch prekeys for %v with no existing session: %v", retryDevices, err)
|
|
103
|
+
return nil
|
|
104
|
+
}
|
|
105
|
+
bundles := make(map[types.JID]*prekey.Bundle, len(retryDevices))
|
|
106
|
+
for _, jid := range retryDevices {
|
|
107
|
+
resp := bundlesResp[jid]
|
|
108
|
+
if resp.err != nil {
|
|
109
|
+
cli.Log.Warnf("Failed to fetch prekey for %s: %v", jid, resp.err)
|
|
110
|
+
continue
|
|
111
|
+
}
|
|
112
|
+
bundles[jid] = resp.bundle
|
|
113
|
+
}
|
|
114
|
+
return bundles
|
|
115
|
+
}
|
|
116
|
+
|
|
96
117
|
type preKeyResp struct {
|
|
97
118
|
bundle *prekey.Bundle
|
|
98
119
|
err error
|