}\r
\r
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 = new Blake2b(5).update(keyBytes).digest()\r
+ const publicKeyBytes = base32.toBytes(v.substring(-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
- return bytes.toHex(keyBytes)\r
+ return bytes.toHex(publicKeyBytes)\r
}\r
\r
static #keyToAddress (key: string): string {\r