@@ -9,7 +9,7 @@ use serde_json;
99use std:: fs;
1010use std:: path:: PathBuf ;
1111
12- use auths_sdk:: attestation:: { AttestationGroup , AttestationSink , verify_with_resolver } ;
12+ use auths_sdk:: attestation:: { AttestationGroup , AttestationSink } ;
1313use auths_sdk:: identity:: DefaultDidResolver ;
1414use auths_sdk:: keychain:: { KeyAlias , get_platform_keychain} ;
1515use auths_sdk:: ports:: { AttestationMetadata , AttestationSource , IdentityStorage } ;
@@ -194,6 +194,36 @@ pub enum OrgSubcommand {
194194 } ,
195195}
196196
197+ /// single-verifier helper. Resolves the issuer DID,
198+ /// constructs a typed `DevicePublicKey`, and calls `auths_verifier::verify_with_keys`.
199+ /// Returns one of: "✅ valid", "🛑 revoked", "⌛ expired", "❌ invalid".
200+ fn verify_attestation_via_resolver (
201+ att : & auths_verifier:: Attestation ,
202+ resolver : & auths_sdk:: identity:: DefaultDidResolver ,
203+ ) -> & ' static str {
204+ use auths_sdk:: identity:: DidResolver ;
205+ let resolved = match resolver. resolve ( att. issuer . as_str ( ) ) {
206+ Ok ( r) => r,
207+ Err ( _) => return "❌ invalid" ,
208+ } ;
209+ let pk_bytes: Vec < u8 > = resolved. public_key_bytes ( ) . to_vec ( ) ;
210+ let issuer_pk = match auths_verifier:: decode_public_key_bytes ( & pk_bytes) {
211+ Ok ( pk) => pk,
212+ Err ( _) => return "❌ invalid" ,
213+ } ;
214+ #[ allow( clippy:: expect_used) ]
215+ let rt = tokio:: runtime:: Builder :: new_current_thread ( )
216+ . enable_all ( )
217+ . build ( )
218+ . expect ( "tokio runtime" ) ;
219+ match rt. block_on ( auths_verifier:: verify_with_keys ( att, & issuer_pk) ) {
220+ Ok ( _) => "✅ valid" ,
221+ Err ( e) if e. to_string ( ) . contains ( "revoked" ) => "🛑 revoked" ,
222+ Err ( e) if e. to_string ( ) . contains ( "expired" ) => "⌛ expired" ,
223+ Err ( _) => "❌ invalid" ,
224+ }
225+ }
226+
197227/// Handles `org` commands for issuing or revoking member authorizations.
198228pub fn handle_org (
199229 cmd : OrgCommand ,
@@ -589,12 +619,7 @@ pub fn handle_org(
589619 continue ;
590620 }
591621
592- let status = match verify_with_resolver ( now, & resolver, att, None ) {
593- Ok ( _) => "✅ valid" ,
594- Err ( e) if e. to_string ( ) . contains ( "revoked" ) => "🛑 revoked" ,
595- Err ( e) if e. to_string ( ) . contains ( "expired" ) => "⌛ expired" ,
596- Err ( _) => "❌ invalid" ,
597- } ;
622+ let status = verify_attestation_via_resolver ( att, & resolver) ;
598623
599624 println ! ( "{i}. [{}] @ {}" , status, att. timestamp. unwrap_or( now) ) ;
600625 if let Some ( note) = & att. note {
@@ -626,12 +651,7 @@ pub fn handle_org(
626651 continue ;
627652 }
628653
629- let status = match verify_with_resolver ( now, & resolver, latest, None ) {
630- Ok ( _) => "✅ valid" ,
631- Err ( e) if e. to_string ( ) . contains ( "revoked" ) => "🛑 revoked" ,
632- Err ( e) if e. to_string ( ) . contains ( "expired" ) => "⌛ expired" ,
633- Err ( _) => "❌ invalid" ,
634- } ;
654+ let status = verify_attestation_via_resolver ( latest, & resolver) ;
635655
636656 println ! ( "- {} [{}]" , subject, status) ;
637657 }
0 commit comments