@@ -17,7 +17,7 @@ use crate::op;
1717
1818pub fn zu_kyc_sign_pod_builders (
1919 params : & Params ,
20- sanction_set : & Set ,
20+ sanction_set : & Value ,
2121) -> ( SignedPodBuilder , SignedPodBuilder , SignedPodBuilder ) {
2222 let mut gov_id = SignedPodBuilder :: new ( params) ;
2323 gov_id. insert ( "idNumber" , "4242424242" ) ;
@@ -29,7 +29,7 @@ pub fn zu_kyc_sign_pod_builders(
2929 pay_stub. insert ( "startDate" , 1706367566 ) ;
3030
3131 let mut sanction_list = SignedPodBuilder :: new ( params) ;
32- sanction_list. insert ( "sanctionList" , Value :: Set ( sanction_set. clone ( ) ) ) ;
32+ sanction_list. insert ( "sanctionList" , sanction_set. clone ( ) ) ;
3333
3434 ( gov_id, pay_stub, sanction_list)
3535}
@@ -39,8 +39,11 @@ pub fn zu_kyc_pod_builder(
3939 gov_id : & SignedPod ,
4040 pay_stub : & SignedPod ,
4141 sanction_list : & SignedPod ,
42- sanction_set : & Set ,
4342) -> Result < MainPodBuilder > {
43+ let sanction_set = match sanction_list. kvs . get ( "sanctionList" ) {
44+ Some ( Value :: Set ( s) ) => Ok ( s) ,
45+ _ => Err ( anyhow ! ( "Missing sanction list!" ) ) ,
46+ } ?;
4447 let now_minus_18y: i64 = 1169909388 ;
4548 let now_minus_1y: i64 = 1706367566 ;
4649
@@ -225,7 +228,7 @@ pub fn great_boy_pod_builder(
225228 params : & Params ,
226229 good_boy_pods : [ & SignedPod ; 4 ] ,
227230 friend_pods : [ & SignedPod ; 2 ] ,
228- good_boy_issuer_dict : & Dictionary ,
231+ good_boy_issuers : & Value ,
229232 receiver : & str ,
230233) -> Result < MainPodBuilder > {
231234 // Attestment chain (issuer -> good boy -> great boy):
@@ -261,14 +264,18 @@ pub fn great_boy_pod_builder(
261264 PodType :: MockSigned as i64
262265 ) ) ?;
263266 // Each good boy POD comes from a valid issuer
267+ let good_boy_proof = match good_boy_issuers {
268+ Value :: Dictionary ( dict) => Ok ( dict) ,
269+ _ => Err ( anyhow ! ( "Invalid good boy issuers!" ) ) ,
270+ } ?
271+ . prove ( pod_kvs. get ( & KEY_SIGNER . into ( ) ) . unwrap ( ) ) ?
272+ . 1 ;
264273 great_boy. pub_op ( op ! (
265274 contains,
266- Value :: Dictionary ( good_boy_issuer_dict . clone ( ) ) ,
275+ good_boy_issuers ,
267276 ( good_boy_pods[ good_boy_idx * 2 + issuer_idx] , KEY_SIGNER ) ,
268277 0 ,
269- good_boy_issuer_dict
270- . prove( pod_kvs. get( & KEY_SIGNER . into( ) ) . unwrap( ) ) ?
271- . 1
278+ good_boy_proof
272279 ) ) ?;
273280 // Each good boy has 2 good boy pods
274281 great_boy. pub_op ( op ! (
@@ -345,12 +352,12 @@ pub fn great_boy_pod_full_flow() -> Result<MainPodBuilder> {
345352 alice_friend_pods. push ( friend. sign ( & mut bob_signer) . unwrap ( ) ) ;
346353 alice_friend_pods. push ( friend. sign ( & mut charlie_signer) . unwrap ( ) ) ;
347354
348- let good_boy_issuer_dict = Dictionary :: new (
355+ let good_boy_issuers = Value :: Dictionary ( Dictionary :: new (
349356 & good_boy_issuers
350357 . into_iter ( )
351358 . map ( |issuer| ( crate :: middleware:: Hash :: from ( issuer) , 0 . into ( ) ) )
352359 . collect ( ) ,
353- ) ?;
360+ ) ?) ;
354361
355362 great_boy_pod_builder (
356363 & params,
@@ -361,7 +368,7 @@ pub fn great_boy_pod_full_flow() -> Result<MainPodBuilder> {
361368 & charlie_good_boys[ 1 ] ,
362369 ] ,
363370 [ & alice_friend_pods[ 0 ] , & alice_friend_pods[ 1 ] ] ,
364- & good_boy_issuer_dict ,
371+ & good_boy_issuers ,
365372 alice,
366373 )
367374}
@@ -387,14 +394,10 @@ pub fn tickets_pod_builder(
387394 expect_consumed : bool ,
388395 blacklisted_emails : & Dictionary ,
389396) -> Result < MainPodBuilder > {
397+ let attendee_email_value = signed_pod. kvs . get ( "attendeeEmail" ) . unwrap ( ) ;
398+ let attendee_nin_blacklist_pf =
399+ blacklisted_emails. prove_nonexistence ( & attendee_email_value. into ( ) ) ?;
390400 let blacklisted_email_dict_value = Value :: Dictionary ( blacklisted_emails. clone ( ) ) ;
391- let attendee_email_statement: Statement = ( signed_pod, "attendeeEmail" ) . into ( ) ;
392- let attendee_email_value = match attendee_email_statement. 1 . get ( 1 ) . cloned ( ) {
393- Some ( crate :: frontend:: StatementArg :: Literal ( v) ) => Ok ( v) ,
394- _ => Err ( anyhow ! (
395- "Unexpected error reading attendee email from signed POD."
396- ) ) ,
397- } ?;
398401 // Create a main pod referencing this signed pod with some statements
399402 let mut builder = MainPodBuilder :: new ( params) ;
400403 builder. add_signed_pod ( signed_pod) ;
@@ -404,8 +407,8 @@ pub fn tickets_pod_builder(
404407 builder. pub_op ( op ! (
405408 not_contains,
406409 blacklisted_email_dict_value,
407- attendee_email_statement ,
408- blacklisted_emails . prove_nonexistence ( & ( & attendee_email_value ) . into ( ) ) ?
410+ ( signed_pod , "attendeeEmail" ) ,
411+ attendee_nin_blacklist_pf
409412 ) ) ?;
410413 Ok ( builder)
411414}
0 commit comments