Skip to main content

Crate aep_core

Crate aep_core 

Source
Expand description

§aep-core

Transport-independent models, validation, identity, assertion, and HTTP-binding primitives for the Agent Enrollment Protocol.

§Install

[dependencies]
aep-core = "0.1"

§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.

§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, 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§

ApiKeyGrantResponse
Authentication
AuthorizationCarrierError
BasicGrantResponse
Bindings
ClaimSupportEvaluation
ClaimValues
ClientAssertionClaims
ClientAssertionSigningKey
ClientAssertionValidationOptions
ClientAssertionVerifyingKey
Commands
ContactAddressPrimary
CoreConfiguration
DecodedJwt
DidWebDocumentUrlOptions
EnrollRequest
EnrollResponse
Extensions
GrantRequest
GrantTypeConfig
HttpConfiguration
HttpRequest
HttpResponse
IdempotencyMetadata
Identity
InspectClaims
InspectDocument
JwtHeader
OAuthBearerGrantResponse
OpenApiAepSecurityScheme
OpenApiPathMatch
OpenApiPathMatchOptions
OpenApiPathMatching
OpenApiReference
ProblemDetails
ProtectedResourceAuthorization
ResolveDidWebPublicKeyOptions
RevokeRequest
RevokeResponse
ServiceIdentity
SignClientAssertionOptions
StatusResponse
TransportError
ValidationError
ValidationIssue
VerifyClientAssertionOptions

Enums§

AgentStatus
AssertionOperation
AuthenticationMethod
AuthorizationCarrier
Binding
BuiltInGrantResponse
ClaimName
Command
CoreError
CredentialScheme
EnrollmentDecisionStatus
ErrorCode
GrantType
IdentityMethod
OpenApiTrailingSlash
ParseError
SigningAlgorithm
StringBoolean

Constants§

AUTHORIZATION_HEADER
AUTHORIZATION_SCHEME
DEFAULT_HTTP_ENDPOINT_BASE
DEFAULT_INSPECT_FRESHNESS
MAX_ASSERTION_LIFETIME
MAX_AUTHENTICATION_METHODS
MEDIA_TYPE
MINIMUM_IDEMPOTENCY_TTL
PROBLEM_MEDIA_TYPE
RECOMMENDED_CLOCK_SKEW
VERSION
WELL_KNOWN_PATH

Traits§

HttpTransport

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_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_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_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_problem_details
validate_protected_resource_authorization
validate_revoke_request
validate_revoke_response
validate_status_response
verify_client_assertion

Type Aliases§

AdditionalMembers
EnrollmentStatus