]> git.codecow.com Git - libnemo.git/commitdiff
Fix address validation regression.
authorChris Duncan <chris@codecow.com>
Sun, 9 Aug 2026 01:54:22 +0000 (18:54 -0700)
committerChris Duncan <chris@codecow.com>
Sun, 9 Aug 2026 01:54:22 +0000 (18:54 -0700)
src/lib/account/address.ts

index e531d38ce3aff391706a98ae1462b7f31fd3da2f..e6c97b64adeb0a4efe0159957e60037d1e95a734 100644 (file)
@@ -31,10 +31,11 @@ export class Address {
                if (typeof value === 'string') {
                        if (hex.is(value) && value.length === ACCOUNT_KEY_HEX_LENGTH) {
                                this.#address = (this.constructor as typeof Address).fromPublicKey(hex.toBuffer(value))
-                       } else {
-                               _validate(value)
+                       } else if (_validate(value)) {
                                this.#address = value
-                       }
+                       } else {
+                               throw new Error('Invalid address')
+                       }       
                } else if (value instanceof ArrayBuffer || value instanceof Uint8Array) {
                        const v = new Uint8Array(value)
                        this.#address = (this.constructor as typeof Address).fromPublicKey(v)