refactor: Change Sync Functions to Promises to Prevent Blocking Event Loop (#896)

* initial commit

* lint

* lint 2
This commit is contained in:
vini
2024-07-03 04:29:16 -03:00
committed by GitHub
parent fdf9d48162
commit dbf25771a1
5 changed files with 21 additions and 15 deletions

View File

@@ -548,7 +548,7 @@ export const makeSocket = (config: SocketConfig) => {
async function generatePairingKey() {
const salt = randomBytes(32)
const randomIv = randomBytes(16)
const key = derivePairingCodeKey(authState.creds.pairingCode!, salt)
const key = await derivePairingCodeKey(authState.creds.pairingCode!, salt)
const ciphered = aesEncryptCTR(authState.creds.pairingEphemeralKeyPair.public, key, randomIv)
return Buffer.concat([salt, randomIv, ciphered])
}