mirror of
https://github.com/fluencelabs/js-libp2p-noise
synced 2025-04-25 14:12:30 +00:00
Naming fix
This commit is contained in:
parent
529389651a
commit
b9f66bcb8e
12
src/xx.ts
12
src/xx.ts
@ -81,8 +81,8 @@ export class XXHandshake {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private nonceToBytes(n: uint32) : bytes {
|
private nonceToBytes(n: uint32) : bytes {
|
||||||
const nonce = Buffer.alloc(12, 0x00);
|
const nonce = Buffer.alloc(12);
|
||||||
nonce.writeUInt32LE(n, 4, true);
|
nonce.writeUInt32LE(n, 4);
|
||||||
|
|
||||||
return nonce;
|
return nonce;
|
||||||
}
|
}
|
||||||
@ -101,11 +101,11 @@ export class XXHandshake {
|
|||||||
|
|
||||||
private decrypt(k: bytes32, n: uint32, ad: bytes, ciphertext: bytes) : bytes {
|
private decrypt(k: bytes32, n: uint32, ad: bytes, ciphertext: bytes) : bytes {
|
||||||
const nonce = this.nonceToBytes(n);
|
const nonce = this.nonceToBytes(n);
|
||||||
const aead = new AEAD();
|
const ctx = new AEAD();
|
||||||
|
|
||||||
aead.init(k, nonce);
|
ctx.init(k, nonce);
|
||||||
aead.aad(ad);
|
ctx.aad(ad);
|
||||||
aead.decrypt(ciphertext);
|
ctx.decrypt(ciphertext);
|
||||||
|
|
||||||
// Decryption is done on the sent reference
|
// Decryption is done on the sent reference
|
||||||
return ciphertext;
|
return ciphertext;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user