1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//! EdDSA (Edwards-curve Digital Signature Algorithm) implementations
//!
//! This module provides an Ed25519 adapter backed by `ed25519-dalek`, with
//! strict verification and additional canonical/subgroup input validation.
//! This description is not an independent audit or production-safety claim.
//!
//! # Security Features
//!
//! - **Immutable secret keys**: Prevents accidental key corruption
//! - **Automatic zeroization**: Clears sensitive data from memory
//! - **Secure API design**: Minimal surface area, maximum safety
//! - **Maintained arithmetic backend**: Secret scalar operations are delegated
//! to `ed25519-dalek`/`curve25519-dalek`
//! - **Type safety**: Strong typing prevents key confusion
//!
//! # Features
//!
//! - RFC 8032 Ed25519 signing and strict verification
//! - Deterministic signature generation
//! - Secure key generation and handling
//! - Comprehensive input validation
//! - Key derivation and persistence support
//!
//! # Security Guidelines
//!
//! 1. **Always use a CSPRNG**: Use `rand::rngs::OsRng` for key generation
//! 2. **Protect seeds**: Encrypt before storage, decrypt only when needed
//! 3. **Verify public keys**: Confirm authenticity through secure channels
//! 4. **Clear sensitive data**: Automatic for secret keys, manual for seeds
//!
//! # Example
//!
//! ```
//! use dcrypt_sign::eddsa::{Ed25519, Ed25519SecretKey};
//! use dcrypt_api::Signature;
//! use rand::rngs::OsRng;
//!
//! # fn main() -> dcrypt_api::Result<()> {
//! let mut rng = OsRng;
//!
//! // Generate a new keypair
//! let (public_key, secret_key) = Ed25519::keypair(&mut rng)?;
//!
//! // Sign a message
//! let message = b"Hello, Ed25519!";
//! let signature = Ed25519::sign(message, &secret_key)?;
//!
//! // Verify the signature
//! assert!(Ed25519::verify(message, &signature, &public_key).is_ok());
//!
//! // Save the secret key seed (encrypt in production!)
//! let seed = secret_key.seed();
//!
//! // Later, reconstruct the secret key
//! let reconstructed_secret = Ed25519SecretKey::from_seed(seed)?;
//! let reconstructed_public = reconstructed_secret.public_key()?;
//!
//! // The reconstructed keys work identically
//! assert_eq!(public_key.0, reconstructed_public.0);
//! # Ok(())
//! # }
//! ```
// Re-export Ed25519 types
pub use ;