Просмотр исходного кода

Refactor cmz, Include only show and issue enums

onyinyang 10 месяцев назад
Родитель
Сommit
3486451d92
2 измененных файлов с 46 добавлено и 48 удалено
  1. 0 48
      src/cmz.rs
  2. 46 0
      src/credOptions.rs

+ 0 - 48
src/cmz.rs

@@ -1,48 +0,0 @@
-use curve25519_dalek::ristretto::RistrettoPoint;
-use std::collections::HashMap;
-
-// The `CMZ` attribute will automatically add a `MAC: (Point,Point)` field
-// to the struct, create a `Privates` struct for the attributes, and a
-// `Publics` struct for the public keys for the credential.  It will also
-// add issuing and showing methods, which each consume an indication of
-// which attributes to hide, reveal, issue jointly, etc., and produce
-// a `Statement` that attests to the correctness of the issue or the show.
-// Then the Extension layer can use an `AndStatement` combinator to combine
-// that with whatever higher-layer logic is needed.
-
-pub enum IssueType {
-    Select,
-    Joint,
-    Reveal,
-    Hide,
-}
-
-pub enum ShowType {
-    Reveal,
-    Hide,
-}
-
-pub trait CMZ {
-
-    AnnotatedCredential;
-
-    // All fields will be cast as mapping from String -> Scalar
-    // The annotated credential is ouput
-    fn annotate(&self, Credential, IssuerKeys) -> Self;
-    // All fields will be cast as mapping from String -> ShowType 
-    // Outputs AnnotatedShowCredential to be related to AnnotatedIssueCredential by Statement
-    fn show_annotation(&self, HashMap<String, ShowType>) -> AnnotatedShowCredential;
-
-    // All fields will be cast as mapping from String -> IssueType with an output statement
-    // Outputs AnnotatedIssueCredential to be related to AnnotatedShowCredential by Statement
-    fn issue_annotation(&self, HashMap<String, IssueType>) -> AnnotatedIssueCredential;
-
-    // Takes the annotated show and issue type credentials as well as a statement that relates them 
-    // outputs the State, which contains the client generated attributes/scalars required to 
-    // build the new credential
-    fn issue_request(&self, Vec<AnnotatedShowCredential>, Vec<AnnotatedIssueCredential>, Statement) -> (Request, State);
-    
-    //Takes the annotated credential and statement received from the issuer and builds the updated
-    //credential
-    fn handle_response(&self, AnnotatedIssueCredential, Statement) -> Credential;
-}

+ 46 - 0
src/credOptions.rs

@@ -0,0 +1,46 @@
+pub enum IssueType {
+    Select,
+    Joint,
+    Reveal,
+    Hide,
+    Implicit,
+}
+
+pub enum ShowType {
+    Reveal,
+    Hide,
+    Implicit,
+}
+
+/*
+let struct AnnotatedShowCredential {
+    ///a Label for the credential, for use in the ZKP statement
+    Label: Label,
+    /// a CMZ credential, which includes the names of the attributes (as
+    /// `Label`s, which may as well just be strings), the public (for the
+    /// client) or private (for the issuer) keys, the values of the fields (if
+    /// known)
+    Credential: CMZCredential,
+    /// an annotation saying which fields are to be revealed or hidden (for
+    ///  AnnotatedShow) or which fields are to be set to a revealed value, a
+    ///  hidden value, a value set by the issuer, or a value set jointly (for
+    ///  AnnotatedIssue)
+    Shows: HashMap<Label, ShowType>,
+}
+
+
+let struct AnnotatedIssueCredential {
+    ///a Label for the credential, for use in the ZKP statement
+    Label: Label,
+    /// a CMZ credential, which includes the names of the attributes (as
+    /// `Label`s, which may as well just be strings), the public (for the
+    /// client) or private (for the issuer) keys, the values of the fields (if
+    /// known)
+    Credential: CMZCredential,
+    /// an annotation saying which fields are to be revealed or hidden (for
+    ///  AnnotatedShow) or which fields are to be set to a revealed value, a
+    ///  hidden value, a value set by the issuer, or a value set jointly (for
+    ///  AnnotatedIssue)
+    Shows: HashMap<Label, IssueType>,
+}
+*/