Skip to main content

auths_keri/
lib.rs

1// crate-level allow during curve-agnostic refactor. Removed or narrowed in fn-114.40 after Phase 4 sweeps.
2#![allow(clippy::disallowed_methods)]
3#![deny(
4    clippy::print_stdout,
5    clippy::print_stderr,
6    clippy::exit,
7    clippy::dbg_macro
8)]
9#![deny(rustdoc::broken_intra_doc_links)]
10#![warn(clippy::too_many_lines, clippy::cognitive_complexity)]
11#![warn(missing_docs)]
12
13//! KERI protocol types, SAID computation, and CESR translation for Auths.
14//!
15//! The default feature set provides pure KERI types and SAID utilities with
16//! no heavy dependencies — suitable for WASM and FFI embedding.
17//!
18//! Enable the `cesr` feature for bidirectional conversion between Auths'
19//! internal JSON event representation and spec-compliant CESR streams
20//! (Trust over IP KERI v0.9).
21//!
22//! Usage (default, no CESR):
23//! ```ignore
24//! use auths_keri::{Prefix, Said, compute_said};
25//!
26//! let said = compute_said(&event_json)?;
27//! ```
28//!
29//! Usage (with CESR feature):
30//! ```ignore
31//! use auths_keri::{CesrV1Codec, export_kel_as_cesr};
32//!
33//! let codec = CesrV1Codec::new();
34//! let cesr_stream = export_kel_as_cesr(&codec, &events)?;
35//! ```
36
37/// ACDC (Authentic Chained Data Container) credential type, SAID-ification, and
38/// the pinned v1 capability schema.
39pub mod acdc;
40/// Validated capability identifiers — the atomic unit of authorization in Auths.
41pub mod capability;
42mod crypto;
43/// `did:webs` DID-document projection of a resolved KERI key-state.
44pub mod did_webs;
45mod error;
46mod events;
47/// IPEX — the Issuance & Presentation EXchange grant/admit `exn` handshake for
48/// handing over an ACDC credential between KERI controllers.
49pub mod ipex;
50pub mod kel_io;
51mod keys;
52/// Key-State Notice (KSN) — signed snapshot of current key-state for thin clients.
53pub mod ksn;
54/// Routed KERI message types (qry, rpy, pro, bar, xip, exn).
55pub mod messages;
56/// Out-Of-Band Introduction (OOBI) — KERI discovery: resolve/serve AID endpoints.
57pub mod oobi;
58/// QUIC/HTTP3 transport for the KEL-rooted TLS composition — the same leaf +
59/// RFC 9266 exporter channel binding, carried over QUIC's TLS 1.3 handshake.
60#[cfg(feature = "quic")]
61pub mod quic_transport;
62mod said;
63mod state;
64/// Backerless TEL (Transaction Event Log) credential-status events: `vcp`/`iss`/`rev`.
65pub mod tel;
66/// KEL-rooted X.509 leaf certificates — composing a KERI identity with TLS
67/// (did:keri SAN + KEL key-state binding extension, verified by replay).
68pub mod tls_cert;
69mod types;
70mod validate;
71/// Witness protocol types: receipts, providers, and error reporting for split-view defense.
72pub mod witness;
73
74/// CESR-correct primitive encoding (verkeys, digests, SAIDs) via `cesride` — the
75/// byte-interoperable wire format that replaces the legacy naive base64 scheme.
76mod cesr_encode;
77
78#[cfg(feature = "cesr")]
79mod codec;
80#[cfg(feature = "cesr")]
81mod event;
82#[cfg(feature = "cesr")]
83mod roundtrip;
84#[cfg(feature = "cesr")]
85mod stream;
86#[cfg(feature = "cesr")]
87mod version;
88
89pub use acdc::{
90    ACDC_KERIPY_REVISION, ACDC_VERSION_PREFIX, Acdc, AcdcError, Attributes, CAPABILITY_SCHEMA,
91    compute_capability_schema_said, compute_schema_said,
92};
93pub use capability::{
94    Capability, CapabilityError, MANAGE_MEMBERS, ROTATE_KEYS, SIGN_COMMIT, SIGN_RELEASE, UsageCap,
95};
96pub use crypto::{compute_next_commitment, verify_commitment};
97pub use did_webs::{DidWebsDocument, PublicKeyJwk, VerificationMethod};
98pub use error::{KeriTranslationError, TelError};
99pub use events::{
100    AgentScope, DipEvent, DipEventInit, DrtEvent, DrtEventInit, Event, IcpEvent, IcpEventInit,
101    IndexedSignature, IxnEvent, KERI_VERSION_PREFIX, KeriSequence, RotEvent, RotEventInit, Seal,
102    SignedEvent, SourceSeal, WireSignedDip, WireSignedRot, decode_agent_scope, decode_signed_dip,
103    decode_signed_rot, encode_agent_scope, encode_signed_dip, encode_signed_rot,
104    pair_kel_attachments, parse_attachment, parse_delegated_attachment, parse_source_seal_couples,
105    serialize_attachment, serialize_source_seal_couples,
106};
107pub use ipex::{IpexAdmit, IpexError, IpexGrant};
108pub use keys::{KeriDecodeError, KeriPublicKey};
109pub use ksn::{
110    KERI_KEY_STATE_VERSION, KSN_TYPE, KSN_VERSION, KeyStateNotice, KeyStateRecord, KsnError,
111    LatestEstablishmentEvent, SignedKsn,
112};
113pub use oobi::{
114    EndRoleReply, LocSchemeReply, Oobi, OobiEndpoint, OobiError, OobiResolution, Role,
115    ingest_oobi_stream,
116};
117#[cfg(feature = "quic")]
118pub use quic_transport::{
119    QUIC_EXPORTER_CONTEXT, QUIC_EXPORTER_LABEL, QUIC_EXPORTER_LEN, QuicLoopbackOutcome,
120    QuicTransportError, quic_channel_binding, quic_client_config, quic_loopback_compose,
121    quic_server_config,
122};
123pub use said::{
124    Protocol, SAID_PLACEHOLDER, compute_said, compute_said_with_protocol, compute_section_said,
125    verify_said,
126};
127pub use state::{AnchorStatus, KeyState};
128pub use tel::{
129    Iss, Rev, TEL_KERIPY_REVISION, TRAIT_NO_BACKERS, TelAnchorSeal, TelEvent, TelState, Vcp,
130    encode_nonce as encode_tel_nonce, to_wire_bytes as tel_to_wire_bytes, validate_tel,
131};
132pub use tls_cert::{
133    AUTHS_KERI_BINDING_OID, AuthsKeriBinding, DID_KERI_SCHEME, TlsCertError, TlsKeyAuthorization,
134    TlsKeyAuthorizer,
135};
136#[cfg(feature = "tls-cert")]
137pub use tls_cert::{
138    IssuedCert, extract_aid_from_san, extract_binding, extract_did_keri_san, extract_spki_der,
139    issue_authorized_kel_rooted_cert, issue_authorized_kel_rooted_cert_with_key,
140    issue_kel_rooted_cert, issue_kel_rooted_cert_with_key, verify_authorized_against_key_state,
141    verify_binds_to_key_state,
142};
143pub use types::{
144    CesrKey, ConfigTrait, Fraction, FractionError, KeriTypeError, Prefix, Said, Threshold,
145    VersionString,
146};
147pub use validate::{
148    DelegatorKelLookup, KelPolicy, KelSealIndex, TrustedKel, ValidationError, WitnessedReplay,
149    compute_event_said, finalize_dip_event, finalize_drt_event, finalize_icp_event,
150    finalize_ixn_event, finalize_rot_event, find_seal_in_kel, parse_kel_json,
151    serialize_for_signing, state_after_event, validate_delegation, validate_for_append,
152    validate_signed_event, validate_signed_kel, verify_event_crypto, verify_event_said,
153};
154
155#[cfg(feature = "cesr")]
156pub use codec::{CesrCodec, CesrV1Codec, DecodedPrimitive, DigestType, KeyType, SigType};
157#[cfg(feature = "cesr")]
158pub use event::{SerializedEvent, decode_cesr_key, serialize_for_cesr};
159#[cfg(feature = "cesr")]
160pub use roundtrip::{export_kel_as_cesr, import_cesr_to_events};
161#[cfg(feature = "cesr")]
162pub use stream::{AttachmentGroup, CesrStream, assemble_cesr_stream};
163#[cfg(feature = "cesr")]
164pub use version::compute_version_string;