frost/frost-p256
Conrado Gouvea 6df6e32221
use Error everywhere and add enums as needed (#172)
* use Error everywhere and add enums as needed

* Apply suggestions from code review

Co-authored-by: Deirdre Connolly <durumcrustulum@gmail.com>

* Update frost-core/src/error.rs

Co-authored-by: Deirdre Connolly <durumcrustulum@gmail.com>

Co-authored-by: Deirdre Connolly <durumcrustulum@gmail.com>
2022-10-28 20:01:03 +00:00
..
src use Error everywhere and add enums as needed (#172) 2022-10-28 20:01:03 +00:00
tests Fix batching for P-256 (#154) 2022-10-27 04:34:57 +00:00
Cargo.toml add Ed25519 ciphersuite (#164) 2022-10-27 18:33:32 +00:00
README.md Add P-256 support (#77) 2022-07-01 14:16:22 +00:00

README.md

An implementation of Schnorr signatures on the P-256 curve for both single and threshold numbers of signers (FROST).

Examples

Creating a Signature with a single signer, serializing and deserializing it, and verifying the signature:

use rand::thread_rng;
use frost_p256::*;

let msg = b"Hello!";

// Generate a secret key and sign the message
let sk = SigningKey::new(thread_rng());
let sig = sk.sign(thread_rng(), msg);

// Types can be converted to raw byte arrays using `from_bytes`/`to_bytes`
let sig_bytes = sig.to_bytes();
let pk_bytes = VerifyingKey::from(&sk).to_bytes();

// Deserialize and verify the signature.
let sig = Signature::from_bytes(sig_bytes)?;

assert!(
    VerifyingKey::from_bytes(pk_bytes)
        .and_then(|pk| pk.verify(msg, &sig))
        .is_ok()
);
# Ok::<(), Error>(())