1#![doc = include_str!("../README.md")]
2
3use digest::Digest;
4
5pub mod group;
6pub use group::{Group, SchnorrGroup, SchnorrP256Group};
7
8pub mod public_key;
9pub use public_key::PublicKey;
10
11pub mod signature;
12pub use signature::Signature;
13
14pub mod signature_scheme;
15pub use signature_scheme::SignatureScheme;
16
17pub mod signing_key;
18pub use signing_key::SigningKey;
19
20pub mod signer;
21pub use signer::Signer;
22
23pub mod verifier;
24pub use verifier::Verifier;
25
26pub mod identification;
27pub use identification::Identification;
28
29pub fn signature_scheme<H: Digest>(
36 p: &str,
37 q: &str,
38 a: &str,
39) -> Option<SignatureScheme<SchnorrGroup, H>> {
40 let group = SchnorrGroup::from_str(p, q, a)?;
41 Some(SignatureScheme {
42 group,
43 _phantom: std::marker::PhantomData,
44 })
45}
46
47pub fn identification_protocol(p: &str, q: &str, a: &str) -> Option<Identification<SchnorrGroup>> {
54 SchnorrGroup::from_str(p, q, a).map(|group| Identification { group })
55}
56
57pub fn signature_scheme_p256<H: Digest>() -> SignatureScheme<SchnorrP256Group, H> {
59 let group = SchnorrP256Group;
60 SignatureScheme {
61 group,
62 _phantom: std::marker::PhantomData,
63 }
64}
65
66pub fn identification_protocol_p256() -> Identification<SchnorrP256Group> {
68 Identification {
69 group: SchnorrP256Group,
70 }
71}