mid-verify 0.1.0

mID JWT verifier — RP-side. Runs the four-step verification (genesis self-sig → roster chain → head VM → JWS signature) entirely locally per ADR 0005 Decision 1. Zero runtime calls to MATA infrastructure. Phase 0 of the mID Mission.
Documentation
mid-verify-0.1.0 has been yanked.

mid-verify — RP-side mID JWT verifier

Phase 0 of the mID Mission. Implements the four-step verification from ADR 0005 Decision 1: given a JWS compact-form mID token and a [VerifyConfig], run all cryptographic checks entirely locally and return a [VerifiedMid] that captures the user's DID, current roster version, and disclosed claims.

The four-step verification

  1. Genesis self-signature. Decode the genesis public key from the DID's base58 suffix; verify the genesis roster envelope's self_signed_by_genesis_key against it.
  2. Roster chain. Each chain entry signed by a VM present in the prior entry's roster; versions strictly monotonic.
  3. Current VM in head. The device that signed this JWT is in the head (current) roster.
  4. JWS outer signature. Standard ES256 verification against the embedded verification method's public key.

Zero MATA runtime calls

Per ADR 0005, RPs make zero HTTP requests to MATA infrastructure during verification. Every cryptographic input the verifier needs travels inside the JWT itself; everything else is RP-local configuration ([VerifyConfig]) or RP-local state (the optional rollback check the RP runs against its own database AFTER calling [verify_mid_response]).

Usage

use mid_verify::{verify_mid_response, VerifyConfig};

let config = VerifyConfig {
    expected_audience: "https://acme.com".to_string(),
    expected_nonce: my_session_nonce.clone(),
    max_iat_skew_secs: 120,
    now_unix_secs: current_wall_clock_secs(),
};

let verified = verify_mid_response(&incoming_jwt, &config)?;

// Optional rollback check — look up the highest version this RP has
// seen for this DID in its own database, then:
let last_seen = db.lookup_last_seen_version(&verified.did).await?;
verified.check_rollback(last_seen)?;

// Persist user, issue session...