]> git.codecow.com Git - libnemo.git/commitdiff
Explicitly only throw when user activation fails in browser and not Node.
authorChris Duncan <chris@codecow.com>
Wed, 5 Aug 2026 02:44:06 +0000 (19:44 -0700)
committerChris Duncan <chris@codecow.com>
Wed, 5 Aug 2026 02:44:06 +0000 (19:44 -0700)
esbuild/config.mjs
src/lib/block/sign.ts
src/lib/tools.ts
src/lib/wallet/sign.ts

index a31112d7fd0d43a22832d7d8381610b3affd11a0..597f03a9a7d25c04f4cebab88ef900c360b21f04 100644 (file)
@@ -59,7 +59,6 @@ export const nodeOptions = {
                './esbuild/inject/fake-indexeddb.mjs'
        ],
        define: {
-               'navigator.userActivation.isActive': 'true',
                'VAULT_WORKER': nodeVaultWorker
        }
 }
index 959c0a9fedad21c527327697f09e94da4d2fe455..6a6e6facefaadeb52431dd8f15273359450b58d9 100644 (file)
@@ -7,7 +7,7 @@ import { Wallet } from '../wallet'
 
 export function _sign (block: Block, input: unknown, index: unknown, frontier: unknown): Block | Promise<Block> {
        if (!navigator.userActivation.isActive) {
-               throw new DOMException(
+               BROWSER: throw new DOMException(
                        'Signing request was blocked due to lack of user activation',
                        'NotAllowedError'
                )
index c43066bd6f84d2ba8a3d1e8f2e57c6eb1a6d3f52..2668310b146d518c5e64c69835b6750b2b0c30da 100644 (file)
@@ -109,7 +109,7 @@ export function convert (amount: unknown, inputUnit: unknown, outputUnit: unknow
  */
 export function sign (secretKey: string | ArrayBuffer | Bytes, input: string): string {
        if (!navigator.userActivation.isActive) {
-               throw new DOMException(
+               BROWSER: throw new DOMException(
                        'Signing request was blocked due to lack of user activation',
                        'NotAllowedError'
                )
index f1c8089bf1e3a53e14420d239b44c1ad8a994f7c..04d73a82299753ae0398345b54c6247901227e4c 100644 (file)
@@ -10,7 +10,7 @@ import { Wallet } from '../wallet'
 export async function _signBlock (wallet: Wallet, vault: Vault, index: number, address: string, block: Block, frontier?: Block): Promise<Block>
 export async function _signBlock (wallet: Wallet, vault: Vault, index: unknown, address: unknown, block: unknown, frontier?: unknown): Promise<Block | string> {
        if (!navigator.userActivation.isActive) {
-               throw new DOMException(
+               BROWSER: throw new DOMException(
                        'Signing request was blocked due to lack of user activation',
                        'NotAllowedError'
                )
@@ -54,7 +54,7 @@ export async function _signBlock (wallet: Wallet, vault: Vault, index: unknown,
 export async function _signData (wallet: Wallet, vault: Vault, index: number, address: string, data: string): Promise<string>
 export async function _signData (wallet: Wallet, vault: Vault, index: unknown, address: unknown, data: unknown): Promise<string> {
        if (!navigator.userActivation.isActive) {
-               throw new DOMException(
+               BROWSER: throw new DOMException(
                        'Signing request was blocked due to lack of user activation',
                        'NotAllowedError'
                )