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.
Layers
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
with crypto.subtle.digest and returned as Uint8Array values.
Gotchas
The layer dies if the Web Crypto object is unavailable. Digest operations
fail with PlatformError when crypto.subtle.digest is unavailable or the
browser rejects the digest request.
Signature
declare const layer: Layer.Layer<EffectCrypto.Crypto>