Expand description
cratestack-auth integration: the auth Cargo feature (ADR 0006,
“Decisions taken while scoping P0”; cratestack#1005 part B).
ServiceKeySigner: acratestack_auth::ServiceSigningKeyas aCoseSigner, for service-to-service Sign1.DeviceKeyCoseResolver: acratestack_auth::DeviceKeyResolveras aCoseVerifierResolver, for device requests (§8: “indexed additionally by thumbprint prefix”).AuthNonceStore:cratestack_auth’s nonce store (in-memory or Redis) ascratestack_core::NonceStore, for multi-replicanoncereplay protection (§5), keyed by(kid, cti).build_cose_enroll_response/parse_cose_enroll_response: the enrolment challenge code, moved here fromcratestack-auth(a breaking change). It is a separate, older COSE shape and does not go through the envelope’s strict opener (see its module docs).CoseAuthProvider: anAuthProviderthat authenticates a COSE-verified signer through the service key registry and, onceauthenticate_devices(true)opts in, the device key registry (cratestack#1077). Unknown or revoked keys, and device keys while the gate is off, are anonymous; a failing registry that is asked is a500. It isfirst_success(inner).or(CoseSignerProvider), the public chain (cratestack#1243); compose the signer provider yourself to put it in a chain of your own. The service registry must hold service keys only. Read its “Security” section.
The dependency points one way, cratestack-cose -> cratestack-auth
(L2 -> L1, docs/adr/layers.toml). Without the feature this crate
depends on cratestack-core alone, so clients and the wasm/napi builds
stay free of auth’s Redis, reqwest and rustls dependencies.
The error contract is the envelope’s (§10): an adapter never turns a
verification failure into anything but the coarse 401, and a failing
backend (the device-key store, the nonce store) is a 500 whose detail
stays server-side.
Structs§
- Auth
Nonce Store cratestack_auth’s nonce store (in-memory, or Redis across replicas), as thecratestack_core::NonceStorea serverCoseEnveloperecords(kid, cti)in (§5,noncemode).- Cose
Auth Provider - Wraps an
AuthProviderand authenticates a COSE-verified signer through a service key registry and, once switched on, the device key registry. - Cose
Signer Provider - The COSE-verified signer as an
AuthProvider. Compose it with another provider throughcratestack::first_success(...).or(...), or useCoseAuthProvider, which does exactly that. The “Security” sections ofCoseAuthProviderapply unchanged. - Device
KeyCose Resolver - Resolves COSE_Sign1 device requests through the service’s
cratestack_auth::DeviceKeyResolver(ADR 0006 §8), by its requiredlookup_device_verifying_keys_by_thumbprint. - Service
KeySigner - A service’s
cratestack_auth::ServiceSigningKeysigning COSE_Sign1 messages with Ed25519 (-19).
Constants§
- AUTH_
NONCE_ KEY_ ID - The
key_idevery bridged nonce is claimed under.
Functions§
- build_
cose_ enroll_ response - Sign
responseas an enrolment challenge with the key in [CHALLENGE_SIGNING_KEY_ENV]. Fails closed without that key (seechallenge_signing_key). Wascratestack_auth::build_cose_enroll_response. - parse_
cose_ enroll_ response - Verify and decode an enrolment challenge this service signed. The
verifying key is derived from the same secret seed
([
CHALLENGE_SIGNING_KEY_ENV]): the server checks its own challenge on the way back. It does not checkexpires_at; the caller must. Wascratestack_auth::parse_cose_enroll_response.