pub struct Identity {
pub platform: ExternalPlatform,
pub ident: String,
pub proof: String,
}Expand description
A single declared external identity.
Build new ones with Self::new or
Self::parse_tag_values; render to a Tag with
Tag::external_identity.
Fields§
§platform: ExternalPlatformThe platform on which the user holds an account.
ident: StringThe user’s handle / id on that platform. For mastodon,
this includes the instance host (e.g. bitcoinhackers.org/@semisol).
proof: StringPlatform-specific proof string. The shape is documented per platform in NIP-39 §“Claim types”.
Implementations§
Source§impl Identity
impl Identity
Sourcepub fn new(
platform: ExternalPlatform,
ident: impl Into<String>,
proof: impl Into<String>,
) -> Result<Self, Nip39Error>
pub fn new( platform: ExternalPlatform, ident: impl Into<String>, proof: impl Into<String>, ) -> Result<Self, Nip39Error>
Construct an identity from the canonical pieces.
§Errors
Returns Nip39Error::EmptyIdentity when ident is empty
after trimming.
Sourcepub fn parse_tag_values(
platform_identity: &str,
proof: impl Into<String>,
) -> Result<Self, Nip39Error>
pub fn parse_tag_values( platform_identity: &str, proof: impl Into<String>, ) -> Result<Self, Nip39Error>
Parse the on-the-wire pair (platform_identity, proof) of an
i tag’s positional arguments.
platform_identity is the second element of the tag (the
concatenated platform:identity form). proof is the third
element.
§Errors
Nip39Error::MissingSeparatorfor aplatform_identitywithout a:.Nip39Error::PlatformContainsColonpropagated from the platform parser.Nip39Error::EmptyIdentityif the part after:is empty.
Sourcepub fn platform_identity(&self) -> String
pub fn platform_identity(&self) -> String
The canonical platform:identity join used in the second slot
of the i tag.
Trait Implementations§
impl Eq for Identity
impl StructuralPartialEq for Identity
Auto Trait Implementations§
impl Freeze for Identity
impl RefUnwindSafe for Identity
impl Send for Identity
impl Sync for Identity
impl Unpin for Identity
impl UnsafeUnpin for Identity
impl UnwindSafe for Identity
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.