Skip to content

Commit 5d361b8

Browse files
committed
Documentation and ergonomic enhancements.
1 parent 3041dd6 commit 5d361b8

File tree

7 files changed

+923
-217
lines changed

7 files changed

+923
-217
lines changed

src/generated/kyc_attributes.rs

Lines changed: 0 additions & 30 deletions
This file was deleted.

src/lib/asn1/oids.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,15 @@ pub mod keeta {
6666
};
6767
}
6868
}
69+
70+
lazy_static::lazy_static! {
71+
/// OID database for certificate attributes.
72+
pub static ref PLAIN_ATTRIBUTES: HashMap<&'static str, ObjectIdentifier> = {
73+
[
74+
("postalCode", ADDRESS_POSTAL_CODE),
75+
]
76+
.iter()
77+
.cloned()
78+
.collect()
79+
};
80+
}

src/lib/asn1/utils.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ pub(crate) fn get_sensitive_attribute_oid<T: AsRef<str>>(name: T) -> Result<Obje
2222
.ok_or_else(|| AnchorAsn1Error::InvalidOid { reason: format!("Unknown sensitive attribute: {name_str}") })
2323
}
2424

25+
pub(crate) fn get_plain_attribute_oid<T: AsRef<str>>(name: T) -> Result<ObjectIdentifier, AnchorAsn1Error> {
26+
let name_str = name.as_ref();
27+
oids::PLAIN_ATTRIBUTES
28+
.get(name_str)
29+
.cloned()
30+
.ok_or_else(|| AnchorAsn1Error::InvalidOid { reason: format!("Unknown plain attribute: {name_str}") })
31+
}
32+
2533
/// Parse an OID string into a rasn `ObjectIdentifier`. This is required
2634
/// because `ObjectIdentifier` does not implement `FromStr` for some reason.
2735
///

0 commit comments

Comments
 (0)