@@ -83,14 +83,12 @@ use keetanetwork_account::KeyPair;
8383use keetanetwork_crypto:: operations:: encryption:: Aead ;
8484use keetanetwork_crypto:: prelude:: { ExposeSecret , HashAlgorithm , IntoSecret , SecretBox } ;
8585use rasn:: prelude:: * ;
86- use strum:: AsRefStr ;
8786
8887#[ cfg( feature = "serde" ) ]
8988use serde:: { Deserialize , Serialize } ;
9089
9190use crate :: asn1:: error:: AnchorAsn1Error ;
9291use crate :: asn1:: utils:: { get_plain_attribute_oid, get_sensitive_attribute_oid} ;
93- use crate :: asn1:: * ;
9492use crate :: sensitive_attributes:: error:: SensitiveAttributeError ;
9593use crate :: sensitive_attributes:: utils:: { assert_valid_version, create_hash_input, setup_cipher_for_decryption} ;
9694use crate :: utils:: { base64_decode, base64_encode} ;
@@ -205,49 +203,6 @@ impl From<KycAttributeEntry> for SensitiveAttributeBuilder {
205203 }
206204}
207205
208- /// Certificate attribute names
209- ///
210- /// Predefined attribute names for common KYC data types, each mapped to a
211- /// specific Object Identifier (OID). ,These provide standardized ways to
212- /// identify different types of sensitive personal information.
213- ///
214- /// # Example
215- ///
216- /// ```rust
217- /// use keetanetwork_anchor::sensitive_attributes::SensitiveAttributeName;
218- /// use rasn::types::ObjectIdentifier;
219- ///
220- /// // Convert attribute names to OIDs
221- /// let email_oid = ObjectIdentifier::from(SensitiveAttributeName::Email);
222- /// let name_oid = ObjectIdentifier::from(SensitiveAttributeName::FullName);
223- ///
224- /// // Use in attribute identification
225- /// println!("Email OID: {}", email_oid);
226- /// println!("Full Name OID: {}", name_oid);
227- /// ```
228- #[ derive( Debug , Copy , Clone , PartialEq , Eq , Hash , AsRefStr ) ]
229- #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
230- #[ strum( serialize_all = "camelCase" ) ]
231- pub enum SensitiveAttributeName {
232- FullName ,
233- DateOfBirth ,
234- Address ,
235- Email ,
236- PhoneNumber ,
237- }
238-
239- impl From < SensitiveAttributeName > for ObjectIdentifier {
240- fn from ( attr : SensitiveAttributeName ) -> Self {
241- match attr {
242- SensitiveAttributeName :: FullName => oids:: keeta:: FULL_NAME ,
243- SensitiveAttributeName :: DateOfBirth => oids:: keeta:: DATE_OF_BIRTH ,
244- SensitiveAttributeName :: Address => oids:: keeta:: ADDRESS ,
245- SensitiveAttributeName :: Email => oids:: keeta:: EMAIL ,
246- SensitiveAttributeName :: PhoneNumber => oids:: keeta:: PHONE_NUMBER ,
247- }
248- }
249- }
250-
251206/// Hash structure for sensitive attribute proof.
252207#[ derive( Debug , Clone , Hash , PartialEq , Eq ) ]
253208#[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
@@ -576,36 +531,9 @@ mod tests {
576531 use keetanetwork_account:: Account ;
577532
578533 use super :: * ;
579- use crate :: asn1:: oids;
580534 use crate :: test_all_key_types;
581535 use crate :: testing:: { create_test_sensitive_attribute, create_test_sensitive_attribute_with_proof} ;
582536
583- #[ test]
584- fn test_certificate_attribute_name_oid ( ) {
585- let full_name_oid: ObjectIdentifier = SensitiveAttributeName :: FullName . into ( ) ;
586- let email_oid: ObjectIdentifier = SensitiveAttributeName :: Email . into ( ) ;
587- assert_eq ! ( full_name_oid, rasn:: oid!( "1.3.6.1.4.1.62675.1.0" ) ) ;
588- assert_eq ! ( email_oid, rasn:: oid!( "1.3.6.1.4.1.62675.1.3" ) ) ;
589- }
590-
591- #[ test]
592- fn test_certificate_attribute_name_conversion ( ) {
593- let test_cases = [
594- ( SensitiveAttributeName :: FullName , oids:: keeta:: FULL_NAME ) ,
595- ( SensitiveAttributeName :: DateOfBirth , oids:: keeta:: DATE_OF_BIRTH ) ,
596- ( SensitiveAttributeName :: Address , oids:: keeta:: ADDRESS ) ,
597- ( SensitiveAttributeName :: Email , oids:: keeta:: EMAIL ) ,
598- ( SensitiveAttributeName :: PhoneNumber , oids:: keeta:: PHONE_NUMBER ) ,
599- ] ;
600-
601- for ( attr_name, expected_oid) in test_cases {
602- let oid = ObjectIdentifier :: from ( attr_name) ;
603- assert_eq ! ( oid, expected_oid) ;
604- let oid2: ObjectIdentifier = attr_name. into ( ) ;
605- assert_eq ! ( oid2, expected_oid) ;
606- }
607- }
608-
609537 test_all_key_types ! ( test_sensitive_attribute_decrypt, |account: Account <_>| {
610538 let test_value = b"test value for decryption" ;
611539 let sensitive_attr = create_test_sensitive_attribute( & account, test_value) ;
0 commit comments