mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
refactor: turn hkdf functions to async and remove extra deps (#1272)
* refactor: remove futoin-hkdf dependency and update hkdf implementation * refactor: use crypto subtle and update functions to async --------- Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
This commit is contained in:
committed by
GitHub
parent
e6f98c3902
commit
8083754621
@@ -476,7 +476,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
||||
const companionSharedKey = Curve.sharedKey(authState.creds.pairingEphemeralKeyPair.private, codePairingPublicKey)
|
||||
const random = randomBytes(32)
|
||||
const linkCodeSalt = randomBytes(32)
|
||||
const linkCodePairingExpanded = hkdf(companionSharedKey, 32, {
|
||||
const linkCodePairingExpanded = await hkdf(companionSharedKey, 32, {
|
||||
salt: linkCodeSalt,
|
||||
info: 'link_code_pairing_key_bundle_encryption_key'
|
||||
})
|
||||
@@ -486,7 +486,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
||||
const encryptedPayload = Buffer.concat([linkCodeSalt, encryptIv, encrypted])
|
||||
const identitySharedKey = Curve.sharedKey(authState.creds.signedIdentityKey.private, primaryIdentityPublicKey)
|
||||
const identityPayload = Buffer.concat([companionSharedKey, identitySharedKey, random])
|
||||
authState.creds.advSecretKey = hkdf(identityPayload, 32, { info: 'adv_secret' }).toString('base64')
|
||||
authState.creds.advSecretKey = (await hkdf(identityPayload, 32, { info: 'adv_secret' })).toString('base64')
|
||||
await query({
|
||||
tag: 'iq',
|
||||
attrs: {
|
||||
|
||||
Reference in New Issue
Block a user