feat: replace async crypto with sync Rust WASM for app state sync (#2315)

* feat: replace async crypto with sync Rust WASM for app state sync

* fix: remove unecessary buffer copying

* fix: update whatsapp-rust-bridge to version 0.5.2 and refactor async calls to sync. HKDF and MD5 in rust
This commit is contained in:
João Lucas
2026-02-05 11:06:47 -03:00
committed by GitHub
parent fa2a837a4a
commit b5c174111f
12 changed files with 97 additions and 181 deletions
+2 -2
View File
@@ -818,7 +818,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
)
const random = randomBytes(32)
const linkCodeSalt = randomBytes(32)
const linkCodePairingExpanded = await hkdf(companionSharedKey, 32, {
const linkCodePairingExpanded = hkdf(companionSharedKey, 32, {
salt: linkCodeSalt,
info: 'link_code_pairing_key_bundle_encryption_key'
})
@@ -832,7 +832,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 = (await hkdf(identityPayload, 32, { info: 'adv_secret' })).toString('base64')
authState.creds.advSecretKey = Buffer.from(hkdf(identityPayload, 32, { info: 'adv_secret' })).toString('base64')
await query({
tag: 'iq',
attrs: {