diff options
author | Teddy Wing | 2018-11-11 20:16:22 +0100 |
---|---|---|
committer | Teddy Wing | 2018-11-11 20:16:22 +0100 |
commit | 394151a2d0a433c6c5b72e23b36c4725ee2ab6bf (patch) | |
tree | ae5f736bb1be17d38e29e37830d0840b40464968 | |
parent | 1670f484d4d4cbe0b48c6ef015ca40f69632cfd6 (diff) | |
download | dome-key-web-394151a2d0a433c6c5b72e23b36c4725ee2ab6bf.tar.bz2 |
aquatic-prime: Make things public
So we can use them from outside the crate.
-rw-r--r-- | license-generator/aquatic-prime/src/lib.rs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/license-generator/aquatic-prime/src/lib.rs b/license-generator/aquatic-prime/src/lib.rs index 72f297e..a7e842a 100644 --- a/license-generator/aquatic-prime/src/lib.rs +++ b/license-generator/aquatic-prime/src/lib.rs @@ -11,7 +11,7 @@ extern crate serde; #[macro_use] extern crate serde_derive; -mod errors { +pub mod errors { use plist; error_chain! { @@ -46,13 +46,20 @@ use serde::ser::Serialize; use errors::*; -struct AquaticPrime<'a> { +pub struct AquaticPrime<'a> { public_key: &'a str, private_key: &'a str, } impl<'a> AquaticPrime<'a> { - fn sign(&self, input_data: HashMap<String, String>) -> Result<[u8; 128]> { + pub fn new(public_key: &'a str, private_key: &'a str) -> Self { + AquaticPrime { + public_key: public_key, + private_key: private_key, + } + } + + pub fn sign(&self, input_data: HashMap<String, String>) -> Result<[u8; 128]> { let mut input_data: Vec<(String, String)> = input_data .into_iter() .collect(); @@ -101,7 +108,7 @@ impl<'a> AquaticPrime<'a> { Ok(signature) } - fn plist<T: Serialize>(&self, input_data: T) -> Result<String> { + pub fn plist<T: Serialize>(&self, input_data: T) -> Result<String> { // Get input as `Plist` let mut xml_for_plist = Vec::with_capacity(600); |