]> zoso.dev Git - libnemo.git/commitdiff
Newlines for legibility.
authorChris Duncan <chris@zoso.dev>
Tue, 19 Nov 2024 06:58:25 +0000 (22:58 -0800)
committerChris Duncan <chris@zoso.dev>
Tue, 19 Nov 2024 06:58:25 +0000 (22:58 -0800)
src/lib/account.ts

index d01a988e88b9ce9464e9e061cc348207f7259f8b..1f54c92b166ca5208996603c5a6a3a469ae6b1a4 100644 (file)
@@ -143,7 +143,8 @@ export class Account {
                const expectedChecksum = address.slice(-8)\r
                const keyBase32 = address.slice(address.indexOf('_') + 1, -8)\r
                const keyBuf = base32.toBytes(keyBase32)\r
-               const actualChecksumBuf = blake2b(5, undefined, undefined, undefined, true).update(keyBuf).digest().reverse()\r
+               const actualChecksumBuf = blake2b(5, undefined, undefined, undefined, true)\r
+                       .update(keyBuf).digest().reverse()\r
                const actualChecksum = bytes.toBase32(actualChecksumBuf)\r
 \r
                if (expectedChecksum !== actualChecksum) {\r
@@ -186,7 +187,8 @@ export class Account {
        static #addressToKey (v: string): string {\r
                const keyBytes = base32.toBytes(v.substring(0, 52))\r
                const checksumBytes = base32.toBytes(v.substring(52, 60))\r
-               const blakeHash = blake2b(5, undefined, undefined, undefined, true).update(keyBytes).digest().reverse()\r
+               const blakeHash = blake2b(5, undefined, undefined, undefined, true)\r
+                       .update(keyBytes).digest().reverse()\r
                if (bytes.toHex(checksumBytes) !== bytes.toHex(blakeHash)) {\r
                        throw new Error('Checksum mismatch in address')\r
                }\r
@@ -195,7 +197,8 @@ export class Account {
 \r
        static async #keyToAddress (key: string): Promise<string> {\r
                const publicKeyBytes = hex.toBytes(key)\r
-               const checksum = blake2b(5, undefined, undefined, undefined, true).update(publicKeyBytes).digest().reverse()\r
+               const checksum = blake2b(5, undefined, undefined, undefined, true)\r
+                       .update(publicKeyBytes).digest().reverse()\r
                const encoded = bytes.toBase32(publicKeyBytes)\r
                const encodedChecksum = bytes.toBase32(checksum)\r
                return `${PREFIX}${encoded}${encodedChecksum}`\r