Expand description
§aep-core
Transport-independent models, validation, identity, assertion, and HTTP-binding primitives for the Agent Enrollment Protocol.
§Install
[dependencies]
aep-core = "0.3"§Parse protocol documents
Parsing applies AEP’s bounded native validation and preserves well-formed additive members and advertisements:
use aep_core::{Command, command_path_from_inspect, parse_inspect_document};
let document = parse_inspect_document(br#"{
"aep_version": "1.0",
"bindings": {"supported": ["http"]},
"commands": {"supported": ["inspect", "enroll"]},
"core": {"signing_algorithms": ["EdDSA", "ES256"]},
"http": {},
"identity": {"methods": ["did:web"]},
"service": {"did": "did:web:service.example"}
}"#)?;
assert_eq!(
command_path_from_inspect(&document, &Command::Enroll)?,
"/aep/enroll"
);The crate provides equivalent parse and validation functions for claims, enrollment, status, grant, revoke, Problem Details, idempotency metadata, credential responses, client assertions, and OpenAPI AEP security metadata.
InspectDocument.service_documents, EnrollRequest.acknowledged_document_ids, and
ProblemDetails.required_document_ids model the Service Documents extension. Native validation
enforces the seven-document and 32-character ID bounds, unique IDs and representation media types,
and the required HTML representation. Unknown document types and additive members are accepted;
unknown enrollment requirements are rejected.
parse_portable_service_document(bytes, expected_id) validates the full portable content, including
its exact ID, supported blocks, Unicode text limits, total block count, nesting depth, and one-MiB
bound. Unsupported blocks reject the representation rather than silently removing content.
The Core crate does not retrieve documents or acknowledge them; retrieval belongs to aep-agent.
§Assertions and identity
sign_client_assertion and verify_client_assertion support the required EdDSA and ES256
algorithms. decode_jwt_unverified exposes the JOSE header before verification so a Service can
select the advertised algorithm and resolve the kid. did_web_document_url and
resolve_did_web_public_key implement the did:web resolution rules, including the HTTPS default,
the one-mebibyte document limit, matching document identity, exact verification-method selection,
and redirect rejection.
Keys use AEP-owned types rather than exposing the underlying JSON Web Token library. Ed25519 seeds, PKCS #8 PEM private keys, raw Ed25519 public keys, ES256 private scalars, PKCS #8 PEM private keys, and SEC1 ES256 public keys are supported:
use aep_core::{ClientAssertionSigningKey, SigningAlgorithm};
let key = ClientAssertionSigningKey::ed25519_from_seed([7; 32]);
assert_eq!(key.algorithm(), SigningAlgorithm::EdDsa);
let public_key = key.verifying_key();Both algorithms use pure-Rust cryptographic implementations. A signing key selects the JOSE algorithm, which prevents an algorithm option from disagreeing with the supplied key.
HTTP access remains injectable through HttpTransport; the Core crate does not select an async
runtime or networking client. The Agent, Service, and Platform crates provide the role-level
composition.
§HTTP and OpenAPI
The Core helpers normalize command paths, parse and render protected-resource authorization, resolve OpenAPI references, and deterministically select the most specific matching OpenAPI path template. Plaintext HTTP is rejected except when a caller explicitly enables the loopback-only development option.
See the workspace guide and the AEP specifications.
Structs§
- ApiKey
Grant Response - Authentication
- Authorization
Carrier Error - Basic
Grant Response - Bindings
- Claim
Support Evaluation - Claim
Values - Client
Assertion Claims - Client
Assertion Signing Key - Client
Assertion Validation Options - Client
Assertion Verifying Key - Commands
- Contact
Address Primary - Core
Configuration - Decoded
Jwt - DidWeb
Document UrlOptions - Document
Representation - Enroll
Request - Enroll
Response - Extensions
- Grant
Request - Grant
Type Config - Http
Configuration - Http
Request - Http
Response - Idempotency
Metadata - Identity
- Inspect
Claims - Inspect
Document - JwtHeader
- OAuth
Bearer Grant Response - Open
ApiAep Security Scheme - Open
ApiPath Match - Open
ApiPath Match Options - Open
ApiPath Matching - Open
ApiReference - Open
ApiSecurity Resolution - The resolved security for one operation.
- Portable
Service Document - Problem
Details - Protected
Resource Authorization - Resolve
DidWeb Public KeyOptions - Revoke
Request - Revoke
Response - Service
Document - Service
Identity - Sign
Client Assertion Options - Status
Response - Transport
Error - Validation
Error - Validation
Issue - Verify
Client Assertion Options
Enums§
- Agent
Status - Assertion
Operation - Authentication
Method - Authorization
Carrier - Binding
- Built
InGrant Response - Claim
Name - Command
- Core
Error - Credential
Scheme - Document
Enrollment - Enrollment
Decision Status - Error
Code - Grant
Type - Identity
Method - Open
ApiSecurity Disposition - How an Agent must treat the security an operation resolves to.
- Open
ApiTrailing Slash - Parse
Error - Portable
Document Block - Signing
Algorithm - String
Boolean
Constants§
- AUTHORIZATION_
HEADER - AUTHORIZATION_
SCHEME - DEFAULT_
HTTP_ ENDPOINT_ BASE - DEFAULT_
INSPECT_ FRESHNESS - MAX_
ASSERTION_ LIFETIME - MAX_
AUTHENTICATION_ METHODS - MAX_
SERVICE_ DOCUMENT_ BYTES - MEDIA_
TYPE - MINIMUM_
IDEMPOTENCY_ TTL - PROBLEM_
MEDIA_ TYPE - RECOMMENDED_
CLOCK_ SKEW - SERVICE_
DOCUMENTS_ EXTENSION - SERVICE_
DOCUMENT_ TYPES - VERSION
- WELL_
KNOWN_ PATH
Traits§
Functions§
- command_
path - command_
path_ from_ inspect - decode_
jwt_ unverified - did_
web_ document_ url - did_
web_ document_ url_ with_ options - evaluate_
claim_ support - is_
http_ field_ name - is_
loopback_ host - Reports whether a URL host is one of the three loopback names that admit plaintext HTTP.
- is_
version_ compatible - match_
openapi_ path - missing_
required_ claim_ names - new_
problem_ details - normalize_
endpoint_ base - parse_
api_ key_ grant_ response - parse_
basic_ grant_ response - parse_
built_ in_ grant_ response - parse_
claim_ values - parse_
client_ assertion_ claims - parse_
client_ assertion_ claims_ with_ options - parse_
enroll_ request - parse_
enroll_ response - parse_
grant_ request - parse_
idempotency_ metadata - parse_
inspect_ document - parse_
oauth_ bearer_ grant_ response - parse_
openapi_ aep_ security_ scheme - parse_
portable_ service_ document - parse_
problem_ details - parse_
protected_ resource_ authorization - parse_
revoke_ request - parse_
revoke_ response - parse_
status_ response - protected_
resource_ authorization_ header - registered_
claims - render_
protected_ resource_ authorization - resolve_
did_ web_ public_ key - resolve_
openapi_ security - Resolves the effective security for one operation (CORE-OAS-011/013/014/015).
- resolve_
openapi_ url - sign_
client_ assertion - validate_
api_ key_ grant_ response - validate_
basic_ grant_ response - validate_
built_ in_ grant_ response - validate_
claim_ values - validate_
client_ assertion_ claims - validate_
client_ assertion_ claims_ with_ options - validate_
enroll_ request - validate_
enroll_ response - validate_
grant_ request - validate_
idempotency_ metadata - validate_
inspect_ document - validate_
oauth_ bearer_ grant_ response - validate_
openapi_ aep_ security_ scheme - validate_
portable_ service_ document - validate_
problem_ details - validate_
protected_ resource_ authorization - validate_
revoke_ request - validate_
revoke_ response - validate_
service_ document - validate_
status_ response - verify_
client_ assertion