0015. Hybrid authorization engine

Design document, published from the repository at docs/adr/0015-hybrid-authorization-engine.md.

  • Status: Accepted
  • Date: 2026-11-13

Context

QuantLayer needs one authorization layer that can require, per action, a classical signature, a post-quantum signature, both (hybrid), a credential, or a ZK eligibility proof. Each requirement must be bound to a chain, a contract, an application, a nonce and an expiry, must be versioned, and must be enforceable on-chain where that is feasible.

Decision

  1. One request schema with two canonical encodings.
    • The canonical-JSON signing input, for QuantLayer signers.
    • The EIP-712 struct digest, for EVM wallets and Solidity. The digest is the request's identity everywhere: replay key, credential nonce, ZK proof nonce, decision id.
    • The request commits to key ids, key versions, algorithm identifiers, policy id and version, and mode.
  2. Immutable, versioned verification policies. Five modes, a minimum version per policy id, and active/retired/revoked status. The policy digest is recorded in every decision.
  3. A deterministic engine that never throws.
    • Nine fixed steps, the first failure terminal, and a full trace with stable reason codes.
    • Any exception means deny (fail closed).
    • Nonces and nullifiers are consumed last, atomically per store.
  4. Integration through ports, not copies. IdentityProvider (key registry), SignatureVerifier (classical + PQC, with an optional FIPS context), the quantlayer.credential/2 presentation verifier, the zk-engine ProofVerifier with a backend, RootRegistry, NullifierStore, RevocationRegistry.
  5. Rust adapters in a separate package. @quantlayer-protocol/authorization-pqc, so the engine and the SDK stay browser-safe and need no native toolchain.
  6. On-chain. QuantLayerAuthorizationGate enforces the classical (EIP-712) and ZK modes, and fails closed for post-quantum, hybrid and credential modes, which are enforced off-chain.

Consequences

  • @quantlayer-protocol/authorization now depends on crypto, privacy, zk-engine and evm. The old access-rule API remains, with its request type renamed to AccessRequest.
  • SignatureVerificationInput gained context?. Classical verifiers reject a non-empty context.
  • Post-quantum and hybrid authorizations can't be enforced by a contract until an on-chain ML-DSA verifier exists.