pub async fn admit_key_against_did<R: DidDocResolve>(
resolver: &R,
origin: &str,
application_signer: VerifiedApplicationSigner,
trust_surface: AdmissionTrustSurface,
did: &str,
federation_jwks: Option<&Value>,
at9p: Option<At9pAdmission<'_>>,
) -> Result<AdmittedIdentity>Expand description
Stage 2 core, factored out so it is independently unit-testable: bind the verified application signer key to its DID’s published key material, and admit iff it matches.
The assurance floor is enforced before DID dispatch: native/SPINE surfaces
require verified PQ-hybrid proof; classical proof is accepted only when the
caller explicitly names AdmissionTrustSurface::ThirdPartyInterop.
Three DID-method paths (chosen by the DID string):
did:key(self-certifying, #281) — Tiles-style Ed25519 device/account identity. The key is the identity:did:key:z6Mk…is exactlymultibase(0xed01 ‖ pubkey), so there is no document to fetch and no resolver call. We decode the key directly (did_key_to_ed25519) and admit iffapplication_signer_keyequals it. Reach is an independent resolver output.did:at9p(self-certifying hybrid-PQC, #894/D2) — the capsule is the hybrid key commitment: GATE-verify the peer-presented bytes (canon→hash→sig, #884) via the suppliedAt9pCapsuleResolver, admit iff the verified application signer equals the capsule’s Ed25519 subject key, and bind the verifieded25519 → ml_dsa_65pair into theKeyedPqTrustStore. This is the classical→hybrid trust upgrade, populated from content-verified material (no config trust). No resolver/fetch: the capsule is self-certifying. Requiresat9p = Some(_); otherwise fail-closed.did:web(resolver fetch, #279/#137) — resolve the peer DID document and admit iffapplication_signer_keymatches one of its Ed25519verificationMethodkeys, falling back to a supplied federation JWKS.
Fail-closed: a parse error, a resolution error, an empty/absent VM set with no
JWKS match, or a key mismatch all return Err.