pub struct AccountDid {
did: String,
host: String,
port: Option<u16>,
}Expand description
A validated did:web belonging to one agent.
Held as the exact DID string plus its decoded authority, so that neither the identifier nor the fetch URL has to be recomputed — and so that the decoded form can never disagree with the encoded one.
Fields§
§did: StringThe DID exactly as it is written, port colon still encoded.
host: StringDecoded hostname, without a port.
port: Option<u16>Decoded port, if the DID carried one.
Implementations§
Source§impl AccountDid
impl AccountDid
Sourcepub fn mint(zone: &Zone, account_id: &str) -> Result<Self, DidError>
pub fn mint(zone: &Zone, account_id: &str) -> Result<Self, DidError>
Mints the DID for account_id within zone.
Produces did:web:<account_id>.<zone host>, which resolves at
https://<account_id>.<zone host>/.well-known/did.json — no port,
because the spec allows one only for a bare loopback hostname and an
account is a subdomain of its zone.
Sourcepub fn account_id(&self) -> &str
pub fn account_id(&self) -> &str
The agent’s own label: the leftmost component of the hostname.
Sourcepub fn port(&self) -> Option<u16>
pub fn port(&self) -> Option<u16>
The decoded port, if this is a development DID that carries one.
The decoded authority: host, or host:port for a development DID.
This is the did:web identifier with its port colon decoded, which
is what an atproto record key may contain — : is in the record-key
character set and % is not. Anything keying a record by the server
a DID names has to use this rather than the encoded form
Self::as_str carries, and both sides of bot.did.operator do:
didbot operate writes at this key and the server’s own poll reads at
it. Deriving it here rather than at each end is what stops the two
from disagreeing.
Sourcepub fn is_loopback(&self) -> bool
pub fn is_loopback(&self) -> bool
Whether this DID names a loopback host, and so is development-only.
Sourcepub fn did_json_url(&self) -> String
pub fn did_json_url(&self) -> String
The URL the DID document is served at. Always https://: every
server this project runs terminates TLS, on a developer’s machine as
much as anywhere else.
A DID carries no port, so this is port 443 — except for a loopback
host RESOLVE_PORTS names, which is how a harness reaches several
servers at once on one machine.
Trait Implementations§
Source§impl Clone for AccountDid
impl Clone for AccountDid
Source§fn clone(&self) -> AccountDid
fn clone(&self) -> AccountDid
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AccountDid
impl Debug for AccountDid
Source§impl Display for AccountDid
impl Display for AccountDid
Source§impl FromStr for AccountDid
impl FromStr for AccountDid
Source§impl Hash for AccountDid
impl Hash for AccountDid
Source§impl PartialEq for AccountDid
impl PartialEq for AccountDid
Source§fn eq(&self, other: &AccountDid) -> bool
fn eq(&self, other: &AccountDid) -> bool
self and other values to be equal, and is used by ==.impl Eq for AccountDid
impl StructuralPartialEq for AccountDid
Auto Trait Implementations§
impl Freeze for AccountDid
impl RefUnwindSafe for AccountDid
impl Send for AccountDid
impl Sync for AccountDid
impl Unpin for AccountDid
impl UnsafeUnpin for AccountDid
impl UnwindSafe for AccountDid
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.