From fbe7d490e1438083ad1cb70fa2d29b2dd2af536f Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Mon, 18 Nov 2024 22:58:25 -0800 Subject: [PATCH] Newlines for legibility. --- src/lib/account.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/lib/account.ts b/src/lib/account.ts index d01a988..1f54c92 100644 --- a/src/lib/account.ts +++ b/src/lib/account.ts @@ -143,7 +143,8 @@ export class Account { const expectedChecksum = address.slice(-8) const keyBase32 = address.slice(address.indexOf('_') + 1, -8) const keyBuf = base32.toBytes(keyBase32) - const actualChecksumBuf = blake2b(5, undefined, undefined, undefined, true).update(keyBuf).digest().reverse() + const actualChecksumBuf = blake2b(5, undefined, undefined, undefined, true) + .update(keyBuf).digest().reverse() const actualChecksum = bytes.toBase32(actualChecksumBuf) if (expectedChecksum !== actualChecksum) { @@ -186,7 +187,8 @@ export class Account { static #addressToKey (v: string): string { const keyBytes = base32.toBytes(v.substring(0, 52)) const checksumBytes = base32.toBytes(v.substring(52, 60)) - const blakeHash = blake2b(5, undefined, undefined, undefined, true).update(keyBytes).digest().reverse() + const blakeHash = blake2b(5, undefined, undefined, undefined, true) + .update(keyBytes).digest().reverse() if (bytes.toHex(checksumBytes) !== bytes.toHex(blakeHash)) { throw new Error('Checksum mismatch in address') } @@ -195,7 +197,8 @@ export class Account { static async #keyToAddress (key: string): Promise { const publicKeyBytes = hex.toBytes(key) - const checksum = blake2b(5, undefined, undefined, undefined, true).update(publicKeyBytes).digest().reverse() + const checksum = blake2b(5, undefined, undefined, undefined, true) + .update(publicKeyBytes).digest().reverse() const encoded = bytes.toBase32(publicKeyBytes) const encodedChecksum = bytes.toBase32(checksum) return `${PREFIX}${encoded}${encodedChecksum}` -- 2.34.1