From 390d812cb55278086315f889ca59e1212a98f35f Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Thu, 30 Apr 2026 12:35:43 -0700 Subject: [PATCH] Update error thrown by lack of transient activation. --- src/lib/block.ts | 5 ++++- src/lib/tools.ts | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/lib/block.ts b/src/lib/block.ts index d57ccc0..f59b040 100644 --- a/src/lib/block.ts +++ b/src/lib/block.ts @@ -406,7 +406,10 @@ export class Block { async sign (wallet: Wallet, index: number, frontier?: Block): Promise sign (input: unknown, index?: unknown, frontier?: unknown): Block | Promise { if (navigator.userActivation?.isActive === false) { - throw new Error('Signing request was blocked due to lack of user activation.') + throw new DOMException( + 'Signing request was blocked due to lack of user activation', + 'NotAllowedError' + ) } if (typeof input === 'string' && /^[A-F0-9]{128}$/i.test(input)) { this.signature = input diff --git a/src/lib/tools.ts b/src/lib/tools.ts index 55849dd..dc55b3b 100644 --- a/src/lib/tools.ts +++ b/src/lib/tools.ts @@ -147,7 +147,10 @@ export class Tools { */ static sign (secretKey: string | ArrayBuffer | Uint8Array, ...input: string[]): string { if (navigator.userActivation?.isActive === false) { - throw new Error('Signing request was blocked due to lack of user activation.') + throw new DOMException( + 'Signing request was blocked due to lack of user activation', + 'NotAllowedError' + ) } const k = this.#normalize(secretKey) try { -- 2.47.3