]> git.codecow.com Git - libnemo.git/commitdiff
Add check for transient user activation prior to signing with wallet.
authorChris Duncan <chris@zoso.dev>
Sat, 25 Apr 2026 23:00:39 +0000 (16:00 -0700)
committerChris Duncan <chris@zoso.dev>
Sat, 25 Apr 2026 23:00:39 +0000 (16:00 -0700)
src/lib/wallet/index.ts

index 5325b64f96cbd78bd0fd8990f00908612968ce8b..77299bbc5fea94908033df0f11aca26549d9ff31 100644 (file)
@@ -371,6 +371,9 @@ export class Wallet {
        */\r
        async sign (index: number, block: Block, frontier?: Block): Promise<void>\r
        async sign (index: number, data: string | string[] | Block, frontier?: Block): Promise<void | string> {\r
+               if (navigator.userActivation?.isActive === false) {\r
+                       throw new Error('Signing request was blocked due to lack of user activation.')\r
+               }\r
                return data instanceof Block\r
                        ? await _signBlock(this, this.#vault, index, data, frontier)\r
                        : await _signData(this, this.#vault, index, data)\r