Skip to main content

dpp_crypto/
lib.rs

1//! `dpp-crypto` — Ed25519 signing, JWS compact serialisation, DID documents,
2//! and audience-scoped Verifiable Credentials.
3//!
4//! All modules are pure (no I/O, no network). The crate compiles to `std` for
5//! the node and to `wasm32` (where conditional) for plugin guests.
6
7pub mod access;
8pub mod identity;
9pub mod jws;
10pub mod keystore;
11
12#[cfg(test)]
13mod test_support;
14
15/// Infallible OS randomness source, used for Ed25519 key generation and
16/// AES-GCM nonce/salt generation. `SysRng` is fallible (`TryCryptoRng`);
17/// `UnwrapErr` panics on the (practically unreachable) OS-entropy-source
18/// failure instead of threading a `Result` through every call site.
19pub(crate) fn os_rng() -> rand::rand_core::UnwrapErr<rand::rngs::SysRng> {
20    rand::rand_core::UnwrapErr(rand::rngs::SysRng)
21}
22
23// ── Flat re-exports — maintain stable paths for external callers ─────────────
24
25pub use access::{
26    AllowAllIssuers, Audience, CredentialBuilder, CredentialRole, CredentialStatus,
27    DppAccessCredential, DppCredentialSubject, PolicyDecision, RevocationOutcome,
28    SectorAccessPolicy, StaticTrustedIssuers, StatusList, TrustedIssuerRegistry,
29    VerificationResult, check_revocation, filter_by_audience, verify_credential_claims,
30    verify_credential_claims_with_trust, verify_credential_with_revocation,
31    verify_credential_with_revocation_and_trust,
32};
33pub use identity::{LocalIdentityService, PassportCredential, PassportCredentialSubject};