]> zoso.dev Git - libnemo.git/commitdiff
Fix address to public key extraction.
authorChris Duncan <chris@zoso.dev>
Tue, 3 Dec 2024 13:02:54 +0000 (05:02 -0800)
committerChris Duncan <chris@zoso.dev>
Tue, 3 Dec 2024 13:02:54 +0000 (05:02 -0800)
src/lib/account.ts

index a1be067f9bec19c1eaa271393b60e25b7ae1eb39..114662ec5fe2b27d17494087e52bab7448432232 100644 (file)
@@ -228,12 +228,10 @@ export class Account {
        }\r
 \r
        static #addressToKey (v: string): string {\r
-               const publicKeyBytes = base32.toBytes(v.substring(-60, -8))\r
+               const publicKeyBytes = base32.toBytes(v.slice(-60, -8))\r
                const checksumBytes = base32.toBytes(v.slice(-8))\r
                const blakeHash = new Blake2b(5).update(publicKeyBytes).digest()\r
                blakeHash.reverse()\r
-               console.log(`checksumBytes: ${checksumBytes}`)\r
-               console.log(`blakeHash: ${blakeHash}`)\r
                if (bytes.toHex(checksumBytes) !== bytes.toHex(blakeHash)) {\r
                        throw new Error('Checksum mismatch in address')\r
                }\r