@@ -129,28 +129,34 @@ pub mod pallet {
129129 IdentityCreatedPlain {
130130 account : T :: AccountId ,
131131 identity : Identity ,
132+ id_graph : Vec < ( Identity , IdentityContext < T > ) > ,
132133 } ,
133134 IdentityCreated {
134135 account : AesOutput ,
135136 identity : AesOutput ,
137+ id_graph : AesOutput ,
136138 } ,
137139 // remove identity
138140 IdentityRemovedPlain {
139141 account : T :: AccountId ,
140142 identity : Identity ,
143+ id_graph : Vec < ( Identity , IdentityContext < T > ) > ,
141144 } ,
142145 IdentityRemoved {
143146 account : AesOutput ,
144147 identity : AesOutput ,
148+ id_graph : AesOutput ,
145149 } ,
146150 // verify identity
147151 IdentityVerifiedPlain {
148152 account : T :: AccountId ,
149153 identity : Identity ,
154+ id_graph : Vec < ( Identity , IdentityContext < T > ) > ,
150155 } ,
151156 IdentityVerified {
152157 account : AesOutput ,
153158 identity : AesOutput ,
159+ id_graph : AesOutput ,
154160 } ,
155161 // some error happened during processing in TEE, we use string-like
156162 // parameters for more "generic" error event reporting
@@ -344,10 +350,12 @@ pub mod pallet {
344350 Self :: deposit_event ( Event :: < T > :: IdentityCreatedPlain {
345351 account : who. clone ( ) ,
346352 identity : identity. clone ( ) ,
353+ id_graph : Self :: get_id_graph ( & who) ,
347354 } ) ;
348355 Self :: deposit_event ( Event :: < T > :: IdentityCreated {
349356 account : aes_encrypt_default ( & key, who. encode ( ) . as_slice ( ) ) ,
350357 identity : aes_encrypt_default ( & key, identity. encode ( ) . as_slice ( ) ) ,
358+ id_graph : aes_encrypt_default ( & key, Self :: get_id_graph ( & who) . encode ( ) . as_slice ( ) ) ,
351359 } ) ;
352360 Ok ( ( ) )
353361 }
@@ -375,10 +383,12 @@ pub mod pallet {
375383 Self :: deposit_event ( Event :: < T > :: IdentityRemovedPlain {
376384 account : who. clone ( ) ,
377385 identity : identity. clone ( ) ,
386+ id_graph : Self :: get_id_graph ( & who) ,
378387 } ) ;
379388 Self :: deposit_event ( Event :: < T > :: IdentityRemoved {
380389 account : aes_encrypt_default ( & key, who. encode ( ) . as_slice ( ) ) ,
381390 identity : aes_encrypt_default ( & key, identity. encode ( ) . as_slice ( ) ) ,
391+ id_graph : aes_encrypt_default ( & key, Self :: get_id_graph ( & who) . encode ( ) . as_slice ( ) ) ,
382392 } ) ;
383393
384394 Ok ( ( ) )
@@ -450,10 +460,15 @@ pub mod pallet {
450460 Self :: deposit_event ( Event :: < T > :: IdentityVerifiedPlain {
451461 account : who. clone ( ) ,
452462 identity : identity. clone ( ) ,
463+ id_graph : Self :: get_id_graph ( & who) ,
453464 } ) ;
454465 Self :: deposit_event ( Event :: < T > :: IdentityVerified {
455466 account : aes_encrypt_default ( & key, who. encode ( ) . as_slice ( ) ) ,
456467 identity : aes_encrypt_default ( & key, identity. encode ( ) . as_slice ( ) ) ,
468+ id_graph : aes_encrypt_default (
469+ & key,
470+ Self :: get_id_graph ( & who) . encode ( ) . as_slice ( ) ,
471+ ) ,
457472 } ) ;
458473 Ok ( ( ) )
459474 } )
@@ -487,9 +502,10 @@ pub mod pallet {
487502 origin : OriginFor < T > ,
488503 account : AesOutput ,
489504 identity : AesOutput ,
505+ id_graph : AesOutput ,
490506 ) -> DispatchResultWithPostInfo {
491507 let _ = T :: TEECallOrigin :: ensure_origin ( origin) ?;
492- Self :: deposit_event ( Event :: IdentityCreated { account, identity } ) ;
508+ Self :: deposit_event ( Event :: IdentityCreated { account, identity, id_graph } ) ;
493509 Ok ( Pays :: No . into ( ) )
494510 }
495511
@@ -498,9 +514,10 @@ pub mod pallet {
498514 origin : OriginFor < T > ,
499515 account : AesOutput ,
500516 identity : AesOutput ,
517+ id_graph : AesOutput ,
501518 ) -> DispatchResultWithPostInfo {
502519 let _ = T :: TEECallOrigin :: ensure_origin ( origin) ?;
503- Self :: deposit_event ( Event :: IdentityRemoved { account, identity } ) ;
520+ Self :: deposit_event ( Event :: IdentityRemoved { account, identity, id_graph } ) ;
504521 Ok ( Pays :: No . into ( ) )
505522 }
506523
@@ -509,9 +526,10 @@ pub mod pallet {
509526 origin : OriginFor < T > ,
510527 account : AesOutput ,
511528 identity : AesOutput ,
529+ id_graph : AesOutput ,
512530 ) -> DispatchResultWithPostInfo {
513531 let _ = T :: TEECallOrigin :: ensure_origin ( origin) ?;
514- Self :: deposit_event ( Event :: IdentityVerified { account, identity } ) ;
532+ Self :: deposit_event ( Event :: IdentityVerified { account, identity, id_graph } ) ;
515533 Ok ( Pays :: No . into ( ) )
516534 }
517535
@@ -663,5 +681,9 @@ pub mod pallet {
663681 addr[ ..20 ] . copy_from_slice ( & hashed_pk[ 12 ..32 ] ) ;
664682 Ok ( addr)
665683 }
684+
685+ pub fn get_id_graph ( who : & T :: AccountId ) -> Vec < ( Identity , IdentityContext < T > ) > {
686+ IDGraphs :: iter_prefix ( who) . collect :: < Vec < _ > > ( )
687+ }
666688 }
667689}
0 commit comments