resolution

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

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 {
	// See `created` in https://www.w3.org/TR/did-core/#did-document-metadata
	Created string `json:"created,omitempty" validate:"omitempty,datetime=2006-01-02T15:04:05Z"`

	// See `updated` in https://www.w3.org/TR/did-core/#did-document-metadata
	Updated string `json:"updated,omitempty" validate:"omitempty,datetime=2006-01-02T15:04:05Z"`

	// See `deactivated` in https://www.w3.org/TR/did-core/#did-document-metadata
	Deactivated bool `json:"deactivated,omitempty"`

	// See `nextUpdate` in https://www.w3.org/TR/did-core/#did-document-metadata
	NextUpdate string `json:"nextUpdate,omitempty"`

	// See `versionId` in https://www.w3.org/TR/did-core/#did-document-metadata
	VersionID string `json:"versionId,omitempty"`

	// See `nextVersionId` in https://www.w3.org/TR/did-core/#did-document-metadata
	NextVersionID string `json:"nextVersionId,omitempty"`

	// See `equivalentId` in https://www.w3.org/TR/did-core/#did-document-metadata
	EquivalentID []string `json:"equivalentId,omitempty"`

	// See `canonicalId` in https://www.w3.org/TR/did-core/#did-document-metadata
	CanonicalID string `json:"canonicalId,omitempty"`

	// Optional information that is specific to the DID Method of the DID Document resolved. Populated only
	// for sidetree based did methods (e.g. ION), as described in https://identity.foundation/sidetree/spec/#did-resolver-output
	Method Method `json:"method,omitempty"`
}

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

func (*DocumentMetadata) IsValid

func (s *DocumentMetadata) IsValid() bool

type Error

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

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

type Metadata

type Metadata struct {
	ContentType string `json:"contentType,omitempty"`
	Error       *Error `json:"error,omitempty"`
}

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

type Method

type Method struct {
	// The `method` property in https://identity.foundation/sidetree/spec/#did-resolver-output
	Published bool `json:"published"`

	// The `recoveryCommitment` property in https://identity.foundation/sidetree/spec/#did-resolver-output
	RecoveryCommitment string `json:"recoveryCommitment,omitempty"`

	// The `updateCommitment` property in https://identity.foundation/sidetree/spec/#did-resolver-output
	UpdateCommitment string `json:"updateCommitment,omitempty"`
}

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

func (dr MultiMethodResolver) Resolve(ctx context.Context, id string, opts ...Option) (*Result, error)

Resolve attempts to resolve a DID for a given method

type Resolver

type Resolver interface {
	// Resolve Attempts to resolve a DID for a given method
	Resolve(ctx context.Context, id string, opts ...Option) (*Result, 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

type Result

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

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

func ParseDIDResolution

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

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

func (*Result) IsEmpty

func (r *Result) IsEmpty() bool

Jump to

Keyboard shortcuts

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