From: Chris Duncan Date: Wed, 5 Aug 2026 23:43:01 +0000 (-0700) Subject: Clear buffers in Tools, but only local ones. X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=1cda0fbc680a730f51f43fc2c4ee3ce87b6f51d3;p=libnemo.git Clear buffers in Tools, but only local ones. --- diff --git a/src/lib/tools.ts b/src/lib/tools.ts index f346d36..ee3d09d 100644 --- a/src/lib/tools.ts +++ b/src/lib/tools.ts @@ -198,7 +198,10 @@ export function verify (publicKey: string | ArrayBuffer | Bytes, signature: stri return nano25519_verify(s, utf8.toBytes(input), k) } catch (err) { throw new Error('Failed to verify signature', { cause: err }) - } + } finally { + k.fill(0) + s.fill(0) + } } function normalize (input: string | ArrayBuffer | Bytes): Bytes { @@ -206,5 +209,5 @@ function normalize (input: string | ArrayBuffer | Bytes): Bytes { ? hex.toBytes(input) : input instanceof ArrayBuffer ? new Uint8Array(input.slice()) - : input + : new Uint8Array(input) }