]> zoso.dev Git - libnemo.git/commitdiff
Remove secret key derivation from NanoNaCl since it's not applicable to Nano.
authorChris Duncan <chris@zoso.dev>
Tue, 3 Dec 2024 22:34:26 +0000 (14:34 -0800)
committerChris Duncan <chris@zoso.dev>
Tue, 3 Dec 2024 22:34:26 +0000 (14:34 -0800)
src/lib/nano-nacl.ts

index d3d84c0d1b8012e8873795dd8603f30f5584b147..4679023c80368c804933d9dc97cc7197a7a9e2f6 100644 (file)
@@ -813,10 +813,8 @@ const n = () => {
                checkArrayTypes(seed)\r
                if (seed.length !== crypto_sign_SEEDBYTES)\r
                        throw new Error('bad seed size')\r
-               const pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES)\r
-               const sk = new Uint8Array(crypto_sign_SECRETKEYBYTES)\r
-               for (let i = 0; i < 32; i++) sk[i] = seed[i]\r
 \r
+               const pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES)\r
                const p = [gf(), gf(), gf(), gf()]\r
 \r
                const hash = new Blake2b(64).update(seed).digest()\r
@@ -827,9 +825,7 @@ const n = () => {
                scalarbase(p, hash)\r
                pack(pk, p)\r
 \r
-               for (let i = 0; i < 32; i++) sk[i + 32] = pk[i]\r
-\r
-               return { publicKey: pk, secretKey: sk }\r
+               return { publicKey: pk }\r
        }\r
 \r
        return { sign, open, detached, verify, keyPair }\r