Browse Source

Create the API

Ian Goldberg 5 years ago
parent
commit
327a45eb82
3 changed files with 43 additions and 1 deletions
  1. 1 1
      Cargo.toml
  2. 4 0
      src/lib.rs
  3. 38 0
      src/vss.rs

+ 1 - 1
Cargo.toml

@@ -6,4 +6,4 @@ edition = "2018"
 
 [dependencies]
 
-curve25519_dalek = "1"
+curve25519-dalek = "1"

+ 4 - 0
src/lib.rs

@@ -1,3 +1,7 @@
+extern crate curve25519_dalek;
+
+pub mod vss;
+
 #[cfg(test)]
 mod tests {
     #[test]

+ 38 - 0
src/vss.rs

@@ -0,0 +1,38 @@
+use curve25519_dalek::edwards::EdwardsPoint;
+use curve25519_dalek::scalar::Scalar;
+
+pub type Secret = Scalar;
+
+pub struct Share {}
+
+pub struct Commitment {}
+
+/// Create secret shares for a given secret.
+pub fn generate_shares(secret: Secret, numshares: u32, threshold: u32) -> Result<(Commitment, Vec<Share>), &'static str> {
+    unimplemented!("Not yet implemented")
+}
+
+/// Verify that a share is consistent with a commitment.
+pub fn verify_share(share: Share, commitment: Commitment) -> Result<bool, &'static str> {
+    unimplemented!("Not yet implemented")
+}
+
+/// Reconstruct the secret from enough (at least the threshold) already-verified shares.
+pub fn reconstruct_secret(shares: &Vec<Share>) -> Result<Share, &'static str> {
+    unimplemented!("Not yet implemented")
+}
+
+/// Create a proactive update.
+pub fn create_update(numshares: u32, threshold: u32) -> Result<(Commitment, Vec<Share>), &'static str> {
+    unimplemented!("Not yet implemented")
+}
+
+/// Apply the commitment for the update to the master commitment.
+pub fn apply_commitment_update(oldcommitment: &Commitment, update: &Commitment) -> Result<Commitment, &'static str> {
+    unimplemented!("Not yet implemented")
+}
+
+/// Apply the share update to an existing share
+pub fn apply_share_update(oldshare: &Share, update: &Share) -> Result<Share, &'static str> {
+    unimplemented!("Not yet implemented")
+}