MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / parse_identity

Function parse_identity

atomic-core/src/kg/iri.rs:137–145  ·  view source on GitHub ↗
(iri: &str)

Source from the content-addressed store, hash-verified

135}
136
137pub fn parse_identity(iri: &str) -> Result<IdentityIri, IriError> {
138 if let Some(fingerprint) = iri.strip_prefix("did:atomic:") {
139 strict_base32(fingerprint).map_err(|_| IriError(iri.into()))?;
140 Ok(IdentityIri::Did(iri.to_owned()))
141 } else {
142 let (project, name) = parse_named_identity(iri)?;
143 Ok(IdentityIri::Named(project, name))
144 }
145}
146
147fn canonical_uid(uid: &str) -> Result<(), IriError> {
148 let parsed = ulid::Ulid::from_string(uid).map_err(|_| IriError(uid.into()))?;

Callers

nothing calls this directly

Calls 2

strict_base32Function · 0.85
IriErrorClass · 0.85

Tested by

no test coverage detected