]> git.codecow.com Git - libnemo.git/commitdiff
Clear buffers in Tools, but only local ones.
authorChris Duncan <chris@codecow.com>
Wed, 5 Aug 2026 23:43:01 +0000 (16:43 -0700)
committerChris Duncan <chris@codecow.com>
Wed, 5 Aug 2026 23:43:01 +0000 (16:43 -0700)
src/lib/tools.ts

index f346d366601cc1f405fc7814471c6c0dcf949eac..ee3d09df3b83756bcf9bd864118d98c4fd56bb0e 100644 (file)
@@ -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)
 }