]> git.codecow.com Git - libnemo.git/commitdiff
Fix signing in blocks.
authorChris Duncan <chris@zoso.dev>
Tue, 31 Mar 2026 09:06:19 +0000 (02:06 -0700)
committerChris Duncan <chris@zoso.dev>
Tue, 31 Mar 2026 09:06:19 +0000 (02:06 -0700)
src/lib/block.ts

index 4fa64f727451490a44223fb5e8a5497c63e7b0f2..b919a0065fc7129697ae17f58ff2904b388228ba 100644 (file)
@@ -412,7 +412,9 @@ export class Block {
                return new Promise(async (resolve, reject) => {
                        try {
                                if (typeof input === 'string' && /^[A-F0-9]{64}$/i.test(input)) {
-                                       const signature = nano25519.sign(hex.toBytes(this.hash), hex.toBytes(input))
+                                       const prv = hex.toBytes(input)
+                                       const pub = nano25519.derive(prv)
+                                       const signature = nano25519.sign(hex.toBytes(this.hash), new Uint8Array([...prv, ...pub]))
                                        this.signature = bytes.toHex(signature)
                                } else if (input instanceof Wallet && typeof index === 'number'
                                        && (frontier === undefined || frontier instanceof (this.constructor as typeof Block))