@byokit/seal has 2,119 recorded weekly downloads on npm.
About @byokit/seal
Install
npm install @byokit/seal
· Latest release · All releases
Quickstart
npm install @byokit/seal
On React Native, install a crypto.getRandomValues polyfill before using it (for example
react-native-get-random-values).
Seal and open a box, keep a JSON value in a secretbox, and sign and verify a message:
import {
boxKeyPair, boxPublicKey, boxKeyPairFromSeed, sealBox, openBox, openBoxFromSeed,
box, openAuthBox, sealNotice, openNotice,
sealJson, openJson,
signingKeyPairFromSeed, signDetached, verifyDetached,
} from '@byokit/seal';
const text = new TextEncoder().encode('hello from the phone');
// Box: anyone with the recipient's public key can seal; only the secret opens.
const recipientSeed = crypto.getRandomValues(new Uint8Array(32));
const recipient = boxKeyPairFromSeed(recipientSeed);
const bundle = sealBox(text, recipient.publicKey);
console.log('box bytes:', bundle.length);
console.log('opened:', new TextDecoder().decode(openBox(bundle, recipient.secretKey)!));
console.log('wrong key:', openBox(bundle, crypto.getRandomValues(new Uint8Array(32))));
// Secretbox JSON: one 32-byte key seals and opens data at rest.
const key = crypto.getRandomValues(new Uint8Array(32));
const stored = sealJson({ machines: ['desk'] }, key);
console.log('json:', openJson(stored, key));
stored[stored.length - 1] ^= 1;
console.log('tampered json:', openJson(stored, key));
// Ed25519 detached signatures.
const signing = signingKeyPairFromSeed(crypto.getRandomValues(new Uint8Array(32)));
const signature = signDetached(text, signing.secretKey);
console.log('signature bytes:', signature.length, 'secret key bytes:', signing.secretKey.length);
console.log('verified:', verifyDetached(text, signature, signing.publicKey));
console.log('other message:', verifyDetached(new TextEncoder().encode('changed'), signature, signing.publicKey));
Output of running the TypeScript file with node (Node 22.18+):
box bytes: 92
opened: hello from the phone
wrong key: null
json: { machines: [ 'desk' ] }
tampered json: null
signature bytes: 64 secret key bytes: 64
verified: true
other message: false
The 92-byte box is 32 (ephemeral public key) + 24 (nonce) + 16 (MAC) + 20 (the message).
API at a glance
| Export | What it does |
|---|---|
boxKeyPair(rng?) | Fresh raw 32-byte X25519 secret and its public key |
boxPublicKey(secret) | X25519 public key from a raw 32-byte secret |
boxKeyPairFromSeed(seed) | X25519 key pair from a 32-byte seed; same as libsodium crypto_box_seed_keypair |
sealBox(bytes, recipientPublicKey, rng?) | Seals bytes to a public key with a fresh ephemeral key |
openBox(bundle, recipientSecret) | Opens with a raw secret; Uint8Array or null |
openBoxFromSeed(bundle, recipientSeed) | Opens with a seed, as in the original API |
box(bytes, theirPublic, mySecret, rng?) | Known-sender authenticated box |
openAuthBox(bundle, theirPublic, mySecret) | Opens a known-sender box; Uint8Array or null |
sealNotice(value, boxPublicKey, rng?) | JSON in an anonymous box; { v: 1, sealed: string } |
openNotice(data, secret) | Opens a notice with a raw secret; unknown or null |
sealSecretBox(bytes, key, rng?) | Seals bytes with a 32-byte secret key |
openSecretBox(bundle, key) | Opens a secretbox; Uint8Array or null |
sealJson(value, key, rng?) | JSON.stringify, UTF-8, then secretbox |
openJson(bundle, key) | Opens and parses; the value or null |
signingKeyPairFromSeed(seed) | Ed25519 key pair from a 32-byte seed; tweetnacl-style 64-byte secret key |
signDetached(bytes, secretKey) | 64-byte detached signature |
verifyDetached(bytes, signature, publicKey) | true or false |
RandomBytes (type) | (length: number) => Uint8Array, the optional RNG the seal functions take |
Every call in one place:
import {
boxKeyPair, boxPublicKey, boxKeyPairFromSeed, sealBox, openBox, openBoxFromSeed,
box, openAuthBox, sealNotice, openNotice,
sealSecretBox, openSecretBox, sealJson, openJson,
signingKeyPairFromSeed, signDetached, verifyDetached,
} from '@byokit/seal';…
Description from the npm listing.
- typescript
- ai
- ai-sdk
- react-native
- web
- privacy
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (1)Similar npm AI SDKs plugins
All 20 @byokit/seal alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/@byokit/seal. First seen Oct 26, 2026; last successful collection Oct 26, 2026. See the methodology.