didweb

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(domain string, opts ...CreateOption) (_did.BearerDID, error)

Create creates a new 'did:web' BearerDID with the given domain and options provided. If no options are provided, a default key manager will be used to generate a single ED25519 key pair. The resulting public key will be added to the DID Document as a VerificationMethod. More information regarding did:web can be found here: https://w3c-ccg.github.io/did-method-web/

func TransformID

func TransformID(id string) (string, error)

TransformID takes a did:web's identifier (the third part, after the method) and returns the web URL per the spec

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 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{}

Resolver is a type to implement resolution

func (Resolver) Resolve

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

Resolve the provided DID URI (must be a did:web) as per the spec

func (Resolver) ResolveWithContext

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

ResolveWithContext the provided DID URI (must be a did:web) as per the spec

Jump to

Keyboard shortcuts

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