Skip to main content

dpp_crypto/
lib.rs

1//! `dpp-crypto` — Ed25519 signing, JWS compact serialisation, DID documents,
2//! and access-tier 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/// Infallible OS randomness source, used for Ed25519 key generation and
13/// AES-GCM nonce/salt generation. `SysRng` is fallible (`TryCryptoRng`);
14/// `UnwrapErr` panics on the (practically unreachable) OS-entropy-source
15/// failure instead of threading a `Result` through every call site.
16pub(crate) fn os_rng() -> rand::rand_core::UnwrapErr<rand::rngs::SysRng> {
17    rand::rand_core::UnwrapErr(rand::rngs::SysRng)
18}
19
20// ── Flat re-exports — maintain stable paths for external callers ─────────────
21
22pub use access::{
23    AccessTier, AllowAllIssuers, CredentialBuilder, CredentialRole, CredentialStatus,
24    DppAccessCredential, DppCredentialSubject, PolicyDecision, RevocationOutcome,
25    SectorAccessPolicy, StaticTrustedIssuers, StatusList, TrustedIssuerRegistry,
26    VerificationResult, check_revocation, filter_by_access_tier, verify_credential_claims,
27    verify_credential_claims_with_trust, verify_credential_with_revocation,
28    verify_credential_with_revocation_and_trust,
29};
30pub use identity::{LocalIdentityService, PassportCredential, PassportCredentialSubject};