@vorionsys/gate-core
v0.6.0
Published
Minimal deterministic BASIS gate engine — fail-closed pipeline emitting signed, hash-linked decision records (verify with npx @vorionsys/verify)
Readme
@vorionsys/gate-core
The minimal deterministic BASIS gate engine — fail-closed checks in fixed order, every verdict signed into a hash-linked chain of canonical decision records.
Use
import { GateChain, ed25519Signer } from "@vorionsys/gate-core";
const gate = new GateChain({ policy, signer: ed25519Signer(privateKey, "my-kid") });
const record = gate.evaluate(ctx, {
domain: "finance.payments",
capability: "payments.execute",
params: { amountUsd: 250_000 },
});
// record.verdict → { decision: "escalate", reason: "TIER_CAP_EXCEEDED", latencyMs: 0, linksTo: null }
gate.resolveEscalation(record.id, "deny", ctx); // signed HUMAN_DENIED, linksTo record.id
gate.toChainFile(); // → verify with `npx @vorionsys/verify` or verifier.htmlThe pipeline (fixed order, fail-closed by construction)
- credential check → deny
CREDENTIAL_REVOKED/CREDENTIAL_EXPIRED(expired,none, or pastexpiresAt) - domain allowlist → deny
DOMAIN_NOT_ALLOWLISTED - tier cap → escalate
TIER_CAP_EXCEEDED - otherwise → allow
WITHIN_AUTHORITY
No model, no randomness, no I/O in the decision path — decisions land in single-digit milliseconds and the latency is recorded in every verdict. Raw action params never enter a record; only their RFC 8785 hash does.
Human resolutions (resolveEscalation) emit a record that copies the escalated
action verbatim and sets verdict.linksTo — accountability is structural.
One crypto implementation, zero drift
This package imports canonicalBytes and hashRecord from
@vorionsys/verify rather than
implementing its own. That direction is deliberate: the thing that signs cannot
disagree with the thing that verifies.
Where this sits in BASIS
basis-spec (standard)
└── basis-gate (Gate v1 spec + layered reference runtime)
├── contracts (record schema — @vorionsys/contracts/basis)
├── THIS REPO ◄ (minimal embeddable gate core)
└── basis-verify (offline proof-chain verification)Two gate implementations, one lineage, one record format:
@vorionsys/basis-gate-runtime
is the full reference implementation of the Gate v1 spec (composable layers,
postures, block/inline/deferred execution); this package is the minimal core —
the fixed fail-closed pipeline for when you want gate semantics in a few kilobytes.
Converging the runtime's proof output onto the canonical decision-record format is
tracked publicly on basis-gate.
See it run at basis-demo — the demo
imports this exact package; that is the credibility mechanism.
Standard: basis-spec · vorion.org
Status & versioning
v0.1.0 — minimal pipeline matching the demo policy surface (payment caps,
domain allowlist, credential state). npm publish lands once
@vorionsys/[email protected] (vorionsys/contracts PR: feat/basis-decision-record)
is merged and released. Roadmap, not built: pluggable check stages, rate/risk
accumulators, multi-signer.
Development
git clone https://github.com/vorionsys/gate-core && cd gate-core
npm install && npm run build && npm test # one test per reason code + chain round-tripNode ≥ 18. PRs: small, tested, one concern.
License
Apache-2.0 © Vorion LLC
