commonware_cryptography/ed25519/
mod.rs

1//! Ed25519 implementation of the [crate::Verifier] and [crate::Signer] traits.
2//!
3//! This implementation uses the `ed25519-consensus` crate to adhere to a strict
4//! set of validation rules for Ed25519 signatures (which is necessary for
5//! stability in a consensus context). You can read more about this
6//! [here](https://hdevalence.ca/blog/2020-10-04-its-25519am).
7//!
8//! # Example
9//! ```rust
10//! use commonware_cryptography::{ed25519, PrivateKey, PublicKey, Signature, Verifier as _, Signer as _};
11//! use commonware_math::algebra::Random;
12//! use rand::rngs::OsRng;
13//!
14//! // Generate a new private key
15//! let mut signer = ed25519::PrivateKey::random(&mut OsRng);
16//!
17//! // Create a message to sign
18//! let namespace = &b"demo"[..];
19//! let msg = b"hello, world!";
20//!
21//! // Sign the message
22//! let signature = signer.sign(namespace, msg);
23//!
24//! // Verify the signature
25//! assert!(signer.public_key().verify(namespace, msg, &signature));
26//! ```
27
28pub mod certificate;
29mod scheme;
30
31#[cfg(feature = "std")]
32pub use scheme::Batch;
33pub use scheme::{PrivateKey, PublicKey, Signature};