did

package
v0.3.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// ContextV1 of the DID document is the current V1 context name.
	ContextV1 = didmodel.ContextV1
	// ContextV1Old of the DID document representing the old/legacy V1 context name.
	ContextV1Old = didmodel.ContextV1Old
)
View Source
const (
	// VerificationRelationshipGeneral is a special case of verification relationship: when a verification method
	// defined in Verification is not used by any Verification.
	VerificationRelationshipGeneral = didmodel.VerificationRelationshipGeneral

	// Authentication defines verification relationship.
	Authentication = didmodel.Authentication

	// AssertionMethod defines verification relationship.
	AssertionMethod = didmodel.AssertionMethod

	// CapabilityDelegation defines verification relationship.
	CapabilityDelegation = didmodel.CapabilityDelegation

	// CapabilityInvocation defines verification relationship.
	CapabilityInvocation = didmodel.CapabilityInvocation

	// KeyAgreement defines verification relationship.
	KeyAgreement = didmodel.KeyAgreement
)

Variables

View Source
var ErrDIDDocumentNotExist = didmodel.ErrDIDDocumentNotExist

ErrDIDDocumentNotExist error did doc not exist.

View Source
var ErrKeyNotFound = didmodel.ErrKeyNotFound

ErrKeyNotFound is returned when key is not found.

View Source
var ErrProofNotFound = didmodel.ErrProofNotFound

ErrProofNotFound is returned when proof is not found.

Functions

func LookupDIDCommRecipientKeys added in v0.1.6

func LookupDIDCommRecipientKeys(didDoc *Doc) ([]string, bool)

LookupDIDCommRecipientKeys gets the DIDComm recipient keys from the did doc which match the given parameters. DIDComm recipient keys are encoded as did:key identifiers. See: - https://github.com/hyperledger/aries-rfcs/blob/master/features/0067-didcomm-diddoc-conventions/README.md - https://github.com/hyperledger/aries-rfcs/blob/master/features/0360-use-did-key/README.md

Types

type Context

type Context = didmodel.Context

Context represents JSON-LD representation-specific DID-core @context, which must be either a string, or a list containing maps and/or strings.

type DID added in v0.1.3

type DID = didmodel.DID

DID is parsed according to the generic syntax: https://w3c.github.io/did-core/#generic-did-syntax

func Parse added in v0.1.3

func Parse(did string) (*DID, error)

Parse parses the string according to the generic DID syntax. See https://w3c.github.io/did-core/#generic-did-syntax.

type DIDURL added in v0.1.8

type DIDURL = didmodel.DIDURL // nolint:golint

DIDURL holds a DID URL.

func ParseDIDURL added in v0.1.8

func ParseDIDURL(didURL string) (*DIDURL, error)

ParseDIDURL parses a DID URL string into a DIDURL object.

type Doc

type Doc = didmodel.Doc

Doc DID Document definition.

func BuildDoc

func BuildDoc(opts ...DocOption) *Doc

BuildDoc creates the DID Doc from options.

func ParseDocument

func ParseDocument(data []byte) (*Doc, error)

ParseDocument creates an instance of DIDDocument by reading a JSON document from bytes.

type DocOption

type DocOption = didmodel.DocOption

DocOption provides options to build DID Doc.

func WithAssertion added in v0.1.5

func WithAssertion(assertion []Verification) DocOption

WithAssertion sets the verification methods for assertion: https://w3c.github.io/did-core/#assertion.

func WithAuthentication

func WithAuthentication(auth []Verification) DocOption

WithAuthentication sets the verification methods for authentication: https://w3c.github.io/did-core/#authentication.

func WithCreatedTime

func WithCreatedTime(t time.Time) DocOption

WithCreatedTime DID doc created time.

func WithKeyAgreement added in v0.1.7

func WithKeyAgreement(keyAgreement []Verification) DocOption

WithKeyAgreement sets the verification methods for KeyAgreement: https://w3c.github.io/did-core/#key-agreement.

func WithService

func WithService(svc []Service) DocOption

WithService DID doc services.

func WithUpdatedTime

func WithUpdatedTime(t time.Time) DocOption

WithUpdatedTime DID doc updated time.

func WithVerificationMethod added in v0.1.5

func WithVerificationMethod(pubKey []VerificationMethod) DocOption

WithVerificationMethod DID doc VerificationMethod.

type DocResolution added in v0.1.6

type DocResolution = didmodel.DocResolution

DocResolution did resolution.

func ParseDocumentResolution added in v0.1.6

func ParseDocumentResolution(data []byte) (*DocResolution, error)

ParseDocumentResolution parse document resolution.

type DocumentMetadata added in v0.1.6

type DocumentMetadata = didmodel.DocumentMetadata

DocumentMetadata document metadata.

type MethodMetadata added in v0.1.6

type MethodMetadata = didmodel.MethodMetadata

MethodMetadata method metadata.

type Proof

type Proof = didmodel.Proof

Proof is cryptographic proof of the integrity of the DID Document.

type ProtocolOperation added in v0.1.9

type ProtocolOperation = didmodel.ProtocolOperation

ProtocolOperation info.

type Service

type Service = didmodel.Service

Service DID doc service.

func LookupService added in v0.1.1

func LookupService(didDoc *Doc, serviceType string) (*Service, bool)

LookupService returns the service from the given DIDDoc matching the given service type.

type Verification added in v0.1.5

type Verification = didmodel.Verification

Verification authentication verification.

func NewEmbeddedVerification added in v0.1.5

func NewEmbeddedVerification(vm *VerificationMethod, r VerificationRelationship) *Verification

NewEmbeddedVerification creates a new verification method with embedded verification method.

func NewReferencedVerification added in v0.1.5

func NewReferencedVerification(vm *VerificationMethod, r VerificationRelationship) *Verification

NewReferencedVerification creates a new verification method with referenced verification method.

type VerificationMethod

type VerificationMethod = didmodel.VerificationMethod

VerificationMethod DID doc verification method. The value of the verification method is defined either as raw public key bytes (Value field) or as JSON Web Key. In the first case the Type field can hold additional information to understand the nature of the raw public key.

func LookupPublicKey added in v0.1.1

func LookupPublicKey(id string, didDoc *Doc) (*VerificationMethod, bool)

LookupPublicKey returns the public key with the given id from the given DID Doc.

func NewVerificationMethodFromBytes added in v0.1.5

func NewVerificationMethodFromBytes(id, keyType, controller string, value []byte) *VerificationMethod

NewVerificationMethodFromBytes creates a new VerificationMethod based on raw public key bytes.

func NewVerificationMethodFromBytesWithMultibase added in v0.1.8

func NewVerificationMethodFromBytesWithMultibase(id, keyType, controller string, value []byte,
	encoding multibase.Encoding) *VerificationMethod

NewVerificationMethodFromBytesWithMultibase creates a new VerificationMethod based on raw public key bytes with multibase.

func NewVerificationMethodFromJWK added in v0.1.5

func NewVerificationMethodFromJWK(id, keyType, controller string, j *jwk.JWK) (*VerificationMethod, error)

NewVerificationMethodFromJWK creates a new VerificationMethod based on JSON Web Key.

type VerificationRelationship added in v0.1.3

type VerificationRelationship = didmodel.VerificationRelationship

VerificationRelationship defines a verification relationship between DID subject and a verification method.

Jump to

Keyboard shortcuts

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