Install polyfills for missing global APIs.
Safe to call multiple times -- subsequent calls are no-ops.
Never installs a crypto.getRandomValues fallback: a non-cryptographic generator would silently weaken every library in the realm that draws randomness from it.
crypto.getRandomValues
An object describing which polyfills were installed.
Whether the TextEncoder polyfill was installed.
TextEncoder
Whether the TextDecoder polyfill was installed.
TextDecoder
Whether the btoa polyfill was installed.
btoa
Whether the atob polyfill was installed.
atob
import { installPolyfills } from "@sebastienrousseau/crypto-edge";const installed = installPolyfills();console.log(installed.textEncoder); // true if polyfill was needed Copy
import { installPolyfills } from "@sebastienrousseau/crypto-edge";const installed = installPolyfills();console.log(installed.textEncoder); // true if polyfill was needed
Install polyfills for missing global APIs.
Safe to call multiple times -- subsequent calls are no-ops.
Never installs a
crypto.getRandomValuesfallback: a non-cryptographic generator would silently weaken every library in the realm that draws randomness from it.