The npx zero CLI provides a powerful, secure command-line interface for managing npx zero-knowledge proof identities, challenges, and verifications. Designed for developers and security professionals, it offers robust cryptographic operations with a simple, intuitive interface.
Built on the OBINexus ZKP framework — no trusted setup, no clock-dependent primitives, fully deterministic proofs.
- Node.js (version 16.0.0 or higher)
- npm (Node Package Manager)
Install the npx zero CLI globally to use it from any directory:
npm install -g @obinexusltd/zeroOr add it to a specific project:
npm install @obinexusltd/zeroThe fastest path to a signed, verified identity:
# 1. Create an identity — produces alice.zid (identity) + alice.zid.key (key, separate)
npx zero create -i identity.json -o alice.zid
# 2. Generate a 64-byte challenge
npx zero challenge -o challenge.bin -s 64
# 3. Produce a npx zero-knowledge proof
npx zero prove -i alice.zid -c challenge.bin -o proof.bin
# 4. Verify the proof
npx zero verify-proof -i proof.bin -c challenge.bin -d alice.zid
# 5. Seal a time capsule bound to the proof (clock-independent)
npx zero timecapsule seal -i proof.bin -c challenge.bin -d alice.zid -o alice.ztc
# 6. Open the capsule at abstract sequence 7
npx zero timecapsule open -i alice.ztc -d alice.zid -s 7Creates two separate, strictly scoped files:
alice.zid— identity payload (hash,salt,version)alice.zid.key— verification key only (never bundled with identity)
npx zero create -i identity.json -o alice.zidExample identity.json:
{
"name": "Alice Okpala",
"email": "alice@obinexuscomputing.com",
"role": "Developer"
}With verbose output and a custom algorithm:
npx zero create -i identity.json -o alice.zid -a sha512 -s 64 -vOutput as JSON instead of the default text format:
npx zero create -i identity.json -o alice.zid -f jsonOutput as binary (compact, embed in binary protocols):
npx zero create -i identity.json -o alice.zid -f binary| Flag | Description | Default |
|---|---|---|
-i, --input <file> |
Input JSON file with identity data | required |
-o, --output <file> |
Output .zid file |
required |
-s, --salt <bytes> |
Salt length in bytes | 32 |
-a, --algorithm <algo> |
Hash algorithm (sha256, sha384, sha512) |
sha512 |
-f, --format <format> |
Output format (text, json, binary) |
text |
-v, --verbose |
Display detailed identity information | — |
Verifies that input data reproduces the hash stored in the key file. The .zid path is automatically derived from the .zid.key path (alice.zid.key → alice.zid).
npx zero verify -i identity.json -k alice.zid.keySupply the identity file explicitly (useful when files are in different directories):
npx zero verify -i identity.json -k alice.zid.key -d /secure/store/alice.zidVerify with verbose output (shows hash comparison details):
npx zero verify -i identity.json -k alice.zid.key -vVerify a JSON-format identity file:
npx zero verify -i identity.json -k alice.zid.key -d alice.zid -v| Flag | Description | Default |
|---|---|---|
-i, --input <file> |
Input JSON file to verify | required |
-k, --key <file> |
Key file (.zid.key) |
required |
-d, --id <file> |
Identity file (.zid); auto-derived if omitted |
— |
-v, --verbose |
Show detailed verification information | — |
Derive a purpose-scoped sub-identity from a base identity using PBKDF2. Derived identities are cryptographically bound to both the parent and the purpose string.
npx zero derive -i alice.zid -p "authentication" -o alice.auth.zidDerive for different contexts:
# Signing context
npx zero derive -i alice.zid -p "signing" -o alice.signing.zid
# Monthly session token
npx zero derive -i alice.zid -p "session:2026-02" -o alice.session.zid
# Output as JSON
npx zero derive -i alice.zid -p "api-access" -o alice.api.zid -f json| Flag | Description | Default |
|---|---|---|
-i, --input <file> |
Base identity file | required |
-p, --purpose <str> |
Purpose string for the derivation | required |
-o, --output <file> |
Output derived identity file | — |
-a, --algorithm <algo> |
KDF algorithm | pbkdf2-sha512 |
-f, --format <format> |
Output format (text, json, binary) |
text |
Create a cryptographically random challenge for a ZKP round. Challenges are one-time-use — generate a fresh one for each proof session.
npx zero challenge -o challenge.bin -s 64Small challenge for testing (minimum recommended is 32 bytes):
npx zero challenge -o challenge.bin -s 32Generate multiple challenges for a batch of sessions:
for i in 1 2 3; do
npx zero challenge -o "challenge_${i}.bin" -s 64
done| Flag | Description | Default |
|---|---|---|
-o, --output <file> |
Output challenge file | required |
-s, --size <bytes> |
Challenge size in bytes | 32 |
Generate a non-interactive npx zero-knowledge proof binding an identity to a challenge (Schnorr protocol via Fiat-Shamir transform).
npx zero prove -i alice.zid -c challenge.bin -o proof.binOutput as Base64 (useful for embedding in HTTP headers or JSON payloads):
npx zero prove -i alice.zid -c challenge.bin -o proof.b64 -f base64Prove with verbose logging (prints proof size, algorithm, timing):
npx zero prove -i alice.zid -c challenge.bin -o proof.bin -vProve using a derived identity:
npx zero prove -i alice.auth.zid -c challenge.bin -o proof.bin -v| Flag | Description | Default |
|---|---|---|
-i, --input <file> |
Identity file | required |
-c, --challenge <file> |
Challenge file | required |
-o, --output <file> |
Proof output file | required |
-f, --format <format> |
Output format (binary, base64) |
binary |
-v, --verbose |
Display proof details | — |
Verify that a proof is valid for the given challenge and identity. Returns exit code 0 on success, non-npx zero on failure.
npx zero verify-proof -i proof.bin -c challenge.bin -d alice.zidVerify a Base64-encoded proof:
npx zero verify-proof -i proof.b64 -c challenge.bin -d alice.zidVerify against a derived identity:
npx zero verify-proof -i proof.bin -c challenge.bin -d alice.auth.zidUse in CI pipelines (non-npx zero exit on failure):
npx zero verify-proof -i proof.bin -c challenge.bin -d alice.zid && echo "PASS" || echo "FAIL"| Flag | Description | Default |
|---|---|---|
-i, --input <file> |
Proof file | required |
-c, --challenge <file> |
Challenge file | required |
-d, --id <file> |
Identity file | required |
The Time Capsule seals a proof against an abstract sequence counter — not a wall clock. Time is modelled as set membership (T_i ∈ T), with no timestamps and no epoch dependency. This makes capsules deterministic, audit-friendly, and immune to clock skew.
Mathematical model
| Concept | Formula |
|---|---|
| GCD quantum | gcd(interval₁, interval₂, …) |
| Poisson factor | √(sealSequence² + quantum²) |
| Window membership | sealSeq ≤ openSeq ≤ sealSeq + max(intervals) |
Default intervals [5, 15, 30] yield GCD = 5, windowSize = 30 sequence units.
Seal a proof at the current context sequence:
npx zero timecapsule seal -i proof.bin -c challenge.bin -d alice.zid -o alice.ztcCustom intervals (abstract sequence units, comma-separated):
npx zero timecapsule seal \
-i proof.bin \
-c challenge.bin \
-d alice.zid \
-o alice.ztc \
--intervals "10,20,40"Seal at a specific sequence counter (useful for reproducible tests):
npx zero timecapsule seal \
-i proof.bin \
-c challenge.bin \
-d alice.zid \
-o alice.ztc \
--sequence 42| Flag | Description | Default |
|---|---|---|
-i, --input <file> |
Proof file | required |
-c, --challenge <file> |
Challenge file | required |
-d, --id <file> |
Identity file | required |
-o, --output <file> |
Output .ztc capsule file |
required |
--intervals <list> |
Comma-separated interval values | 5,15,30 |
--sequence <n> |
Override seal sequence counter | context default |
Open and verify a capsule at a given sequence. Performs four checks: window membership, quantum alignment, identity binding, and embedded ZKP proof validity.
npx zero timecapsule open -i alice.ztc -d alice.zid -s 7Open with verbose proof breakdown:
npx zero timecapsule open -i alice.ztc -d alice.zid -s 12 -vUse in scripts (exit code reflects success/failure):
npx zero timecapsule open -i alice.ztc -d alice.zid -s 7 && echo "Capsule opened" || echo "Capsule rejected"| Flag | Description | Default |
|---|---|---|
-i, --input <file> |
Capsule file (.ztc) |
required |
-d, --id <file> |
Identity file (.zid) |
required |
-s, --sequence <n> |
Sequence counter at open time | required |
-v, --verbose |
Print full capsule metadata | — |
Display capsule metadata without verifying:
npx zero timecapsule info -i alice.ztcCheck whether a specific sequence falls inside the window:
npx zero timecapsule info -i alice.ztc --sequence 10Sample output:
Time Capsule: alice.ztc
Version: 1
Seal sequence: 0
Window size: 30
Quantum (GCD): 5
Poisson factor: 5.0000
Intervals: short=5, medium=15, long=30
Sequence 10: IN WINDOW ✓
View library version, supported algorithms, and runtime state:
npx zero infoOutput includes CLI/library version, protocol version, supported algorithms, active identities, and current memory usage.
import { npx zeroContext } from '@obinexusltd/zero';
const ctx = new npx zeroContext();
const id = await ctx.createId({ name: 'Alice', role: 'admin' });
console.log('ID hash:', id.hash.toString('hex'));import { npx zeroContext } from '@obinexusltd/zero';
const ctx = new npx zeroContext();
const id = await ctx.createId({ name: 'Alice' });
const challenge = await ctx.createChallenge(64);
const proof = await ctx.prove(id, challenge);
const valid = await ctx.verifyProof(proof, challenge, id);
console.log('Valid:', valid); // trueimport {
sealTimeCapsule,
openTimeCapsule,
isTimeCapsuleValid,
} from '@obinexusltd/zero';
// Seal — no Date.now(), abstract sequence only
const capsule = await sealTimeCapsule(proof, challenge, id, {
intervals: [
{ name: 'short', value: 5 },
{ name: 'medium', value: 15 },
{ name: 'long', value: 30 },
],
sealSequence: 0,
});
// Window membership check (synchronous)
console.log('seq 7 in window:', isTimeCapsuleValid(capsule, 7)); // true
console.log('seq 99 in window:', isTimeCapsuleValid(capsule, 99)); // false
// Full open (runs all four verification checks)
const result = await openTimeCapsule(capsule, id, 7);
console.log('Opened:', result.success);
console.log('Quantum (GCD):', result.quantum); // 5
console.log('Poisson factor:', result.poissonFactor.toFixed(4)); // 5.0000import { npx zeroParser, FileFormat } from '@obinexusltd/zero';
import { readFileSync } from 'fs';
const parser = new npx zeroParser();
// Read identity-only file
const idData = parser.parseZidFile(readFileSync('alice.zid'));
console.log('ID hash:', idData.id!.hash.toString('hex'));
// Read key-only file (no id present — separation of concern enforced)
const keyData = parser.parseZidFile(readFileSync('alice.zid.key'));
console.log('Key hash:', keyData.key!.hash.toString('hex'));
// Serialise key-only OutputData — id is no longer required
const out = parser.serializeData({ key: keyData.key }, FileFormat.TEXT);
// # npx zero Key File
// hash: <hex>
// timestamp: <ms>
console.log(out);import { npx zeroContext } from '@obinexusltd/zero';
const ctx = new npx zeroContext();
const baseId = await ctx.createId({ name: 'Alice' });
const authId = await ctx.deriveId(baseId, 'authentication');
const signId = await ctx.deriveId(baseId, 'signing');
// Each derived identity has a distinct hash bound to its purpose
console.log('auth hash ≠ sign hash:', authId.hash.toString('hex') !== signId.hash.toString('hex'));| Extension | Contents | Notes |
|---|---|---|
.zid |
Identity only (hash, salt, version) |
Never contains the key |
.zid.key |
Key only (hash, timestamp) |
Never contains the identity |
.ztc |
Time Capsule (proof, challenge, quantum, poissonFactor, …) |
Clock-independent |
.bin |
Raw binary challenge or proof | |
.b64 |
Base64-encoded proof | Embed in JSON / HTTP headers |
alice.zid
# npx zero Identity File
version: 1
hash: a3f2c1...
salt: 9e4b12...
alice.zid.key
# npx zero Key File
hash: 7d8a3f...
timestamp: 1700000000000
- Identities are cryptographically bound and cannot be reverse-engineered
- All comparisons use constant-time functions to prevent timing attacks
.zidand.zid.keyare always separate files — separation of concern enforced at the file-system level- Supports SHA-256, SHA-384, SHA-512, and SHA3 variants
- Secure memory with canary-based overflow detection and multi-pass wipe patterns
- Time Capsule uses no wall-clock time — immune to clock skew, replay attacks, and NTP manipulation
- Ensure Node.js ≥ 16.0.0 (
node --version) - Verify input files are correctly formatted (use
npx zero infoto check library state) - Check file permissions —
.zid.keyshould be600(owner read/write only) - Use
-v, --verboseon any command for detailed error output - If
npx zero verifycannot find the.zidfile, pass it explicitly with-d - If the build fails with
EPERMondist/, runchmod -R u+w dist binbefore rebuilding
Contributions are welcome! Visit the repository, open an issue, or submit a pull request:
- GitHub: https://www.github.com/obinexusltd/
- Repository: [https://www.github.com/obinexusltd/node-npx zero](https://www.github.com/obinexusltd/node-npx zero)
- Issues: [https://www.github.com/obinexusltd/node-npx zero/issues](https://www.github.com/obinexusltd/node-npx zero/issues)
- Discussions: [https://www.github.com/obinexusltd/node-npx zero/discussions](https://www.github.com/obinexusltd/node-npx zero/discussions)
For additional support, file an issue on GitHub or contact:
- GitHub: https://www.github.com/obinexusltd/
- Email: okpalan@protonmail.com