aauth-protocol
AAuth (draft-hardt-oauth-aauth-protocol-11) for Rust. AAuth is how an agent proves who it is, and what a person has allowed it to do, on every request it makes.
Each request carries an RFC 9421 HTTP Message Signature under the AAuth profile. The signer's key is named in Signature-Key, usually as a token that binds it: an agent token from the agent's provider, a person token, or an auth token from the person's Person Server.
This crate is the part of the protocol every role shares.
| Module | What it does |
|---|---|
keys, jwk, jwt |
Ed25519 signing keys, public JWKs and RFC 7638 thumbprints, compact JWS |
httpsig |
Sign a request, or verify one and learn which key signed it |
token |
Mint tokens, or verify one against its issuer's keys and the request's signer |
discovery |
Find an issuer's keys through its metadata document, over an HTTP client you choose |
resource |
The resource's side: authenticate a request, mint resource tokens, challenge |
requirement |
The AAuth-Requirement header |
mission, budget |
What a person approved, and what it may spend |
client |
The agent's Person Server client, and an SSRF-guarded HTTP client (client feature, on by default) |
The Person Server itself is the aauth-person-server crate.
Sign as an agent
use ;
let headers = sign_jwt?;
// content-digest, content-type, signature-key, signature-input, signature
Verify as a resource
use authenticate;
use TokenKind;
let authenticated = authenticate.await?;
authenticated.token.scope;
authenticate checks the signature first, then that the token's cnf.jwk is the key that signed. It checks the token against its issuer's published keys last. Nothing a token claims is believed until that last check passes.
Only the token's issuer is ever looked up, and only when it is a server identifier. A Signature-Key: sig=jwks_uri from an unauthenticated caller is refused, not fetched. Use ReqwestFetch::guarded for discovery: it calls https only, refuses IP literals and localhost, and its resolver refuses private addresses.
Talk to a Person Server as an agent
use ;
let client = new;
let metadata = client.metadata.await?;
let agent = Agent ;
let sam = Person ;
match client.propose_mission.await?
Interop
The tests pin this crate's signatures to @hellocoop/httpsig, by the spec's author, with fixed vectors in tests/vectors/hellocoop.json: requests it signed verify here, and what this crate signs is exactly what it verified.
Status
The crate implements protocol draft -11.
- Algorithms: signing is Ed25519; verification accepts Ed25519 and ES256.
Signature-Keyschemes:jwt,jwks_uriandhwkare supported;jkt-jwtandx509are not.- Revocation: not checked.
@query: follows RFC 9421 and includes the leading?.@hellocoop/httpsig2.6 leaves the?out, so the two disagree on any signed request that has a query string.
Until 1.0 the API may change between minor versions.
License
Apache-2.0