affinidi-crypto 0.2.0

Cryptographic primitives and JWK types for Affinidi TDK
Documentation
//! Cryptographic primitives and JWK types for Affinidi TDK
//!
//! This crate provides:
//! - JWK (JSON Web Key) types per RFC 7517
//! - Key generation for various curves (Ed25519, X25519, P-256, P-384, secp256k1)
//! - Key conversion utilities (e.g., Ed25519 → X25519)
//! - `did:key` encode/decode helpers for raw-bytes APIs (HPKE, ECDH) —
//!   see [`did_key`]
//! - Post-quantum signatures (FIPS 204 ML-DSA, FIPS 205 SLH-DSA) behind
//!   the `post-quantum` feature (off by default; also available
//!   individually as `ml-dsa` / `slh-dsa`)

mod error;
mod jwk;
mod key_type;

/// BLS12-381 G2 `did:key` framing (BBS+ issuer keys). Curve-free, so it needs
/// no feature gate.
pub mod bls12381;

#[cfg(feature = "ed25519")]
pub mod did_key;

#[cfg(feature = "ed25519")]
pub mod ed25519;

#[cfg(feature = "p256")]
pub mod p256;

#[cfg(feature = "k256")]
pub mod secp256k1;

#[cfg(feature = "p384")]
pub mod p384;

#[cfg(feature = "p521")]
pub mod p521;

#[cfg(feature = "jose")]
pub mod jose;

#[cfg(feature = "ml-dsa")]
pub mod ml_dsa;

#[cfg(feature = "slh-dsa")]
pub mod slh_dsa;

pub use error::CryptoError;
pub use jwk::{ECParams, JWK, OctectParams, Params};
pub use key_type::KeyType;

#[cfg(feature = "ed25519")]
pub use ed25519::KeyPair as Ed25519KeyPair;
#[cfg(feature = "p256")]
pub use p256::KeyPair as P256KeyPair;
#[cfg(feature = "p384")]
pub use p384::KeyPair as P384KeyPair;
#[cfg(feature = "k256")]
pub use secp256k1::KeyPair as Secp256k1KeyPair;