Path: blob/master/node_modules/@adiwajshing/baileys/WASignalGroup/sender_message_key.js
1126 views
const { deriveSecrets } = require('libsignal/src/crypto');1class SenderMessageKey {2iteration = 0;34iv = Buffer.alloc(0);56cipherKey = Buffer.alloc(0);78seed = Buffer.alloc(0);910constructor(iteration, seed) {11const derivative = deriveSecrets(seed, Buffer.alloc(32), Buffer.from('WhisperGroup'));12const keys = new Uint8Array(32);13keys.set(new Uint8Array(derivative[0].slice(16)));14keys.set(new Uint8Array(derivative[1].slice(0, 16)), 16);15this.iv = Buffer.from(derivative[0].slice(0, 16));16this.cipherKey = Buffer.from(keys.buffer);1718this.iteration = iteration;19this.seed = seed;20}2122getIteration() {23return this.iteration;24}2526getIv() {27return this.iv;28}2930getCipherKey() {31return this.cipherKey;32}3334getSeed() {35return this.seed;36}37}38module.exports = SenderMessageKey;3940