Make traits public to allow PCC to use formatting traits

This commit is contained in:
Mark Sinclair
2021-11-16 16:01:09 +00:00
parent 2809c23722
commit 33c162f3b4
3 changed files with 10 additions and 2 deletions
+1 -1
View File
@@ -48,7 +48,7 @@ pub mod proofs;
pub mod scheme;
#[cfg(test)]
mod tests;
mod traits;
pub mod traits;
mod utils;
pub type Attribute = Scalar;
+1 -1
View File
@@ -29,7 +29,7 @@ use crate::error::{CoconutError, Result};
use crate::scheme::setup::Parameters;
use crate::scheme::VerificationKey;
use crate::utils::{hash_g1, try_deserialize_scalar, try_deserialize_scalar_vec};
use crate::{elgamal, Attribute, Bytable, ElGamalKeyPair};
use crate::{elgamal, Attribute, ElGamalKeyPair};
// as per the reference python implementation
type ChallengeDigest = Sha256;
@@ -73,6 +73,14 @@ impl ThetaCovid {
bytes
}
pub fn to_bytes_tuple(&self) -> ([u8; 96], [u8; 96], Vec<u8>) {
let blinded_message_bytes = self.blinded_message.to_affine().to_compressed();
let credential_bytes = self.credential.to_bytes();
let proof_bytes = self.pi_v.to_bytes();
(blinded_message_bytes, credential_bytes, proof_bytes)
}
pub fn from_bytes(bytes: &[u8]) -> Result<ThetaCovid> {
if bytes.len() < 192 {
return Err(