Skip to content

Commit

Permalink
Merge pull request #123 from LedgerHQ/fix/subtle-in-crypto-feature-de…
Browse files Browse the repository at this point in the history
…tect

feature detect to avoid self.crypto if subtle isn't available
  • Loading branch information
paulmillr authored Jul 25, 2024
2 parents 5249db1 + eb33f84 commit 5ed2512
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ const bits2int_modN = (bytes: Uint8Array): bigint => { // int2octets can't be u
const i2o = (num: bigint): Bytes => n2b(num); // int to octets
declare const globalThis: Record<string, any> | undefined; // Typescript symbol present in browsers
const cr = () => // We support: 1) browsers 2) node.js 19+ 3) deno, other envs with crypto
typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined;
typeof globalThis === 'object' && 'crypto' in globalThis && 'subtle' in globalThis.crypto ? globalThis.crypto : undefined;
type HmacFnSync = undefined | ((key: Bytes, ...msgs: Bytes[]) => Bytes);
let _hmacSync: HmacFnSync; // Can be redefined by use in utils; built-ins don't provide it
const optS: { lowS?: boolean; extraEntropy?: boolean | Hex; } = { lowS: true }; // opts for sign()
Expand Down

0 comments on commit 5ed2512

Please sign in to comment.