From: Chris Duncan Date: Wed, 4 Dec 2024 19:57:33 +0000 (-0800) Subject: Use scoped declarations instead of var. X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=eabf29316bd08f2d43a93a53cd26ced312c42603;p=libnemo.git Use scoped declarations instead of var. --- diff --git a/src/lib/nano-nacl.ts b/src/lib/nano-nacl.ts index 5f5b651..c395974 100644 --- a/src/lib/nano-nacl.ts +++ b/src/lib/nano-nacl.ts @@ -836,11 +836,10 @@ const n = () => { throw new Error('bad signature size') if (publicKey.length !== crypto_sign_PUBLICKEYBYTES) throw new Error('bad public key size') - var sm = new Uint8Array(crypto_sign_BYTES + msg.length) - var m = new Uint8Array(crypto_sign_BYTES + msg.length) - var i - for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i] - for (i = 0; i < msg.length; i++) sm[i + crypto_sign_BYTES] = msg[i] + const sm = new Uint8Array(crypto_sign_BYTES + msg.length) + const m = new Uint8Array(crypto_sign_BYTES + msg.length) + for (let i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i] + for (let i = 0; i < msg.length; i++) sm[i + crypto_sign_BYTES] = msg[i] return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0) }