resolution

package
v0.0.4-alpha Latest Latest
Warning

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

Go to latest
Published: May 10, 2023 License: Apache-2.0 Imports: 9 Imported by: 19

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMethodForDID

func GetMethodForDID(id string) (did.Method, error)

GetMethodForDID provides the method for the given did string

func ResolveKeyForDID

func ResolveKeyForDID(ctx context.Context, resolver Resolver, id, kid string) (gocrypto.PublicKey, error)

ResolveKeyForDID resolves a public key from a DID for a given KID.

Types

type DocumentMetadata

type DocumentMetadata struct {
	Created       string `json:"created,omitempty" validate:"datetime"`
	Updated       string `json:"updated,omitempty" validate:"datetime"`
	Deactivated   bool   `json:"deactivated,omitempty"`
	NextUpdate    string `json:"nextUpdate,omitempty"`
	VersionID     string `json:"versionId,omitempty"`
	NextVersionID string `json:"nextVersionId,omitempty"`
	EquivalentID  string `json:"equivalentId,omitempty"`
	CanonicalID   string `json:"canonicalId,omitempty"`
}

DocumentMetadata https://www.w3.org/TR/did-core/#did-document-metadata

func (*DocumentMetadata) IsValid

func (s *DocumentMetadata) IsValid() bool

type MultiMethodResolver

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

MultiMethodResolver resolves a DID. The current implementation ssk-sdk does not have a universal resolution: https://github.com/decentralized-identity/universal-resolver In its place, this method attempts to resolve DID methods that can be resolved without relying on additional services.

func NewResolver

func NewResolver(resolvers ...Resolver) (*MultiMethodResolver, error)

func (MultiMethodResolver) Methods

func (dr MultiMethodResolver) Methods() []did.Method

func (MultiMethodResolver) Resolve

Resolve attempts to resolve a DID for a given method

type ResolutionError

type ResolutionError struct {
	Code                       string `json:"code"`
	InvalidDID                 bool   `json:"invalidDid"`
	NotFound                   bool   `json:"notFound"`
	RepresentationNotSupported bool   `json:"representationNotSupported"`
}

ResolutionError https://www.w3.org/TR/did-core/#did-resolution-metadata

type ResolutionMetadata

type ResolutionMetadata struct {
	ContentType string
	Error       *ResolutionError
}

ResolutionMetadata https://www.w3.org/TR/did-core/#did-resolution-metadata

type ResolutionResult

type ResolutionResult struct {
	Context            string `json:"@context,omitempty"`
	ResolutionMetadata `json:"didResolutionMetadata,omitempty"`
	did.Document       `json:"didDocument,omitempty"`
	DocumentMetadata   `json:"didDocumentMetadata,omitempty"`
}

ResolutionResult encapsulates the tuple of a DID resolution https://www.w3.org/TR/did-core/#did-resolution

func ParseDIDResolution

func ParseDIDResolution(resolvedDID []byte) (*ResolutionResult, error)

ParseDIDResolution attempts to parse a DID Resolution Result or a DID Document

func (*ResolutionResult) IsEmpty

func (r *ResolutionResult) IsEmpty() bool

type Resolver

type Resolver interface {
	// Resolve Attempts to resolve a DID for a given method
	Resolve(ctx context.Context, id string, opts ...ResolutionOption) (*ResolutionResult, error)
	// Methods returns all methods that can be resolved by this resolution.
	Methods() []did.Method
}

Resolver provides an interface for resolving DIDs as per the spec https://www.w3.org/TR/did-core/#did-resolution

Jump to

Keyboard shortcuts

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