mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
Finished requestPairingCode
This commit is contained in:
@@ -411,31 +411,4 @@ export function bytesToCrockford(buffer: Buffer): string {
|
||||
}
|
||||
|
||||
return crockford.join('')
|
||||
}
|
||||
|
||||
export async function derivePairingKey(pairingCode: string, salt: Buffer) {
|
||||
const encoded = new TextEncoder().encode(pairingCode)
|
||||
const cryptoKey = await crypto.subtle.importKey(
|
||||
'raw',
|
||||
encoded,
|
||||
{
|
||||
name: 'PBKDF2'
|
||||
},
|
||||
!1,
|
||||
[
|
||||
'deriveKey'
|
||||
]
|
||||
)
|
||||
return await crypto.subtle.deriveKey({
|
||||
name: 'PBKDF2',
|
||||
hash: 'SHA-256',
|
||||
salt: salt,
|
||||
iterations: 2 << 16
|
||||
}, cryptoKey, {
|
||||
name: 'AES-CTR',
|
||||
length: 256
|
||||
}, false, [
|
||||
'encrypt',
|
||||
'decrypt'
|
||||
])
|
||||
}
|
||||
Reference in New Issue
Block a user