From 394151a2d0a433c6c5b72e23b36c4725ee2ab6bf Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 11 Nov 2018 20:16:22 +0100 Subject: aquatic-prime: Make things public So we can use them from outside the crate. --- license-generator/aquatic-prime/src/lib.rs | 15 +++++++++++---- 1 file 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) -> 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) -> 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(&self, input_data: T) -> Result { + pub fn plist(&self, input_data: T) -> Result { // Get input as `Plist` let mut xml_for_plist = Vec::with_capacity(600); -- cgit v1.2.3