Module methods

Module methods 

Source
Expand description

A collection of methods for DID resolution and related utilities.

This module provides functionality for resolving Decentralized Identifiers (DIDs) using different DID methods including did:key, did:web, and did:peer.

§Examples

§Basic did:key resolution example.

use did_utils::methods::{DIDResolver, DidKey};
use did_utils::methods::DIDResolutionOptions;

    let did_key_resolver = DidKey::new();
    let did = "did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK";
    let output = did_key_resolver.resolve(did, &DIDResolutionOptions::default()).await;

§An example demonstrating a basic usage of did:web

use did_utils::methods::{DIDResolver, DidWeb};
use did_utils::methods::DIDResolutionOptions;

    let port = 3000;
    let host = "localhost";

    let formatted_string = format!("did:web:{}%3A{}", host.to_string(), port);
    let did: &str = &formatted_string;

    let did_web_resolver = DidWeb::new();
    let output = did_web_resolver.resolve(
        did,
        &DIDResolutionOptions::default()
    ).await;

§An example demonstrating a basic usage of did:peer

use did_utils::methods::{DIDResolver, DidPeer};
use did_utils::methods::DIDResolutionOptions;

    let did = "did:peer:0z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK";

    let did_peer_resolver = DidPeer::new();
    let output = did_peer_resolver.resolve(
        did,
        &DIDResolutionOptions::default()
    ).await;

Structs§

DIDDocumentMetadata
DID Document Metadata.
DIDResolutionMetadata
DID Resolution Metadata.
DIDResolutionOptions
DID Resolution Options.
DereferencingOutput
Dereferencing Output.
DidKey
DidPeer
DidWeb
A struct for resolving DID Web documents.
PurposedKey
ResolutionOutput
DID Resolution Output.

Enums§

Content
A resource returned by DID URL dereferencing
DIDResolutionError
Registry for error types found across the DID core specification, and especially during the DID resolution process.
DidWebError
MediaType
Media type for resolution input and output metadata.
ParsingErrorSource
Purpose

Traits§

DIDMethod
Abstract contract for DID methods.
DIDResolver
Abstract contract for DID resolution.

Type Aliases§

ContentMetadata
Content Metadata.
DereferencingMetadata
DID URL Dereferencing Metadata.
DereferencingOptions
DID URL Dereferencing Options.