kage-baileys 3.0.6 → 3.2.4
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/Example/connection.cjs +4 -0
- package/README.MD +4726 -48
- package/README.md +5941 -0
- package/WAProto/WAProto.proto +3395 -415
- package/WAProto/compat.cjs +12 -0
- package/WAProto/index.d.ts +47104 -19888
- package/WAProto/index.js +131979 -57361
- package/lib/Addon/http-error.js +43 -0
- package/lib/Addon/index.js +32 -0
- package/lib/Addon/keyed-db.js +250 -0
- package/lib/Addon/link-preview.js +82 -0
- package/lib/Defaults/baileys-version.json +3 -0
- package/lib/Defaults/connection.js +110 -0
- package/lib/Defaults/constants.js +156 -0
- package/lib/Defaults/history.js +46 -0
- package/lib/Defaults/index.js +230 -0
- package/lib/Defaults/media.js +104 -0
- package/lib/Defaults/phonenumber-mcc.json +223 -0
- package/lib/Defaults/prefix.js +44 -0
- package/lib/Extensions/business-advanced.js +382 -0
- package/lib/Extensions/business.js +159 -0
- package/lib/Extensions/chats-advanced.js +1106 -0
- package/lib/Extensions/chats.js +349 -0
- package/lib/Extensions/communities-advanced.js +430 -0
- package/lib/Extensions/community.js +94 -0
- package/lib/Extensions/groups-advanced.js +343 -0
- package/lib/Extensions/index.js +30 -0
- package/lib/Extensions/messages-recv-advanced.js +1690 -0
- package/lib/Extensions/messages-send-advanced.js +622 -0
- package/lib/Extensions/messages-send.js +1380 -0
- package/lib/Extensions/newsletter-advanced.js +228 -0
- package/lib/Extensions/newsletter.js +72 -0
- package/lib/Extensions/socket.js +389 -0
- package/lib/Modded/message_builder.js +2084 -4
- package/lib/Signal/Group/ciphertext-message.js +54 -0
- package/lib/Signal/Group/group-session-builder.js +124 -0
- package/lib/Signal/Group/group_cipher.js +216 -0
- package/lib/Signal/Group/index.js +124 -0
- package/lib/Signal/Group/keyhelper.js +108 -0
- package/lib/Signal/Group/sender-chain-key.js +83 -0
- package/lib/Signal/Group/sender-key-distribution-message.js +157 -0
- package/lib/Signal/Group/sender-key-message.js +166 -0
- package/lib/Signal/Group/sender-key-name.js +130 -0
- package/lib/Signal/Group/sender-key-record.js +113 -0
- package/lib/Signal/Group/sender-key-state.js +208 -0
- package/lib/Signal/Group/sender-message-key.js +82 -0
- package/lib/Signal/libsignal.js +935 -0
- package/lib/Signal/lid-mapping.js +545 -1
- package/lib/Socket/Client/index.js +60 -0
- package/lib/Socket/Client/types.js +51 -0
- package/lib/Socket/Client/websocket.js +152 -0
- package/lib/Socket/business.js +831 -0
- package/lib/Socket/chats.js +2535 -49
- package/lib/Socket/communities.js +450 -1
- package/lib/Socket/community.js +1022 -0
- package/lib/Socket/dugong.js +1 -1
- package/lib/Socket/groups.js +747 -0
- package/lib/Socket/index.js +60 -2
- package/lib/Socket/messages-recv.js +3450 -5
- package/lib/Socket/messages-send.js +3123 -0
- package/lib/Socket/mex.js +126 -1
- package/lib/Socket/newsletter.js +465 -0
- package/lib/Socket/socket.js +2217 -1
- package/lib/Store/index.js +79 -0
- package/lib/Store/make-cache-manager-store.js +186 -0
- package/lib/Store/make-in-memory-store.js +878 -0
- package/lib/Store/make-ordered-dictionary.js +187 -0
- package/lib/Store/object-repository.js +78 -0
- package/lib/Types/Auth.js +25 -0
- package/lib/Types/Bussines.js +25 -1
- package/lib/Types/Call.js +25 -0
- package/lib/Types/Chat.js +39 -0
- package/lib/Types/Contact.js +25 -0
- package/lib/Types/Events.js +25 -0
- package/lib/Types/GroupMetadata.js +25 -0
- package/lib/Types/Label.js +76 -0
- package/lib/Types/LabelAssociation.js +40 -0
- package/lib/Types/Message.js +57 -0
- package/lib/Types/Mex.js +56 -1
- package/lib/Types/MexUpdates.js +46 -0
- package/lib/Types/Newsletter.js +56 -0
- package/lib/Types/Product.js +25 -0
- package/lib/Types/RichType.js +23 -0
- package/lib/Types/Signal.js +25 -0
- package/lib/Types/Socket.js +25 -0
- package/lib/Types/State.js +92 -0
- package/lib/Types/USync.js +25 -0
- package/lib/Types/index.js +133 -0
- package/lib/Utils/auth-utils.js +703 -0
- package/lib/Utils/automation-tools.js +51 -16
- package/lib/Utils/baileys-event-stream.js +146 -0
- package/lib/Utils/browser-utils.js +95 -0
- package/lib/Utils/business.js +525 -0
- package/lib/Utils/chat-utils.js +1861 -0
- package/lib/Utils/companion-reg-client-utils.js +55 -1
- package/lib/Utils/crypto.js +355 -0
- package/lib/Utils/decode-wa-message.js +709 -0
- package/lib/Utils/event-buffer.js +1323 -8
- package/lib/Utils/generics.js +945 -1
- package/lib/Utils/history.js +266 -0
- package/lib/Utils/identity-change-handler.js +62 -1
- package/lib/Utils/index.js +114 -0
- package/lib/Utils/link-preview.js +179 -0
- package/lib/Utils/logger.js +42 -0
- package/lib/Utils/lt-hash.js +73 -0
- package/lib/Utils/make-mutex.js +104 -0
- package/lib/Utils/message-inspector.js +110 -0
- package/lib/Utils/message-retry-manager.js +507 -2
- package/lib/Utils/messages-media.js +1931 -1
- package/lib/Utils/messages.js +3748 -0
- package/lib/Utils/noise-handler.js +423 -0
- package/lib/Utils/offline-node-processor.js +53 -1
- package/lib/Utils/pre-key-manager.js +255 -1
- package/lib/Utils/process-message.js +1592 -0
- package/lib/Utils/reporting-utils.js +272 -1
- package/lib/Utils/rich-message-utils.js +377 -0
- package/lib/Utils/rich-messages.js +1 -1
- package/lib/Utils/signal.js +437 -0
- package/lib/Utils/stanza-ack.js +51 -1
- package/lib/Utils/status-refresh.js +37 -0
- package/lib/Utils/status-tools.js +4 -2
- package/lib/Utils/sync-action-utils.js +63 -1
- package/lib/Utils/tc-token-utils.js +185 -1
- package/lib/Utils/terminal-banner.js +31 -0
- package/lib/Utils/use-multi-file-auth-state.js +271 -0
- package/lib/Utils/use-single-file-auth-state.js +108 -0
- package/lib/Utils/use-sqlite-auth-state.js +142 -0
- package/lib/Utils/validate-connection.js +497 -1
- package/lib/Utils/view-once-compat.js +13 -5
- package/lib/VoIP/audio-feeder.js +150 -0
- package/lib/VoIP/index.js +289 -0
- package/lib/VoIP/relay-transport.js +608 -0
- package/lib/VoIP/signaling.js +583 -0
- package/lib/VoIP/types.js +30 -0
- package/lib/VoIP/wasm-engine.js +1261 -2
- package/lib/VoIP/worker-bootstrap.js +1090 -2
- package/lib/WABinary/constants.js +2805 -0
- package/lib/WABinary/decode.js +649 -2
- package/lib/WABinary/encode.js +564 -2
- package/lib/WABinary/generic-utils.js +401 -0
- package/lib/WABinary/index.js +82 -0
- package/lib/WABinary/jid-utils.js +290 -0
- package/lib/WABinary/types.js +25 -0
- package/lib/WAM/BinaryInfo.js +50 -0
- package/lib/WAM/constants.js +45747 -0
- package/lib/WAM/encode.js +393 -0
- package/lib/WAM/index.js +78 -0
- package/lib/WAUSync/Protocols/USyncBotProfileProtocol.js +135 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +110 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +142 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +85 -0
- package/lib/WAUSync/Protocols/USyncLIDProtocol.js +69 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +107 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +38 -1
- package/lib/WAUSync/Protocols/index.js +83 -0
- package/lib/WAUSync/USyncQuery.js +241 -2
- package/lib/WAUSync/USyncUser.js +86 -0
- package/lib/WAUSync/index.js +78 -0
- package/lib/assets/wasm/loader.js +1875 -1
- package/lib/assets/wasm/worker-modules.js +11047 -1
- package/lib/index.d.ts +126 -0
- package/lib/index.js +53 -21
- package/lib/index.mjs +437 -0
- package/licenses/upstream-MIT.txt +22 -0
- package/maintenance/api-coverage.json +1642 -0
- package/maintenance/archivos-sha256.json +207 -0
- package/maintenance/consumer-validation.log +3 -0
- package/maintenance/dependency-audit.json +4 -4
- package/maintenance/extension-inventory.json +57 -0
- package/maintenance/protocol-update.json +1101 -0
- package/maintenance/protocol-wire-audit.json +4 -0
- package/maintenance/reference-socket-surface.json +209 -0
- package/maintenance/resumen-validacion.json +50 -0
- package/maintenance/validation.log +2725 -0
- package/maintenance/verification.json +566 -0
- package/package.json +107 -9
- package/scripts/check-imports.cjs +10 -0
- package/scripts/check-package.cjs +40 -0
- package/scripts/check-syntax.cjs +1 -1
- package/scripts/generate-protobuf.cjs +6 -1
- package/scripts/generate-public-types.cjs +9 -0
- package/scripts/kage-base64-fix.cjs +45 -0
- package/scripts/maintenance.cjs +10 -0
- package/test/advanced.test.cjs +24 -0
- package/test/base64-fix.test.cjs +49 -0
- package/test/maintenance.test.cjs +1 -1
- package/test/npm-publication.test.cjs +141 -0
- package/test/recepcion-reparada.test.cjs +98 -0
- package/test/resilience-binary.test.cjs +69 -0
- package/test/resilience-transport.test.cjs +34 -0
- package/test/types.test.ts +5 -0
- package/test/upgrade.test.cjs +104 -0
- package/tsconfig.json +20 -0
- package/WAProto/p.html +0 -1
- package/lib/KageExtra/Modded/message_builder.js +0 -2330
- package/lib/KageExtra/VoIP/audio-feeder.js +0 -136
- package/lib/KageExtra/VoIP/index.js +0 -282
- package/lib/KageExtra/VoIP/relay-transport.js +0 -559
- package/lib/KageExtra/VoIP/signaling.js +0 -603
- package/lib/KageExtra/VoIP/types.js +0 -17
- package/lib/KageExtra/VoIP/wasm-engine.js +0 -1214
- package/lib/KageExtra/VoIP/worker-bootstrap.js +0 -1042
- package/lib/KageExtra/assets/wasm/loader.js +0 -5
- package/lib/KageExtra/assets/wasm/whatsapp.wasm +0 -0
- package/lib/KageExtra/assets/wasm/worker-modules.js +0 -273
- package/lib/KageExtra/index.js +0 -3
- package/lib/KageExtra/package.json +0 -1
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +0 -53
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +0 -24
- package/maintenance/revision-full-check.txt +0 -1097
- package/maintenance/revision-library-tests.tap +0 -1088
- package/maintenance/revision-protobuf.txt +0 -5
- package/maintenance/revision-syntax.txt +0 -5
- package/maintenance/schema-coverage.json +0 -23
- package/maintenance/schema-merge.json +0 -30
- package/maintenance/validation-node20.txt +0 -191
- package/maintenance/validation-node22.txt +0 -237
|
@@ -32,3 +32,86 @@ class SenderChainKey {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
exports.SenderChainKey = SenderChainKey;
|
|
35
|
+
|
|
36
|
+
// Kage: compatibilidad de API.
|
|
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("@itsukichan/libsignal-node/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
|
+
// Kage: funciones avanzadas.
|
|
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
|
+
const crypto_js_1 = require("libsignal/src/crypto.js");
|
|
86
|
+
const sender_message_key_js_1 = require("./sender-message-key.js");
|
|
87
|
+
class SenderChainKey {
|
|
88
|
+
constructor(iteration, chainKey) {
|
|
89
|
+
this.MESSAGE_KEY_SEED = Buffer.from([0x01]);
|
|
90
|
+
this.CHAIN_KEY_SEED = Buffer.from([0x02]);
|
|
91
|
+
this.iteration = iteration;
|
|
92
|
+
this.chainKey = Buffer.from(chainKey);
|
|
93
|
+
}
|
|
94
|
+
getIteration() {
|
|
95
|
+
return this.iteration;
|
|
96
|
+
}
|
|
97
|
+
getSenderMessageKey() {
|
|
98
|
+
return new sender_message_key_js_1.SenderMessageKey(this.iteration, this.getDerivative(this.MESSAGE_KEY_SEED, this.chainKey));
|
|
99
|
+
}
|
|
100
|
+
getNext() {
|
|
101
|
+
return new SenderChainKey(this.iteration + 1, this.getDerivative(this.CHAIN_KEY_SEED, this.chainKey));
|
|
102
|
+
}
|
|
103
|
+
getSeed() {
|
|
104
|
+
return this.chainKey;
|
|
105
|
+
}
|
|
106
|
+
getDerivative(seed, key) {
|
|
107
|
+
return (0, crypto_js_1.calculateMAC)(key, seed);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
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});
|
|
@@ -64,3 +64,160 @@ class SenderKeyDistributionMessage extends ciphertext_message_1.CiphertextMessag
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
exports.SenderKeyDistributionMessage = SenderKeyDistributionMessage;
|
|
67
|
+
|
|
68
|
+
// Kage: compatibilidad de API.
|
|
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
|
+
// Kage: funciones avanzadas.
|
|
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
|
+
const index_js_1 = require("../../../WAProto/index.js");
|
|
155
|
+
const ciphertext_message_js_1 = require("./ciphertext-message.js");
|
|
156
|
+
class SenderKeyDistributionMessage extends ciphertext_message_js_1.CiphertextMessage {
|
|
157
|
+
constructor(id, iteration, chainKey, signatureKey, serialized) {
|
|
158
|
+
super();
|
|
159
|
+
if (serialized) {
|
|
160
|
+
try {
|
|
161
|
+
const message = serialized.slice(1);
|
|
162
|
+
const distributionMessage = index_js_1.proto.SenderKeyDistributionMessage.decode(message).toJSON();
|
|
163
|
+
this.serialized = serialized;
|
|
164
|
+
this.id = distributionMessage.id;
|
|
165
|
+
this.iteration = distributionMessage.iteration;
|
|
166
|
+
this.chainKey =
|
|
167
|
+
typeof distributionMessage.chainKey === 'string'
|
|
168
|
+
? Buffer.from(distributionMessage.chainKey, 'base64')
|
|
169
|
+
: distributionMessage.chainKey;
|
|
170
|
+
this.signatureKey =
|
|
171
|
+
typeof distributionMessage.signingKey === 'string'
|
|
172
|
+
? Buffer.from(distributionMessage.signingKey, 'base64')
|
|
173
|
+
: distributionMessage.signingKey;
|
|
174
|
+
}
|
|
175
|
+
catch (e) {
|
|
176
|
+
throw new Error(String(e));
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
const version = this.intsToByteHighAndLow(this.CURRENT_VERSION, this.CURRENT_VERSION);
|
|
181
|
+
this.id = id;
|
|
182
|
+
this.iteration = iteration;
|
|
183
|
+
this.chainKey = chainKey;
|
|
184
|
+
this.signatureKey = signatureKey;
|
|
185
|
+
const message = index_js_1.proto.SenderKeyDistributionMessage.encode(index_js_1.proto.SenderKeyDistributionMessage.create({
|
|
186
|
+
id,
|
|
187
|
+
iteration,
|
|
188
|
+
chainKey,
|
|
189
|
+
signingKey: this.signatureKey
|
|
190
|
+
})).finish();
|
|
191
|
+
this.serialized = Buffer.concat([Buffer.from([version]), message]);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
intsToByteHighAndLow(highValue, lowValue) {
|
|
195
|
+
return (((highValue << 4) | lowValue) & 0xff) % 256;
|
|
196
|
+
}
|
|
197
|
+
serialize() {
|
|
198
|
+
return this.serialized;
|
|
199
|
+
}
|
|
200
|
+
getType() {
|
|
201
|
+
return this.SENDERKEY_DISTRIBUTION_TYPE;
|
|
202
|
+
}
|
|
203
|
+
getIteration() {
|
|
204
|
+
return this.iteration;
|
|
205
|
+
}
|
|
206
|
+
getChainKey() {
|
|
207
|
+
return this.chainKey;
|
|
208
|
+
}
|
|
209
|
+
getSignatureKey() {
|
|
210
|
+
return this.signatureKey;
|
|
211
|
+
}
|
|
212
|
+
getId() {
|
|
213
|
+
return this.id;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
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});
|
|
@@ -67,3 +67,169 @@ class SenderKeyMessage extends ciphertext_message_1.CiphertextMessage {
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
exports.SenderKeyMessage = SenderKeyMessage;
|
|
70
|
+
|
|
71
|
+
// Kage: compatibilidad de API.
|
|
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("@itsukichan/libsignal-node/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
|
+
// Kage: funciones avanzadas.
|
|
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
|
+
const curve_js_1 = require("libsignal/src/curve.js");
|
|
164
|
+
const index_js_1 = require("../../../WAProto/index.js");
|
|
165
|
+
const ciphertext_message_js_1 = require("./ciphertext-message.js");
|
|
166
|
+
class SenderKeyMessage extends ciphertext_message_js_1.CiphertextMessage {
|
|
167
|
+
constructor(keyId, iteration, ciphertext, signatureKey, serialized) {
|
|
168
|
+
super();
|
|
169
|
+
this.SIGNATURE_LENGTH = 64;
|
|
170
|
+
if (serialized) {
|
|
171
|
+
const version = serialized[0];
|
|
172
|
+
const message = serialized.slice(1, serialized.length - this.SIGNATURE_LENGTH);
|
|
173
|
+
const signature = serialized.slice(-1 * this.SIGNATURE_LENGTH);
|
|
174
|
+
const senderKeyMessage = index_js_1.proto.SenderKeyMessage.decode(message).toJSON();
|
|
175
|
+
this.serialized = serialized;
|
|
176
|
+
this.messageVersion = (version & 0xff) >> 4;
|
|
177
|
+
this.keyId = senderKeyMessage.id;
|
|
178
|
+
this.iteration = senderKeyMessage.iteration;
|
|
179
|
+
this.ciphertext =
|
|
180
|
+
typeof senderKeyMessage.ciphertext === 'string'
|
|
181
|
+
? Buffer.from(senderKeyMessage.ciphertext, 'base64')
|
|
182
|
+
: senderKeyMessage.ciphertext;
|
|
183
|
+
this.signature = signature;
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
const version = (((this.CURRENT_VERSION << 4) | this.CURRENT_VERSION) & 0xff) % 256;
|
|
187
|
+
const ciphertextBuffer = Buffer.from(ciphertext);
|
|
188
|
+
const message = index_js_1.proto.SenderKeyMessage.encode(index_js_1.proto.SenderKeyMessage.create({
|
|
189
|
+
id: keyId,
|
|
190
|
+
iteration: iteration,
|
|
191
|
+
ciphertext: ciphertextBuffer
|
|
192
|
+
})).finish();
|
|
193
|
+
const signature = this.getSignature(signatureKey, Buffer.concat([Buffer.from([version]), message]));
|
|
194
|
+
this.serialized = Buffer.concat([Buffer.from([version]), message, Buffer.from(signature)]);
|
|
195
|
+
this.messageVersion = this.CURRENT_VERSION;
|
|
196
|
+
this.keyId = keyId;
|
|
197
|
+
this.iteration = iteration;
|
|
198
|
+
this.ciphertext = ciphertextBuffer;
|
|
199
|
+
this.signature = signature;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
getKeyId() {
|
|
203
|
+
return this.keyId;
|
|
204
|
+
}
|
|
205
|
+
getIteration() {
|
|
206
|
+
return this.iteration;
|
|
207
|
+
}
|
|
208
|
+
getCipherText() {
|
|
209
|
+
return this.ciphertext;
|
|
210
|
+
}
|
|
211
|
+
verifySignature(signatureKey) {
|
|
212
|
+
const part1 = this.serialized.slice(0, this.serialized.length - this.SIGNATURE_LENGTH);
|
|
213
|
+
const part2 = this.serialized.slice(-1 * this.SIGNATURE_LENGTH);
|
|
214
|
+
const res = (0, curve_js_1.verifySignature)(signatureKey, part1, part2);
|
|
215
|
+
if (!res)
|
|
216
|
+
throw new Error('Invalid signature!');
|
|
217
|
+
}
|
|
218
|
+
getSignature(signatureKey, serialized) {
|
|
219
|
+
return Buffer.from((0, curve_js_1.calculateSignature)(signatureKey, serialized));
|
|
220
|
+
}
|
|
221
|
+
serialize() {
|
|
222
|
+
return this.serialized;
|
|
223
|
+
}
|
|
224
|
+
getType() {
|
|
225
|
+
return 4;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
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,3 +49,133 @@ class SenderKeyName {
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
exports.SenderKeyName = SenderKeyName;
|
|
52
|
+
|
|
53
|
+
// Kage: compatibilidad de API.
|
|
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
|
+
// Kage: funciones avanzadas.
|
|
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});
|
|
@@ -51,3 +51,116 @@ class SenderKeyRecord {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
exports.SenderKeyRecord = SenderKeyRecord;
|
|
54
|
+
|
|
55
|
+
// Kage: compatibilidad de API.
|
|
56
|
+
const __kageModule16 = (() => {
|
|
57
|
+
const module = { exports: {} }; const exports = module.exports;
|
|
58
|
+
"use strict"
|
|
59
|
+
|
|
60
|
+
Object.defineProperty(exports, "__esModule", { value: true })
|
|
61
|
+
|
|
62
|
+
const { BufferJSON } = require("../../Utils/generics")
|
|
63
|
+
const { SenderKeyState } = require("./sender-key-state")
|
|
64
|
+
|
|
65
|
+
class SenderKeyRecord {
|
|
66
|
+
constructor(serialized) {
|
|
67
|
+
this.MAX_STATES = 5
|
|
68
|
+
this.senderKeyStates = []
|
|
69
|
+
if (serialized) {
|
|
70
|
+
for (const structure of serialized) {
|
|
71
|
+
this.senderKeyStates.push(new SenderKeyState(null, null, null, null, null, null, structure))
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
isEmpty() {
|
|
76
|
+
return this.senderKeyStates.length === 0
|
|
77
|
+
}
|
|
78
|
+
getSenderKeyState(keyId) {
|
|
79
|
+
if (keyId === undefined && this.senderKeyStates.length) {
|
|
80
|
+
return this.senderKeyStates[this.senderKeyStates.length - 1]
|
|
81
|
+
}
|
|
82
|
+
return this.senderKeyStates.find(state => state.getKeyId() === keyId)
|
|
83
|
+
}
|
|
84
|
+
addSenderKeyState(id, iteration, chainKey, signatureKey) {
|
|
85
|
+
this.senderKeyStates.push(new SenderKeyState(id, iteration, chainKey, null, signatureKey))
|
|
86
|
+
if (this.senderKeyStates.length > this.MAX_STATES) {
|
|
87
|
+
this.senderKeyStates.shift()
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
setSenderKeyState(id, iteration, chainKey, keyPair) {
|
|
91
|
+
this.senderKeyStates.length = 0
|
|
92
|
+
this.senderKeyStates.push(new SenderKeyState(id, iteration, chainKey, keyPair))
|
|
93
|
+
}
|
|
94
|
+
serialize() {
|
|
95
|
+
return this.senderKeyStates.map(state => state.getStructure())
|
|
96
|
+
}
|
|
97
|
+
static deserialize(data) {
|
|
98
|
+
const str = Buffer.from(data).toString('utf-8')
|
|
99
|
+
const parsed = JSON.parse(str, BufferJSON.reviver)
|
|
100
|
+
return new SenderKeyRecord(parsed)
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
module.exports = {
|
|
105
|
+
SenderKeyRecord
|
|
106
|
+
}
|
|
107
|
+
return module.exports;
|
|
108
|
+
})();
|
|
109
|
+
for (const key of Object.keys(__kageModule16)) {
|
|
110
|
+
if (key !== '__esModule' && !Object.prototype.hasOwnProperty.call(exports,key)) Object.defineProperty(exports,key,{enumerable:true,configurable:true,get:()=>__kageModule16[key]});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Kage: funciones avanzadas.
|
|
114
|
+
const __kageModule122 = (() => {
|
|
115
|
+
const module = { exports: {} }; const exports = module.exports;
|
|
116
|
+
"use strict";
|
|
117
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
118
|
+
exports.SenderKeyRecord = void 0;
|
|
119
|
+
const generics_js_1 = require("../../Utils/generics.js");
|
|
120
|
+
const sender_key_state_js_1 = require("./sender-key-state.js");
|
|
121
|
+
class SenderKeyRecord {
|
|
122
|
+
constructor(serialized) {
|
|
123
|
+
this.MAX_STATES = 5;
|
|
124
|
+
this.senderKeyStates = [];
|
|
125
|
+
if (serialized) {
|
|
126
|
+
for (const structure of serialized) {
|
|
127
|
+
this.senderKeyStates.push(new sender_key_state_js_1.SenderKeyState(null, null, null, null, null, null, structure));
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
isEmpty() {
|
|
132
|
+
return this.senderKeyStates.length === 0;
|
|
133
|
+
}
|
|
134
|
+
getSenderKeyState(keyId) {
|
|
135
|
+
if (keyId === undefined && this.senderKeyStates.length) {
|
|
136
|
+
return this.senderKeyStates[this.senderKeyStates.length - 1];
|
|
137
|
+
}
|
|
138
|
+
return this.senderKeyStates.find(state => state.getKeyId() === keyId);
|
|
139
|
+
}
|
|
140
|
+
addSenderKeyState(id, iteration, chainKey, signatureKey) {
|
|
141
|
+
this.senderKeyStates.push(new sender_key_state_js_1.SenderKeyState(id, iteration, chainKey, null, signatureKey));
|
|
142
|
+
if (this.senderKeyStates.length > this.MAX_STATES) {
|
|
143
|
+
this.senderKeyStates.shift();
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
setSenderKeyState(id, iteration, chainKey, keyPair) {
|
|
147
|
+
this.senderKeyStates.length = 0;
|
|
148
|
+
this.senderKeyStates.push(new sender_key_state_js_1.SenderKeyState(id, iteration, chainKey, keyPair));
|
|
149
|
+
}
|
|
150
|
+
serialize() {
|
|
151
|
+
return this.senderKeyStates.map(state => state.getStructure());
|
|
152
|
+
}
|
|
153
|
+
static deserialize(data) {
|
|
154
|
+
const str = Buffer.from(data).toString('utf-8');
|
|
155
|
+
const parsed = JSON.parse(str, generics_js_1.BufferJSON.reviver);
|
|
156
|
+
return new SenderKeyRecord(parsed);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
exports.SenderKeyRecord = SenderKeyRecord;
|
|
160
|
+
|
|
161
|
+
return module.exports;
|
|
162
|
+
})();
|
|
163
|
+
for (const key of Object.keys(__kageModule122)) {
|
|
164
|
+
if (key !== '__esModule' && !Object.prototype.hasOwnProperty.call(exports,key)) Object.defineProperty(exports,key,{enumerable:true,configurable:true,get:()=>__kageModule122[key]});
|
|
165
|
+
}
|
|
166
|
+
Object.defineProperty(exports, Symbol.for('kage.advanced'), {value:__kageModule122, configurable:true});
|