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

Method from_did

atomic-identity/src/identity.rs:113–118  ·  view source on GitHub ↗

Parse a `did:atomic:` identifier back into an id.

(did: &str)

Source from the content-addressed store, hash-verified

111
112 /// Parse a `did:atomic:` identifier back into an id.
113 pub fn from_did(did: &str) -> Result<Self, IdentityError> {
114 let raw = did.strip_prefix(DID_ATOMIC_PREFIX).ok_or_else(|| {
115 IdentityError::InvalidKey(format!("not a {DID_ATOMIC_PREFIX} identifier: {did}"))
116 })?;
117 Self::from_base32(raw)
118 }
119
120 /// Does this id correspond to `public_key`?
121 pub fn matches_public_key(&self, public_key: &PublicKey) -> bool {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected