Skip to main content

DIDMethod

Enum DIDMethod 

Source
#[non_exhaustive]
pub enum DIDMethod { Key { identifier: String, codec: Codec, key_bytes: Vec<u8>, }, Peer { identifier: String, numalgo: PeerNumAlgo, }, Web { identifier: String, domain: String, path_segments: Vec<String>, }, Jwk { identifier: String, }, Ethr { identifier: String, }, Pkh { identifier: String, chain_namespace: String, chain_reference: String, account_address: String, }, Webvh { identifier: String, scid: String, domain: String, path_segments: Vec<String>, }, Cheqd { identifier: String, network: String, uuid: String, }, Scid { identifier: String, underlying_method: String, version: String, scid: String, }, Ebsi { identifier: String, }, Other { method: String, identifier: String, }, }
Expand description

DID method identifiers per W3C DID Core 1.0

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Key

Fields

§identifier: String

Raw identifier for Display (“z6MkhaX…”)

§codec: Codec

Multicodec indicating key type

§key_bytes: Vec<u8>

Raw public key bytes

§

Peer

Fields

§identifier: String

Raw identifier for Display

§numalgo: PeerNumAlgo

Algorithm number (0, 1, 2)

§

Web

Fields

§identifier: String

Raw identifier for Display (“example.com:user:alice”)

§domain: String

Domain (first segment)

§path_segments: Vec<String>

Path segments after domain

§

Jwk

Fields

§identifier: String

Raw identifier (base64url encoded JWK)

§

Ethr

Ethereum DID method (did:ethr)

Fields

§identifier: String

Raw identifier for Display (hex address)

§

Pkh

Public Key Hash DID method (did:pkh) Format: <chain_namespace>:<chain_reference>:<account_address>

Fields

§identifier: String

Raw identifier for Display

§chain_namespace: String

Chain namespace (e.g., “eip155”, “solana”, “bip122”)

§chain_reference: String

Chain reference (network identifier)

§account_address: String

Account address

§

Webvh

WebVH DID method with versioned history (did:webvh) Format: ::<path_segments>

Fields

§identifier: String

Raw identifier for Display

§scid: String

Self-Certifying IDentifier (hash)

§domain: String

Domain (first segment after SCID)

§path_segments: Vec<String>

Path segments after domain

§

Cheqd

Cheqd DID method (did:cheqd) Format: :

Fields

§identifier: String

Raw identifier for Display

§network: String

Network (mainnet, testnet)

§uuid: String

UUID identifier

§

Scid

SCID DID method - maps to other methods (did:scid) Format: <underlying_method>::

Fields

§identifier: String

Raw identifier for Display

§underlying_method: String

Underlying method type (e.g., “vh” for webvh)

§version: String

Version number

§scid: String

Self-Certifying IDentifier

§

Ebsi

EBSI DID method for legal entities (did:ebsi) Format: z<base58btc(0x01 + 16_random_bytes)>

Fields

§identifier: String

Raw identifier (e.g., “zfEmvX5twhXjQJiCWsukvQA”)

§

Other

Catch-all for methods we don’t explicitly model

Fields

§method: String

Method name (e.g., “example”)

§identifier: String

Raw identifier (opaque)

Implementations§

Source§

impl DIDMethod

Source

pub fn resolve(&self, did: &DID) -> Result<Document, DIDError>

Resolve this DID method to a DID Document

Works for locally-resolvable methods (did:key, did:peer). For network methods, returns an error indicating external resolution is needed.

Source§

impl DIDMethod

Source

pub fn name(&self) -> &str

Returns the method name (“key”, “peer”, “web”, etc.)

Source

pub fn identifier(&self) -> &str

Returns the raw method-specific identifier

Trait Implementations§

Source§

impl Clone for DIDMethod

Source§

fn clone(&self) -> DIDMethod

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DIDMethod

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for DIDMethod

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for DIDMethod

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for DIDMethod

Source§

fn eq(&self, other: &DIDMethod) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for DIDMethod

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for DIDMethod

Source§

impl StructuralPartialEq for DIDMethod

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,