resolver

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package resolver implements a universal resolver compatible REST API

https://github.com/decentralized-identity/universal-resolver

The configuration for this resolver are the following:

{
	"pattern": "^(did:cosmos:.+)$",
	"url": "http://uni-resolver-driver-did-uport:8081/",
	"testIdentifiers": [
		"did:cosmos:cash:alice",
		"did:cosmos:key:cosmos1000000000000000000000000000000000000000000"
	]
}

Index

Constants

View Source
const (
	// ResolutionInvalidDID - the DID supplied to the DID resolution function does not conform to valid syntax.
	ResolutionInvalidDID = "invalidDid"
	// ResolutionNotFound - the DID resolver was unable to find the DID document resulting from this resolution request.
	ResolutionNotFound = "notFound"
	// ResolutionRepresentationNotSupported - the representation requested via the accept input metadata property is not supported
	ResolutionRepresentationNotSupported = "representationNotSupported"
)

Error types for resolution as described in the resolution metadata https://www.w3.org/TR/did-core/#did-resolution-metadata

View Source
const (
	ResolutionJSONType   = "application/json"
	ResolutionJSONLDType = "application/ld+json"
)

Accepted content types

Variables

This section is empty.

Functions

func ResolveAccountDID

func ResolveAccountDID(did string) (didDoc types.DidDocument, didMeta types.DidMetadata, err error)

ResolveAccountDID generates a DID document from an address

Types

type DidResolutionReply

type DidResolutionReply struct {
	Document           types.DidDocument  `json:"didDocument,omitempty"`
	Metadata           types.DidMetadata  `json:"didDocumentMetadata,omitempty"`
	ResolutionMetadata ResolutionMetadata `json:"didResolutionMetadata,omitempty"`
}

DidResolutionReply contains the answer to a identifier endpoint

func ResolveRepresentation

func ResolveRepresentation(ctx client.Context, did string, opts ResolutionOption) (drr DidResolutionReply)

ResolveRepresentation resolve a did document with a specific representation

type ResolutionMetadata

type ResolutionMetadata struct {
	ContentType     string            `json:"contentType,omitempty"`
	ResolutionError string            `json:"error,omitempty"`
	DidProperties   map[string]string `json:"did,omitempty"`
}

ResolutionMetadata are info about the resolution https://www.w3.org/TR/did-core/#did-resolution-metadata

func ResolutionErr

func ResolutionErr(err string) ResolutionMetadata

ResolutionErr helper to get a resolution metadata for an error

func ResolutionOk

func ResolutionOk(contentType string) ResolutionMetadata

ResolutionOk helper to get a resolution metadata for a successful resolution

type ResolutionOption

type ResolutionOption struct {
	Accept string `json:"accept,omitempty"`
}

ResolutionOption are parametes for the resolver https://www.w3.org/TR/did-core/#did-resolution-options

Jump to

Keyboard shortcuts

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