diddht

package
v0.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 12, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(opts ...CreateOption) (did.BearerDID, error)

Create creates a new `did:dht` DID and publishes it to the DHT network via a Pkarr gateway.

If no gateway is passed in the options, Create uses a default Pkarr gateway.

Spec: https://did-dht.com/#create

func CreateWithContext

func CreateWithContext(ctx context.Context, opts ...CreateOption) (did.BearerDID, error)

CreateWithContext creates a new `did:dht` DID and publishes it to the DHT network via a Pkarr gateway.

Types

type CreateOption

type CreateOption func(*createOptions)

CreateOption is the type returned from each individual option function

func AlsoKnownAs

func AlsoKnownAs(aka ...string) CreateOption

AlsoKnownAs is used to set the 'alsoKnownAs' property of the DID Document. more details here: https://www.w3.org/TR/did-core/#also-known-as

func Controllers

func Controllers(controllers ...string) CreateOption

Controllers is used to set the 'controller' property of the DID Document. more details here: https://www.w3.org/TR/did-core/#controller

func Gateway

func Gateway(gatewayURL string, client *http.Client) CreateOption

Gateway sets the gateway to use for publishing the DID to the DHT.

func KeyManager

func KeyManager(km crypto.KeyManager) CreateOption

KeyManager is used to set the key manager that will be used to generate the private keys for the DID.

func PrivateKey

func PrivateKey(algorithmID string, purposes ...didcore.Purpose) CreateOption

PrivateKey is used to add a private key to the DID being created with the Create function. Each PrivateKey provided will be used to generate a private key in the key manager and then added to the DID Document as a VerificationMethod.

func Service

func Service(id string, svcType string, endpoint ...string) CreateOption

Service is used to add a service to the DID being created with the Create function. Note: Service can be passed to Create multiple times to add multiple services.

type Resolver

type Resolver struct {
	// contains filtered or unexported fields
}

Resolver is a client for resolving DIDs using the DHT network.

func DefaultResolver

func DefaultResolver() *Resolver

DefaultResolver uses the default Pkarr gateway client

func NewResolver

func NewResolver(relayURL string, client *http.Client) *Resolver

NewResolver creates a new Resolver instance with the given relay and HTTP client. TODO make this relay an option and use default relay if not provided

func (*Resolver) Resolve

func (r *Resolver) Resolve(uri string) (didcore.ResolutionResult, error)

Resolve resolves a DID using the DHT method

func (*Resolver) ResolveWithContext

func (r *Resolver) ResolveWithContext(ctx context.Context, uri string) (didcore.ResolutionResult, error)

ResolveWithContext resolves a DID using the DHT method. This is the context aware version of Resolve.

Directories

Path Synopsis
internal
dns

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL