didresolver

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("DID not found")

ErrNotFound is returned when a DID resolver does not find the DID.

Functions

This section is empty.

Types

type DIDResolver

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

DIDResolver did resolver

func New

func New(opts ...Opt) *DIDResolver

New return new instance of did resolver

func (*DIDResolver) Resolve

func (r *DIDResolver) Resolve(did string, opts ...ResolveOpt) (*diddoc.Doc, error)

Resolve did document

type DidMethod

type DidMethod interface {
	// Read implements the 'DID Resolution' algorithm defined in
	// https://w3c-ccg.github.io/did-resolution/#resolving.
	Read(did string, opts ...ResolveOpt) (*did.Doc, error)
	// Accept registers this DID method resolver with the given method.
	Accept(method string) bool
}

DidMethod resolves a DID into a result type (default: DidDocumentResult). See the DID resolution spec: https://w3c-ccg.github.io/did-resolution.

type Opt

type Opt func(opts *didResolverOpts)

Opt is a resolver instance option

func WithDidMethod

func WithDidMethod(method DidMethod) Opt

WithDidMethod to add did method DID methods are checked in the order added

type ResolveOpt

type ResolveOpt func(opts *resolveOpts)

ResolveOpt is a did resolve option

func WithNoCache

func WithNoCache(noCache bool) ResolveOpt

WithNoCache the no-cache input option can be used to turn cache on or off

func WithResultType

func WithResultType(resultType ResultType) ResolveOpt

WithResultType the result type input option can be used to request a certain type of result

func WithVersionID

func WithVersionID(versionID interface{}) ResolveOpt

WithVersionID the version id input option can be used to request a specific version of a DID Document

func WithVersionTime

func WithVersionTime(versionTime time.Time) ResolveOpt

WithVersionTime the version time input option can used to request a specific version of a DID Document

type Resolver

type Resolver interface {
	Resolve(did string, opts ...ResolveOpt) (*did.Doc, error)
}

Resolver interface for DID resolver.

type ResultType

type ResultType int

ResultType input option can be used to request a certain type of result.

const (
	// DidDocumentResult Request a DID Document as output
	DidDocumentResult ResultType = iota
	// ResolutionResult Request a DID Resolution Result
	ResolutionResult
)

Jump to

Keyboard shortcuts

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