Compatibility

@ppabari/strio relies on the Web Crypto API (crypto.getRandomValues), which is available natively across all modern JavaScript runtimes.

Support matrix

Environment Supported Notes
Node.js โœ… โ‰ฅ 18 Web Crypto is global from Node 18 onward.
Browsers โœ… modern Chrome, Edge, Firefox, Safari.
Deno โœ… Web Crypto is built in.
Bun โœ… Web Crypto is built in.
Cloudflare Workers โœ… And other workerd / edge runtimes.
TypeScript โœ… โ‰ฅ 5.0 Ships complete .d.ts declarations.
zod (optional) โœ… โ‰ฅ 3.0 Only needed for the @ppabari/strio/zod subpath.

Runtime check

The package exposes a programmatic check so applications can fail fast on an unsupported runtime instead of erroring at first use.

import { checkCompatibility, assertCompatible } from '@ppabari/strio';

// Inspect without throwing
const report = checkCompatibility();
// {
//   ok: true,
//   cryptoAvailable: true,
//   runtime: 'node',
//   nodeVersion: '20.11.0',
//   warnings: []
// }

// Or fail fast at startup
assertCompatible(); // throws a descriptive Error on an unsupported runtime

From the CLI:

npx @ppabari/strio --check
# Runtime        : node (Node 20.11.0)
# Web Crypto     : available
# Compatible     : yes

See the Compatibility API for the full reference.