Wrap BLS keypair, pubkey and privkey in newtypes

This commit is contained in:
Paul Hauner
2018-12-29 14:31:16 +11:00
parent 39f2171053
commit 4757b35ed2
9 changed files with 125 additions and 34 deletions

View File

@@ -0,0 +1,16 @@
use super::{PublicKey, SecretKey};
#[derive(Debug, Clone, PartialEq)]
pub struct Keypair {
pub sk: SecretKey,
pub pk: PublicKey,
}
impl Keypair {
/// Instantiate a Keypair using SecretKey::random().
pub fn random() -> Self {
let sk = SecretKey::random();
let pk = PublicKey::from_secret_key(&sk);
Keypair { sk, pk }
}
}