From: Chris Duncan Date: Mon, 18 Aug 2025 04:03:19 +0000 (-0700) Subject: Use braces for if statement and byte length for typed array instantiation. X-Git-Tag: v0.10.5~41^2~81 X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=df4f6d2b68821298378e2d2e8f5dc4ae21c3072f;p=libnemo.git Use braces for if statement and byte length for typed array instantiation. --- diff --git a/src/lib/crypto/nano-nacl.ts b/src/lib/crypto/nano-nacl.ts index 35e57ab..45950ac 100644 --- a/src/lib/crypto/nano-nacl.ts +++ b/src/lib/crypto/nano-nacl.ts @@ -370,7 +370,9 @@ export class NanoNaCl { this.Square(chk, r[0]) this.Multiply(chk, chk, den) - if (this.neq25519(chk, num)) this.Multiply(r[0], r[0], this.I) + if (this.neq25519(chk, num)) { + this.Multiply(r[0], r[0], this.I) + } this.Square(chk, r[0]) this.Multiply(chk, chk, den) @@ -582,7 +584,7 @@ export class NanoNaCl { if (signature.byteLength !== this.crypto_sign_BYTES) { throw new Error(`Signature must be ${this.crypto_sign_BYTES} bytes`) } - const sm = new Uint8Array(this.crypto_sign_BYTES + signedMessage.length) + const sm = new Uint8Array(this.crypto_sign_BYTES + signedMessage.byteLength) sm.set(signature, 0) sm.set(signedMessage, this.crypto_sign_BYTES) return (this.open(sm, publicKey as Uint8Array).byteLength >= 0)