affinidi-crypto 0.1.8

Cryptographic primitives and JWK types for Affinidi TDK
Documentation

affinidi-crypto

Crates.io Documentation Rust License

Cryptographic primitives and JWK types for the Affinidi Trust Development Kit. Provides key generation, encoding, and conversion utilities across multiple elliptic curve families.

Supported Algorithms

Algorithm Feature Flag Curve / Family
Ed25519 / X25519 ed25519 Curve25519
P-256 (secp256r1) p256 NIST P-256
P-384 p384 NIST P-384
secp256k1 k256 secp256k1
ML-DSA-44 / 65 / 87 ml-dsa FIPS 204 (post-quantum)
SLH-DSA-SHA2-128s slh-dsa FIPS 205 (post-quantum)

The four classical curves are enabled by default. Post-quantum signatures are off by default — enable post-quantum for both, or ml-dsa / slh-dsa individually.

did:key Raw-Bytes Helpers

Under the ed25519 feature, the did_key module exposes a raw-bytes API for apps doing HPKE, sealed transfer, or other non-DIDComm key agreement: encode / decode between a did:key:z6Mk… identifier and a [u8; 32] Ed25519 public key, and derive an X25519 public key without round-tripping through a multikey string. The multikey-string helpers in ed25519.rs remain for multikey-native callers.

Installation

[dependencies]
affinidi-crypto = "0.1"

Or with only specific curves:

[dependencies]
affinidi-crypto = { version = "0.1", default-features = false, features = ["ed25519", "p256"] }

WASM Support

This crate supports wasm32 targets with the getrandom/js feature automatically enabled.

Related Crates

License

Apache-2.0