kage-baileys 25.3.12 → 25.3.13
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.
- package/lib/Defaults/connection.js +49 -108
- package/lib/Defaults/constants.js +71 -153
- package/lib/Defaults/index.js +0 -199
- package/lib/Defaults/media.js +0 -60
- package/lib/Defaults/prefix.js +17 -43
- package/lib/Modded/message_builder.js +0 -2355
- package/lib/Signal/Group/ciphertext-message.js +0 -54
- package/lib/Signal/Group/group-session-builder.js +0 -124
- package/lib/Signal/Group/group_cipher.js +0 -230
- package/lib/Signal/Group/index.js +0 -124
- package/lib/Signal/Group/keyhelper.js +0 -108
- package/lib/Signal/Group/sender-chain-key.js +0 -88
- package/lib/Signal/Group/sender-key-distribution-message.js +0 -157
- package/lib/Signal/Group/sender-key-message.js +0 -166
- package/lib/Signal/Group/sender-key-name.js +0 -130
- package/lib/Signal/Group/sender-key-record.js +0 -122
- package/lib/Signal/Group/sender-key-state.js +0 -220
- package/lib/Signal/Group/sender-message-key.js +0 -82
- package/lib/Signal/libsignal.js +0 -646
- package/lib/Signal/lid-mapping.js +0 -537
- package/lib/Socket/Client/index.js +0 -60
- package/lib/Socket/Client/types.js +0 -51
- package/lib/Socket/Client/websocket.js +0 -164
- package/lib/Socket/business.js +0 -708
- package/lib/Socket/chats.js +0 -2253
- package/lib/Socket/communities.js +0 -441
- package/lib/Socket/community.js +504 -1019
- package/lib/Socket/groups.js +0 -727
- package/lib/Socket/messages-recv.js +0 -2780
- package/lib/Socket/messages-send.js +0 -2640
- package/lib/Socket/mex.js +0 -128
- package/lib/Socket/newsletter.js +0 -486
- package/lib/Socket/socket.js +0 -1899
- package/lib/Store/index.js +0 -68
- package/lib/Store/make-cache-manager-store.js +0 -97
- package/lib/Store/make-in-memory-store.js +0 -908
- package/lib/Store/make-ordered-dictionary.js +0 -187
- package/lib/Store/object-repository.js +0 -78
- package/lib/Types/Bussines.js +2 -2
- package/lib/Types/Chat.js +0 -33
- package/lib/Types/Label.js +0 -78
- package/lib/Types/LabelAssociation.js +0 -42
- package/lib/Types/Message.js +0 -46
- package/lib/Types/Mex.js +0 -53
- package/lib/Types/MexUpdates.js +16 -43
- package/lib/Types/Newsletter.js +0 -27
- package/lib/Types/State.js +0 -42
- package/lib/Types/index.js +0 -134
- package/lib/Utils/auth-utils.js +0 -579
- package/lib/Utils/baileys-event-stream.js +65 -142
- package/lib/Utils/browser-utils.js +0 -104
- package/lib/Utils/business.js +0 -519
- package/lib/Utils/chat-utils.js +0 -1702
- package/lib/Utils/companion-reg-client-utils.js +0 -45
- package/lib/Utils/crypto.js +0 -382
- package/lib/Utils/decode-wa-message.js +0 -605
- package/lib/Utils/event-buffer.js +0 -1207
- package/lib/Utils/generics.js +0 -1020
- package/lib/Utils/history.js +0 -231
- package/lib/Utils/identity-change-handler.js +0 -59
- package/lib/Utils/index.js +0 -133
- package/lib/Utils/link-preview.js +0 -228
- package/lib/Utils/logger.js +0 -35
- package/lib/Utils/lt-hash.js +0 -60
- package/lib/Utils/make-mutex.js +0 -110
- package/lib/Utils/message-retry-manager.js +0 -429
- package/lib/Utils/messages-media.js +0 -1899
- package/lib/Utils/messages.js +0 -2950
- package/lib/Utils/noise-handler.js +0 -369
- package/lib/Utils/offline-node-processor.js +0 -50
- package/lib/Utils/pre-key-manager.js +0 -251
- package/lib/Utils/process-message.js +0 -1239
- package/lib/Utils/reporting-utils.js +0 -268
- package/lib/Utils/signal.js +0 -377
- package/lib/Utils/stanza-ack.js +0 -48
- package/lib/Utils/sync-action-utils.js +0 -58
- package/lib/Utils/tc-token-utils.js +0 -28
- package/lib/Utils/validate-connection.js +0 -508
- package/lib/VoIP/audio-feeder.js +0 -146
- package/lib/VoIP/index.js +0 -292
- package/lib/VoIP/relay-transport.js +0 -569
- package/lib/VoIP/signaling.js +0 -613
- package/lib/VoIP/types.js +0 -27
- package/lib/VoIP/wasm-engine.js +0 -1222
- package/lib/VoIP/worker-bootstrap.js +0 -1785
- package/lib/WABinary/constants.js +0 -2639
- package/lib/WABinary/decode.js +0 -612
- package/lib/WABinary/encode.js +0 -556
- package/lib/WABinary/generic-utils.js +0 -272
- package/lib/WABinary/index.js +0 -82
- package/lib/WABinary/jid-utils.js +0 -262
- package/lib/WAM/BinaryInfo.js +0 -50
- package/lib/WAM/constants.js +0 -38242
- package/lib/WAM/encode.js +0 -396
- package/lib/WAM/index.js +0 -78
- package/lib/WAUSync/Protocols/USyncBotProfileProtocol.js +47 -109
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +0 -88
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +0 -142
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +0 -85
- package/lib/WAUSync/Protocols/USyncLIDProtocol.js +30 -63
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +0 -114
- package/lib/WAUSync/Protocols/index.js +0 -82
- package/lib/WAUSync/index.js +0 -78
- package/lib/assets/wasm/loader.js +0 -13
- package/lib/assets/wasm/worker-modules.js +0 -283
- package/lib/index.js +0 -93
- package/package.json +2 -3
- package/WAProto/index.d.ts +0 -46
- package/lib/Defaults/index.d.ts.map +0 -1
- package/lib/Defaults/index.js.map +0 -1
- package/lib/Signal/Group/ciphertext-message.d.ts.map +0 -1
- package/lib/Signal/Group/ciphertext-message.js.map +0 -1
- package/lib/Signal/Group/group-session-builder.d.ts.map +0 -1
- package/lib/Signal/Group/group-session-builder.js.map +0 -1
- package/lib/Signal/Group/group_cipher.d.ts.map +0 -1
- package/lib/Signal/Group/group_cipher.js.map +0 -1
- package/lib/Signal/Group/index.d.ts.map +0 -1
- package/lib/Signal/Group/index.js.map +0 -1
- package/lib/Signal/Group/keyhelper.d.ts.map +0 -1
- package/lib/Signal/Group/keyhelper.js.map +0 -1
- package/lib/Signal/Group/sender-chain-key.d.ts.map +0 -1
- package/lib/Signal/Group/sender-chain-key.js.map +0 -1
- package/lib/Signal/Group/sender-key-distribution-message.d.ts.map +0 -1
- package/lib/Signal/Group/sender-key-distribution-message.js.map +0 -1
- package/lib/Signal/Group/sender-key-message.d.ts.map +0 -1
- package/lib/Signal/Group/sender-key-message.js.map +0 -1
- package/lib/Signal/Group/sender-key-name.d.ts.map +0 -1
- package/lib/Signal/Group/sender-key-name.js.map +0 -1
- package/lib/Signal/Group/sender-key-record.d.ts.map +0 -1
- package/lib/Signal/Group/sender-key-record.js.map +0 -1
- package/lib/Signal/Group/sender-key-state.d.ts.map +0 -1
- package/lib/Signal/Group/sender-key-state.js.map +0 -1
- package/lib/Signal/Group/sender-message-key.d.ts.map +0 -1
- package/lib/Signal/Group/sender-message-key.js.map +0 -1
- package/lib/Signal/libsignal.d.ts.map +0 -1
- package/lib/Signal/libsignal.js.map +0 -1
- package/lib/Signal/lid-mapping.d.ts.map +0 -1
- package/lib/Signal/lid-mapping.js.map +0 -1
- package/lib/Socket/Client/index.d.ts.map +0 -1
- package/lib/Socket/Client/index.js.map +0 -1
- package/lib/Socket/Client/types.d.ts.map +0 -1
- package/lib/Socket/Client/types.js.map +0 -1
- package/lib/Socket/Client/websocket.d.ts.map +0 -1
- package/lib/Socket/Client/websocket.js.map +0 -1
- package/lib/Socket/business.d.ts.map +0 -1
- package/lib/Socket/business.js.map +0 -1
- package/lib/Socket/chats.d.ts.map +0 -1
- package/lib/Socket/chats.js.map +0 -1
- package/lib/Socket/communities.d.ts.map +0 -1
- package/lib/Socket/communities.js.map +0 -1
- package/lib/Socket/groups.d.ts.map +0 -1
- package/lib/Socket/groups.js.map +0 -1
- package/lib/Socket/index.d.ts.map +0 -1
- package/lib/Socket/index.js.map +0 -1
- package/lib/Socket/messages-recv.d.ts.map +0 -1
- package/lib/Socket/messages-recv.js.map +0 -1
- package/lib/Socket/messages-send.d.ts.map +0 -1
- package/lib/Socket/messages-send.js.map +0 -1
- package/lib/Socket/mex.d.ts.map +0 -1
- package/lib/Socket/mex.js.map +0 -1
- package/lib/Socket/newsletter.d.ts.map +0 -1
- package/lib/Socket/newsletter.js.map +0 -1
- package/lib/Socket/socket.d.ts.map +0 -1
- package/lib/Socket/socket.js.map +0 -1
- package/lib/Store/index.d.ts.map +0 -1
- package/lib/Store/index.js.map +0 -1
- package/lib/Store/make-in-memory-store.d.ts.map +0 -1
- package/lib/Store/make-in-memory-store.js.map +0 -1
- package/lib/Store/make-ordered-dictionary.d.ts.map +0 -1
- package/lib/Store/make-ordered-dictionary.js.map +0 -1
- package/lib/Store/object-repository.d.ts.map +0 -1
- package/lib/Store/object-repository.js.map +0 -1
- package/lib/Types/Auth.d.ts.map +0 -1
- package/lib/Types/Auth.js.map +0 -1
- package/lib/Types/Bussines.d.ts.map +0 -1
- package/lib/Types/Call.d.ts.map +0 -1
- package/lib/Types/Chat.d.ts.map +0 -1
- package/lib/Types/Contact.d.ts.map +0 -1
- package/lib/Types/Events.d.ts.map +0 -1
- package/lib/Types/GroupMetadata.d.ts.map +0 -1
- package/lib/Types/Label.d.ts.map +0 -1
- package/lib/Types/LabelAssociation.d.ts.map +0 -1
- package/lib/Types/Message.d.ts.map +0 -1
- package/lib/Types/Mex.d.ts.map +0 -1
- package/lib/Types/Product.d.ts.map +0 -1
- package/lib/Types/RichType.d.ts.map +0 -1
- package/lib/Types/Signal.d.ts.map +0 -1
- package/lib/Types/Socket.d.ts.map +0 -1
- package/lib/Types/State.d.ts.map +0 -1
- package/lib/Types/USync.d.ts.map +0 -1
- package/lib/Types/index.d.ts.map +0 -1
- package/lib/Utils/auth-utils.d.ts.map +0 -1
- package/lib/Utils/auth-utils.js.map +0 -1
- package/lib/Utils/browser-utils.d.ts.map +0 -1
- package/lib/Utils/browser-utils.js.map +0 -1
- package/lib/Utils/business.d.ts.map +0 -1
- package/lib/Utils/business.js.map +0 -1
- package/lib/Utils/chat-utils.d.ts.map +0 -1
- package/lib/Utils/chat-utils.js.map +0 -1
- package/lib/Utils/companion-reg-client-utils.d.ts.map +0 -1
- package/lib/Utils/companion-reg-client-utils.js.map +0 -1
- package/lib/Utils/crypto.d.ts.map +0 -1
- package/lib/Utils/crypto.js.map +0 -1
- package/lib/Utils/decode-wa-message.d.ts.map +0 -1
- package/lib/Utils/decode-wa-message.js.map +0 -1
- package/lib/Utils/event-buffer.d.ts.map +0 -1
- package/lib/Utils/event-buffer.js.map +0 -1
- package/lib/Utils/generics.d.ts.map +0 -1
- package/lib/Utils/generics.js.map +0 -1
- package/lib/Utils/history.d.ts.map +0 -1
- package/lib/Utils/history.js.map +0 -1
- package/lib/Utils/identity-change-handler.d.ts.map +0 -1
- package/lib/Utils/identity-change-handler.js.map +0 -1
- package/lib/Utils/index.d.ts.map +0 -1
- package/lib/Utils/index.js.map +0 -1
- package/lib/Utils/link-preview.d.ts.map +0 -1
- package/lib/Utils/link-preview.js.map +0 -1
- package/lib/Utils/logger.d.ts.map +0 -1
- package/lib/Utils/logger.js.map +0 -1
- package/lib/Utils/lt-hash.d.ts.map +0 -1
- package/lib/Utils/lt-hash.js.map +0 -1
- package/lib/Utils/make-mutex.d.ts.map +0 -1
- package/lib/Utils/make-mutex.js.map +0 -1
- package/lib/Utils/message-retry-manager.d.ts.map +0 -1
- package/lib/Utils/message-retry-manager.js.map +0 -1
- package/lib/Utils/messages-media.d.ts.map +0 -1
- package/lib/Utils/messages-media.js.map +0 -1
- package/lib/Utils/messages.d.ts.map +0 -1
- package/lib/Utils/messages.js.map +0 -1
- package/lib/Utils/noise-handler.d.ts.map +0 -1
- package/lib/Utils/noise-handler.js.map +0 -1
- package/lib/Utils/offline-node-processor.d.ts.map +0 -1
- package/lib/Utils/offline-node-processor.js.map +0 -1
- package/lib/Utils/pre-key-manager.d.ts.map +0 -1
- package/lib/Utils/pre-key-manager.js.map +0 -1
- package/lib/Utils/process-message.d.ts.map +0 -1
- package/lib/Utils/process-message.js.map +0 -1
- package/lib/Utils/reporting-utils.d.ts.map +0 -1
- package/lib/Utils/reporting-utils.js.map +0 -1
- package/lib/Utils/rich-message-utils.d.ts.map +0 -1
- package/lib/Utils/rich-message-utils.js.map +0 -1
- package/lib/Utils/signal.d.ts.map +0 -1
- package/lib/Utils/signal.js.map +0 -1
- package/lib/Utils/stanza-ack.d.ts.map +0 -1
- package/lib/Utils/stanza-ack.js.map +0 -1
- package/lib/Utils/sync-action-utils.d.ts.map +0 -1
- package/lib/Utils/sync-action-utils.js.map +0 -1
- package/lib/Utils/tc-token-utils.d.ts.map +0 -1
- package/lib/Utils/tc-token-utils.js.map +0 -1
- package/lib/Utils/use-multi-file-auth-state.d.ts.map +0 -1
- package/lib/Utils/use-multi-file-auth-state.js.map +0 -1
- package/lib/Utils/use-single-file-auth-state.d.ts.map +0 -1
- package/lib/Utils/use-single-file-auth-state.js.map +0 -1
- package/lib/Utils/use-sqlite-auth-state.d.ts.map +0 -1
- package/lib/Utils/use-sqlite-auth-state.js.map +0 -1
- package/lib/Utils/validate-connection.d.ts.map +0 -1
- package/lib/Utils/validate-connection.js.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js.map +0 -1
|
@@ -1,87 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SenderChainKey = void 0;
|
|
4
|
-
const crypto_1 = require("libsignal/src/crypto");
|
|
5
|
-
const sender_message_key_1 = require("./sender-message-key");
|
|
6
|
-
class SenderChainKey {
|
|
7
|
-
constructor(iteration, chainKey) {
|
|
8
|
-
this.MESSAGE_KEY_SEED = Buffer.from([0x01]);
|
|
9
|
-
this.CHAIN_KEY_SEED = Buffer.from([0x02]);
|
|
10
|
-
this.iteration = iteration;
|
|
11
|
-
if (chainKey instanceof Buffer) {
|
|
12
|
-
this.chainKey = chainKey;
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
this.chainKey = Buffer.from(chainKey || []);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
getIteration() {
|
|
19
|
-
return this.iteration;
|
|
20
|
-
}
|
|
21
|
-
getSenderMessageKey() {
|
|
22
|
-
return new sender_message_key_1.SenderMessageKey(this.iteration, this.getDerivative(this.MESSAGE_KEY_SEED, this.chainKey));
|
|
23
|
-
}
|
|
24
|
-
getNext() {
|
|
25
|
-
return new SenderChainKey(this.iteration + 1, this.getDerivative(this.CHAIN_KEY_SEED, this.chainKey));
|
|
26
|
-
}
|
|
27
|
-
getSeed() {
|
|
28
|
-
return this.chainKey;
|
|
29
|
-
}
|
|
30
|
-
getDerivative(seed, key) {
|
|
31
|
-
return (0, crypto_1.calculateMAC)(key, seed);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
exports.SenderChainKey = SenderChainKey;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const __kageModule12 = (() => {
|
|
38
|
-
const module = { exports: {} }; const exports = module.exports;
|
|
39
|
-
"use strict"
|
|
40
|
-
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true })
|
|
42
|
-
|
|
43
|
-
const { calculateMAC } = require("libsignal/src/crypto")
|
|
44
|
-
const { SenderMessageKey } = require("./sender-message-key")
|
|
45
|
-
|
|
46
|
-
class SenderChainKey {
|
|
47
|
-
constructor(iteration, chainKey) {
|
|
48
|
-
this.MESSAGE_KEY_SEED = Buffer.from([0x01])
|
|
49
|
-
this.CHAIN_KEY_SEED = Buffer.from([0x02])
|
|
50
|
-
this.iteration = iteration
|
|
51
|
-
this.chainKey = Buffer.from(chainKey)
|
|
52
|
-
}
|
|
53
|
-
getIteration() {
|
|
54
|
-
return this.iteration
|
|
55
|
-
}
|
|
56
|
-
getSenderMessageKey() {
|
|
57
|
-
return new SenderMessageKey(this.iteration, this.getDerivative(this.MESSAGE_KEY_SEED, this.chainKey))
|
|
58
|
-
}
|
|
59
|
-
getNext() {
|
|
60
|
-
return new SenderChainKey(this.iteration + 1, this.getDerivative(this.CHAIN_KEY_SEED, this.chainKey))
|
|
61
|
-
}
|
|
62
|
-
getSeed() {
|
|
63
|
-
return this.chainKey
|
|
64
|
-
}
|
|
65
|
-
getDerivative(seed, key) {
|
|
66
|
-
return calculateMAC(key, seed)
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
module.exports = {
|
|
71
|
-
SenderChainKey
|
|
72
|
-
}
|
|
73
|
-
return module.exports;
|
|
74
|
-
})();
|
|
75
|
-
for (const key of Object.keys(__kageModule12)) {
|
|
76
|
-
if (key !== '__esModule' && !Object.prototype.hasOwnProperty.call(exports,key)) Object.defineProperty(exports,key,{enumerable:true,configurable:true,get:()=>__kageModule12[key]});
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
const __kageModule118 = (() => {
|
|
81
|
-
const module = { exports: {} }; const exports = module.exports;
|
|
82
|
-
"use strict";
|
|
83
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
84
|
-
exports.SenderChainKey = void 0;
|
|
85
4
|
const crypto_js_1 = require("libsignal/src/crypto.js");
|
|
86
5
|
const sender_message_key_js_1 = require("./sender-message-key.js");
|
|
87
6
|
class SenderChainKey {
|
|
@@ -108,10 +27,3 @@ class SenderChainKey {
|
|
|
108
27
|
}
|
|
109
28
|
}
|
|
110
29
|
exports.SenderChainKey = SenderChainKey;
|
|
111
|
-
|
|
112
|
-
return module.exports;
|
|
113
|
-
})();
|
|
114
|
-
for (const key of Object.keys(__kageModule118)) {
|
|
115
|
-
if (key !== '__esModule' && !Object.prototype.hasOwnProperty.call(exports,key)) Object.defineProperty(exports,key,{enumerable:true,configurable:true,get:()=>__kageModule118[key]});
|
|
116
|
-
}
|
|
117
|
-
Object.defineProperty(exports, Symbol.for('kage.advanced'), {value:__kageModule118, configurable:true});
|
|
@@ -1,156 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SenderKeyDistributionMessage = void 0;
|
|
4
|
-
const WAProto_1 = require("../../../WAProto");
|
|
5
|
-
const ciphertext_message_1 = require("./ciphertext-message");
|
|
6
|
-
class SenderKeyDistributionMessage extends ciphertext_message_1.CiphertextMessage {
|
|
7
|
-
constructor(id, iteration, chainKey, signatureKey, serialized) {
|
|
8
|
-
super();
|
|
9
|
-
if (serialized) {
|
|
10
|
-
try {
|
|
11
|
-
const message = serialized.slice(1);
|
|
12
|
-
const distributionMessage = WAProto_1.proto.SenderKeyDistributionMessage.decode(message).toJSON();
|
|
13
|
-
this.serialized = serialized;
|
|
14
|
-
this.id = distributionMessage.id;
|
|
15
|
-
this.iteration = distributionMessage.iteration;
|
|
16
|
-
this.chainKey =
|
|
17
|
-
typeof distributionMessage.chainKey === 'string'
|
|
18
|
-
? Buffer.from(distributionMessage.chainKey, 'base64')
|
|
19
|
-
: distributionMessage.chainKey;
|
|
20
|
-
this.signatureKey =
|
|
21
|
-
typeof distributionMessage.signingKey === 'string'
|
|
22
|
-
? Buffer.from(distributionMessage.signingKey, 'base64')
|
|
23
|
-
: distributionMessage.signingKey;
|
|
24
|
-
}
|
|
25
|
-
catch (e) {
|
|
26
|
-
throw new Error(String(e));
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
const version = this.intsToByteHighAndLow(this.CURRENT_VERSION, this.CURRENT_VERSION);
|
|
31
|
-
this.id = id;
|
|
32
|
-
this.iteration = iteration;
|
|
33
|
-
this.chainKey = chainKey;
|
|
34
|
-
this.signatureKey = signatureKey;
|
|
35
|
-
const message = WAProto_1.proto.SenderKeyDistributionMessage.encode(WAProto_1.proto.SenderKeyDistributionMessage.create({
|
|
36
|
-
id,
|
|
37
|
-
iteration,
|
|
38
|
-
chainKey,
|
|
39
|
-
signingKey: this.signatureKey
|
|
40
|
-
})).finish();
|
|
41
|
-
this.serialized = Buffer.concat([Buffer.from([version]), message]);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
intsToByteHighAndLow(highValue, lowValue) {
|
|
45
|
-
return (((highValue << 4) | lowValue) & 0xff) % 256;
|
|
46
|
-
}
|
|
47
|
-
serialize() {
|
|
48
|
-
return this.serialized;
|
|
49
|
-
}
|
|
50
|
-
getType() {
|
|
51
|
-
return this.SENDERKEY_DISTRIBUTION_TYPE;
|
|
52
|
-
}
|
|
53
|
-
getIteration() {
|
|
54
|
-
return this.iteration;
|
|
55
|
-
}
|
|
56
|
-
getChainKey() {
|
|
57
|
-
return typeof this.chainKey === 'string' ? Buffer.from(this.chainKey, 'base64') : this.chainKey;
|
|
58
|
-
}
|
|
59
|
-
getSignatureKey() {
|
|
60
|
-
return typeof this.signatureKey === 'string' ? Buffer.from(this.signatureKey, 'base64') : this.signatureKey;
|
|
61
|
-
}
|
|
62
|
-
getId() {
|
|
63
|
-
return this.id;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
exports.SenderKeyDistributionMessage = SenderKeyDistributionMessage;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const __kageModule13 = (() => {
|
|
70
|
-
const module = { exports: {} }; const exports = module.exports;
|
|
71
|
-
"use strict"
|
|
72
|
-
|
|
73
|
-
Object.defineProperty(exports, "__esModule", { value: true })
|
|
74
|
-
|
|
75
|
-
const { proto } = require("../../../WAProto")
|
|
76
|
-
const { CiphertextMessage } = require("./ciphertext-message")
|
|
77
|
-
|
|
78
|
-
class SenderKeyDistributionMessage extends CiphertextMessage {
|
|
79
|
-
constructor(id, iteration, chainKey, signatureKey, serialized) {
|
|
80
|
-
super()
|
|
81
|
-
if (serialized) {
|
|
82
|
-
try {
|
|
83
|
-
const message = serialized.slice(1)
|
|
84
|
-
const distributionMessage = proto.SenderKeyDistributionMessage.decode(message).toJSON()
|
|
85
|
-
this.serialized = serialized
|
|
86
|
-
this.id = distributionMessage.id
|
|
87
|
-
this.iteration = distributionMessage.iteration
|
|
88
|
-
this.chainKey =
|
|
89
|
-
typeof distributionMessage.chainKey === 'string'
|
|
90
|
-
? Buffer.from(distributionMessage.chainKey, 'base64')
|
|
91
|
-
: distributionMessage.chainKey
|
|
92
|
-
this.signatureKey =
|
|
93
|
-
typeof distributionMessage.signingKey === 'string'
|
|
94
|
-
? Buffer.from(distributionMessage.signingKey, 'base64')
|
|
95
|
-
: distributionMessage.signingKey
|
|
96
|
-
}
|
|
97
|
-
catch (e) {
|
|
98
|
-
throw new Error(String(e))
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
else {
|
|
102
|
-
const version = this.intsToByteHighAndLow(this.CURRENT_VERSION, this.CURRENT_VERSION)
|
|
103
|
-
this.id = id
|
|
104
|
-
this.iteration = iteration
|
|
105
|
-
this.chainKey = chainKey
|
|
106
|
-
this.signatureKey = signatureKey
|
|
107
|
-
const message = proto.SenderKeyDistributionMessage.encode(proto.SenderKeyDistributionMessage.create({
|
|
108
|
-
id,
|
|
109
|
-
iteration,
|
|
110
|
-
chainKey,
|
|
111
|
-
signingKey: this.signatureKey
|
|
112
|
-
})).finish()
|
|
113
|
-
this.serialized = Buffer.concat([Buffer.from([version]), message])
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
intsToByteHighAndLow(highValue, lowValue) {
|
|
117
|
-
return (((highValue << 4) | lowValue) & 0xff) % 256
|
|
118
|
-
}
|
|
119
|
-
serialize() {
|
|
120
|
-
return this.serialized
|
|
121
|
-
}
|
|
122
|
-
getType() {
|
|
123
|
-
return this.SENDERKEY_DISTRIBUTION_TYPE
|
|
124
|
-
}
|
|
125
|
-
getIteration() {
|
|
126
|
-
return this.iteration
|
|
127
|
-
}
|
|
128
|
-
getChainKey() {
|
|
129
|
-
return this.chainKey
|
|
130
|
-
}
|
|
131
|
-
getSignatureKey() {
|
|
132
|
-
return this.signatureKey
|
|
133
|
-
}
|
|
134
|
-
getId() {
|
|
135
|
-
return this.id
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
module.exports = {
|
|
140
|
-
SenderKeyDistributionMessage
|
|
141
|
-
}
|
|
142
|
-
return module.exports;
|
|
143
|
-
})();
|
|
144
|
-
for (const key of Object.keys(__kageModule13)) {
|
|
145
|
-
if (key !== '__esModule' && !Object.prototype.hasOwnProperty.call(exports,key)) Object.defineProperty(exports,key,{enumerable:true,configurable:true,get:()=>__kageModule13[key]});
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
const __kageModule119 = (() => {
|
|
150
|
-
const module = { exports: {} }; const exports = module.exports;
|
|
151
|
-
"use strict";
|
|
152
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
153
|
-
exports.SenderKeyDistributionMessage = void 0;
|
|
154
4
|
const index_js_1 = require("../../../WAProto/index.js");
|
|
155
5
|
const ciphertext_message_js_1 = require("./ciphertext-message.js");
|
|
156
6
|
class SenderKeyDistributionMessage extends ciphertext_message_js_1.CiphertextMessage {
|
|
@@ -214,10 +64,3 @@ class SenderKeyDistributionMessage extends ciphertext_message_js_1.CiphertextMes
|
|
|
214
64
|
}
|
|
215
65
|
}
|
|
216
66
|
exports.SenderKeyDistributionMessage = SenderKeyDistributionMessage;
|
|
217
|
-
|
|
218
|
-
return module.exports;
|
|
219
|
-
})();
|
|
220
|
-
for (const key of Object.keys(__kageModule119)) {
|
|
221
|
-
if (key !== '__esModule' && !Object.prototype.hasOwnProperty.call(exports,key)) Object.defineProperty(exports,key,{enumerable:true,configurable:true,get:()=>__kageModule119[key]});
|
|
222
|
-
}
|
|
223
|
-
Object.defineProperty(exports, Symbol.for('kage.advanced'), {value:__kageModule119, configurable:true});
|
|
@@ -1,165 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SenderKeyMessage = void 0;
|
|
4
|
-
const curve_1 = require("libsignal/src/curve");
|
|
5
|
-
const WAProto_1 = require("../../../WAProto");
|
|
6
|
-
const ciphertext_message_1 = require("./ciphertext-message");
|
|
7
|
-
class SenderKeyMessage extends ciphertext_message_1.CiphertextMessage {
|
|
8
|
-
constructor(keyId, iteration, ciphertext, signatureKey, serialized) {
|
|
9
|
-
super();
|
|
10
|
-
this.SIGNATURE_LENGTH = 64;
|
|
11
|
-
if (serialized) {
|
|
12
|
-
const version = serialized[0];
|
|
13
|
-
const message = serialized.slice(1, serialized.length - this.SIGNATURE_LENGTH);
|
|
14
|
-
const signature = serialized.slice(-1 * this.SIGNATURE_LENGTH);
|
|
15
|
-
const senderKeyMessage = WAProto_1.proto.SenderKeyMessage.decode(message).toJSON();
|
|
16
|
-
this.serialized = serialized;
|
|
17
|
-
this.messageVersion = (version & 0xff) >> 4;
|
|
18
|
-
this.keyId = senderKeyMessage.id;
|
|
19
|
-
this.iteration = senderKeyMessage.iteration;
|
|
20
|
-
this.ciphertext =
|
|
21
|
-
typeof senderKeyMessage.ciphertext === 'string'
|
|
22
|
-
? Buffer.from(senderKeyMessage.ciphertext, 'base64')
|
|
23
|
-
: senderKeyMessage.ciphertext;
|
|
24
|
-
this.signature = signature;
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
const version = (((this.CURRENT_VERSION << 4) | this.CURRENT_VERSION) & 0xff) % 256;
|
|
28
|
-
const ciphertextBuffer = Buffer.from(ciphertext);
|
|
29
|
-
const message = WAProto_1.proto.SenderKeyMessage.encode(WAProto_1.proto.SenderKeyMessage.create({
|
|
30
|
-
id: keyId,
|
|
31
|
-
iteration: iteration,
|
|
32
|
-
ciphertext: ciphertextBuffer
|
|
33
|
-
})).finish();
|
|
34
|
-
const signature = this.getSignature(signatureKey, Buffer.concat([Buffer.from([version]), message]));
|
|
35
|
-
this.serialized = Buffer.concat([Buffer.from([version]), message, Buffer.from(signature)]);
|
|
36
|
-
this.messageVersion = this.CURRENT_VERSION;
|
|
37
|
-
this.keyId = keyId;
|
|
38
|
-
this.iteration = iteration;
|
|
39
|
-
this.ciphertext = ciphertextBuffer;
|
|
40
|
-
this.signature = signature;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
getKeyId() {
|
|
44
|
-
return this.keyId;
|
|
45
|
-
}
|
|
46
|
-
getIteration() {
|
|
47
|
-
return this.iteration;
|
|
48
|
-
}
|
|
49
|
-
getCipherText() {
|
|
50
|
-
return this.ciphertext;
|
|
51
|
-
}
|
|
52
|
-
verifySignature(signatureKey) {
|
|
53
|
-
const part1 = this.serialized.slice(0, this.serialized.length - this.SIGNATURE_LENGTH);
|
|
54
|
-
const part2 = this.serialized.slice(-1 * this.SIGNATURE_LENGTH);
|
|
55
|
-
const res = (0, curve_1.verifySignature)(signatureKey, part1, part2);
|
|
56
|
-
if (!res)
|
|
57
|
-
throw new Error('Invalid signature!');
|
|
58
|
-
}
|
|
59
|
-
getSignature(signatureKey, serialized) {
|
|
60
|
-
return Buffer.from((0, curve_1.calculateSignature)(signatureKey, serialized));
|
|
61
|
-
}
|
|
62
|
-
serialize() {
|
|
63
|
-
return this.serialized;
|
|
64
|
-
}
|
|
65
|
-
getType() {
|
|
66
|
-
return 4;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
exports.SenderKeyMessage = SenderKeyMessage;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
const __kageModule14 = (() => {
|
|
73
|
-
const module = { exports: {} }; const exports = module.exports;
|
|
74
|
-
"use strict"
|
|
75
|
-
|
|
76
|
-
Object.defineProperty(exports, "__esModule", { value: true })
|
|
77
|
-
|
|
78
|
-
const {
|
|
79
|
-
verifySignature,
|
|
80
|
-
calculateSignature
|
|
81
|
-
} = require("libsignal/src/curve")
|
|
82
|
-
const { proto } = require("../../../WAProto")
|
|
83
|
-
const { CiphertextMessage } = require("./ciphertext-message")
|
|
84
|
-
|
|
85
|
-
class SenderKeyMessage extends CiphertextMessage {
|
|
86
|
-
constructor(keyId, iteration, ciphertext, signatureKey, serialized) {
|
|
87
|
-
super()
|
|
88
|
-
this.SIGNATURE_LENGTH = 64
|
|
89
|
-
if (serialized) {
|
|
90
|
-
const version = serialized[0]
|
|
91
|
-
const message = serialized.slice(1, serialized.length - this.SIGNATURE_LENGTH)
|
|
92
|
-
const signature = serialized.slice(-1 * this.SIGNATURE_LENGTH)
|
|
93
|
-
const senderKeyMessage = proto.SenderKeyMessage.decode(message).toJSON()
|
|
94
|
-
this.serialized = serialized
|
|
95
|
-
this.messageVersion = (version & 0xff) >> 4
|
|
96
|
-
this.keyId = senderKeyMessage.id
|
|
97
|
-
this.iteration = senderKeyMessage.iteration
|
|
98
|
-
this.ciphertext =
|
|
99
|
-
typeof senderKeyMessage.ciphertext === 'string'
|
|
100
|
-
? Buffer.from(senderKeyMessage.ciphertext, 'base64')
|
|
101
|
-
: senderKeyMessage.ciphertext
|
|
102
|
-
this.signature = signature
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
const version = (((this.CURRENT_VERSION << 4) | this.CURRENT_VERSION) & 0xff) % 256
|
|
106
|
-
const ciphertextBuffer = Buffer.from(ciphertext)
|
|
107
|
-
const message = proto.SenderKeyMessage.encode(proto.SenderKeyMessage.create({
|
|
108
|
-
id: keyId,
|
|
109
|
-
iteration: iteration,
|
|
110
|
-
ciphertext: ciphertextBuffer
|
|
111
|
-
})).finish()
|
|
112
|
-
const signature = this.getSignature(signatureKey, Buffer.concat([Buffer.from([version]), message]))
|
|
113
|
-
this.serialized = Buffer.concat([Buffer.from([version]), message, Buffer.from(signature)])
|
|
114
|
-
this.messageVersion = this.CURRENT_VERSION
|
|
115
|
-
this.keyId = keyId
|
|
116
|
-
this.iteration = iteration
|
|
117
|
-
this.ciphertext = ciphertextBuffer
|
|
118
|
-
this.signature = signature
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
getKeyId() {
|
|
122
|
-
return this.keyId
|
|
123
|
-
}
|
|
124
|
-
getIteration() {
|
|
125
|
-
return this.iteration
|
|
126
|
-
}
|
|
127
|
-
getCipherText() {
|
|
128
|
-
return this.ciphertext
|
|
129
|
-
}
|
|
130
|
-
verifySignature(signatureKey) {
|
|
131
|
-
const part1 = this.serialized.slice(0, this.serialized.length - this.SIGNATURE_LENGTH)
|
|
132
|
-
const part2 = this.serialized.slice(-1 * this.SIGNATURE_LENGTH)
|
|
133
|
-
const res = verifySignature(signatureKey, part1, part2)
|
|
134
|
-
if (!res)
|
|
135
|
-
throw new Error('Invalid signature!')
|
|
136
|
-
}
|
|
137
|
-
getSignature(signatureKey, serialized) {
|
|
138
|
-
return Buffer.from(calculateSignature(signatureKey, serialized))
|
|
139
|
-
}
|
|
140
|
-
serialize() {
|
|
141
|
-
return this.serialized
|
|
142
|
-
}
|
|
143
|
-
getType() {
|
|
144
|
-
return 4
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
module.exports = {
|
|
149
|
-
SenderKeyMessage
|
|
150
|
-
}
|
|
151
|
-
return module.exports;
|
|
152
|
-
})();
|
|
153
|
-
for (const key of Object.keys(__kageModule14)) {
|
|
154
|
-
if (key !== '__esModule' && !Object.prototype.hasOwnProperty.call(exports,key)) Object.defineProperty(exports,key,{enumerable:true,configurable:true,get:()=>__kageModule14[key]});
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
const __kageModule120 = (() => {
|
|
159
|
-
const module = { exports: {} }; const exports = module.exports;
|
|
160
|
-
"use strict";
|
|
161
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
162
|
-
exports.SenderKeyMessage = void 0;
|
|
163
4
|
const curve_js_1 = require("libsignal/src/curve.js");
|
|
164
5
|
const index_js_1 = require("../../../WAProto/index.js");
|
|
165
6
|
const ciphertext_message_js_1 = require("./ciphertext-message.js");
|
|
@@ -226,10 +67,3 @@ class SenderKeyMessage extends ciphertext_message_js_1.CiphertextMessage {
|
|
|
226
67
|
}
|
|
227
68
|
}
|
|
228
69
|
exports.SenderKeyMessage = SenderKeyMessage;
|
|
229
|
-
|
|
230
|
-
return module.exports;
|
|
231
|
-
})();
|
|
232
|
-
for (const key of Object.keys(__kageModule120)) {
|
|
233
|
-
if (key !== '__esModule' && !Object.prototype.hasOwnProperty.call(exports,key)) Object.defineProperty(exports,key,{enumerable:true,configurable:true,get:()=>__kageModule120[key]});
|
|
234
|
-
}
|
|
235
|
-
Object.defineProperty(exports, Symbol.for('kage.advanced'), {value:__kageModule120, configurable:true});
|
|
@@ -49,133 +49,3 @@ class SenderKeyName {
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
exports.SenderKeyName = SenderKeyName;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const __kageModule15 = (() => {
|
|
55
|
-
const module = { exports: {} }; const exports = module.exports;
|
|
56
|
-
"use strict"
|
|
57
|
-
|
|
58
|
-
Object.defineProperty(exports, "__esModule", { value: true })
|
|
59
|
-
|
|
60
|
-
function isNull(str) {
|
|
61
|
-
return str === null || str === ''
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function intValue(num) {
|
|
65
|
-
const MAX_VALUE = 0x7fffffff
|
|
66
|
-
const MIN_VALUE = -0x80000000
|
|
67
|
-
if (num > MAX_VALUE || num < MIN_VALUE) {
|
|
68
|
-
return num & 0xffffffff
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return num
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function hashCode(strKey) {
|
|
75
|
-
let hash = 0
|
|
76
|
-
if (!isNull(strKey)) {
|
|
77
|
-
for (let i = 0; i < strKey.length; i++) {
|
|
78
|
-
hash = hash * 31 + strKey.charCodeAt(i)
|
|
79
|
-
hash = intValue(hash)
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
return hash
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
class SenderKeyName {
|
|
86
|
-
constructor(groupId, sender) {
|
|
87
|
-
this.groupId = groupId
|
|
88
|
-
this.sender = sender
|
|
89
|
-
}
|
|
90
|
-
getGroupId() {
|
|
91
|
-
return this.groupId
|
|
92
|
-
}
|
|
93
|
-
getSender() {
|
|
94
|
-
return this.sender
|
|
95
|
-
}
|
|
96
|
-
serialize() {
|
|
97
|
-
return `${this.groupId}::${this.sender.id}::${this.sender.deviceId}`
|
|
98
|
-
}
|
|
99
|
-
toString() {
|
|
100
|
-
return this.serialize()
|
|
101
|
-
}
|
|
102
|
-
equals(other) {
|
|
103
|
-
if (other === null)
|
|
104
|
-
return false
|
|
105
|
-
return this.groupId === other.groupId && this.sender.toString() === other.sender.toString()
|
|
106
|
-
}
|
|
107
|
-
hashCode() {
|
|
108
|
-
return hashCode(this.groupId) ^ hashCode(this.sender.toString())
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
module.exports = {
|
|
113
|
-
SenderKeyName
|
|
114
|
-
}
|
|
115
|
-
return module.exports;
|
|
116
|
-
})();
|
|
117
|
-
for (const key of Object.keys(__kageModule15)) {
|
|
118
|
-
if (key !== '__esModule' && !Object.prototype.hasOwnProperty.call(exports,key)) Object.defineProperty(exports,key,{enumerable:true,configurable:true,get:()=>__kageModule15[key]});
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
const __kageModule121 = (() => {
|
|
123
|
-
const module = { exports: {} }; const exports = module.exports;
|
|
124
|
-
"use strict";
|
|
125
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
126
|
-
exports.SenderKeyName = void 0;
|
|
127
|
-
function isNull(str) {
|
|
128
|
-
return str === null || str === '';
|
|
129
|
-
}
|
|
130
|
-
function intValue(num) {
|
|
131
|
-
const MAX_VALUE = 0x7fffffff;
|
|
132
|
-
const MIN_VALUE = -0x80000000;
|
|
133
|
-
if (num > MAX_VALUE || num < MIN_VALUE) {
|
|
134
|
-
return num & 0xffffffff;
|
|
135
|
-
}
|
|
136
|
-
return num;
|
|
137
|
-
}
|
|
138
|
-
function hashCode(strKey) {
|
|
139
|
-
let hash = 0;
|
|
140
|
-
if (!isNull(strKey)) {
|
|
141
|
-
for (let i = 0; i < strKey.length; i++) {
|
|
142
|
-
hash = hash * 31 + strKey.charCodeAt(i);
|
|
143
|
-
hash = intValue(hash);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
return hash;
|
|
147
|
-
}
|
|
148
|
-
class SenderKeyName {
|
|
149
|
-
constructor(groupId, sender) {
|
|
150
|
-
this.groupId = groupId;
|
|
151
|
-
this.sender = sender;
|
|
152
|
-
}
|
|
153
|
-
getGroupId() {
|
|
154
|
-
return this.groupId;
|
|
155
|
-
}
|
|
156
|
-
getSender() {
|
|
157
|
-
return this.sender;
|
|
158
|
-
}
|
|
159
|
-
serialize() {
|
|
160
|
-
return `${this.groupId}::${this.sender.id}::${this.sender.deviceId}`;
|
|
161
|
-
}
|
|
162
|
-
toString() {
|
|
163
|
-
return this.serialize();
|
|
164
|
-
}
|
|
165
|
-
equals(other) {
|
|
166
|
-
if (other === null)
|
|
167
|
-
return false;
|
|
168
|
-
return this.groupId === other.groupId && this.sender.toString() === other.sender.toString();
|
|
169
|
-
}
|
|
170
|
-
hashCode() {
|
|
171
|
-
return hashCode(this.groupId) ^ hashCode(this.sender.toString());
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
exports.SenderKeyName = SenderKeyName;
|
|
175
|
-
|
|
176
|
-
return module.exports;
|
|
177
|
-
})();
|
|
178
|
-
for (const key of Object.keys(__kageModule121)) {
|
|
179
|
-
if (key !== '__esModule' && !Object.prototype.hasOwnProperty.call(exports,key)) Object.defineProperty(exports,key,{enumerable:true,configurable:true,get:()=>__kageModule121[key]});
|
|
180
|
-
}
|
|
181
|
-
Object.defineProperty(exports, Symbol.for('kage.advanced'), {value:__kageModule121, configurable:true});
|