BrowserCrypto
Browser-backed implementation of Effect's Crypto service.
This module provides a Crypto.Crypto layer backed by the Web Crypto API. The WebCrypto context reference defaults to globalThis.crypto, so browser programs can use the standard implementation while tests or embedded runtimes can provide their own Crypto object.
Layer that directly interfaces with the Web Crypto API.
When to use
Use to provide cryptographic randomness, UUID generation, and digest operations in browser runtimes backed by
globalThis.crypto.Details
Random bytes are produced with
crypto.getRandomValues. Digests are computed withcrypto.subtle.digestand returned asUint8Arrayvalues.Gotchas
The layer dies if the Web Crypto object is unavailable. Digest operations fail with
PlatformErrorwhencrypto.subtle.digestis unavailable or the browser rejects the digest request.