document

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2023 License: Apache-2.0 Imports: 5 Imported by: 44

Documentation

Index

Constants

View Source
const (

	// ContextProperty defines key for context property.
	ContextProperty = "@context"

	// AlsoKnownAs defines also known as property.
	AlsoKnownAs = "alsoKnownAs"

	// ServiceProperty defines key for service property.
	ServiceProperty = "service"

	// PublicKeyProperty defines key for public key property.
	PublicKeyProperty = "publicKey"

	// VerificationMethodProperty defines key for verification method.
	VerificationMethodProperty = "verificationMethod"

	// AuthenticationProperty defines key for authentication property.
	AuthenticationProperty = "authentication"

	// AssertionMethodProperty defines key for assertion method property.
	AssertionMethodProperty = "assertionMethod"

	// KeyAgreementProperty defines key for key agreement property.
	KeyAgreementProperty = "keyAgreement"

	// DelegationKeyProperty defines key for delegation key property.
	DelegationKeyProperty = "capabilityDelegation"

	// InvocationKeyProperty defines key for invocation key property.
	InvocationKeyProperty = "capabilityInvocation"
)
View Source
const (

	// ControllerProperty defines key for controller.
	ControllerProperty = "controller"

	// PurposesProperty describes key purposes property.
	PurposesProperty = "purposes"

	// PublicKeyJwkProperty describes external public key JWK.
	PublicKeyJwkProperty = "publicKeyJwk"

	// TypeProperty describes type.
	TypeProperty = "type"

	// PublicKeyBase58Property defines base 58 encoding for public key.
	PublicKeyBase58Property = "publicKeyBase58"

	// PublicKeyMultibaseProperty defines base multibase for public key.
	PublicKeyMultibaseProperty = "publicKeyMultibase"
)
View Source
const (
	// KeyPurposeAuthentication defines key purpose as authentication key.
	KeyPurposeAuthentication = "authentication"
	// KeyPurposeAssertionMethod defines key purpose as assertion key.
	KeyPurposeAssertionMethod = "assertionMethod"
	// KeyPurposeKeyAgreement defines key purpose as agreement key.
	KeyPurposeKeyAgreement = "keyAgreement"
	// KeyPurposeCapabilityDelegation defines key purpose as delegation key.
	KeyPurposeCapabilityDelegation = "capabilityDelegation"
	// KeyPurposeCapabilityInvocation defines key purpose as invocation key.
	KeyPurposeCapabilityInvocation = "capabilityInvocation"
)
View Source
const (

	// ReplaceServiceProperty defines key for service property.
	ReplaceServiceProperty = "services"

	// ReplacePublicKeyProperty defines key for public key property.
	ReplacePublicKeyProperty = "publicKeys"
)
View Source
const (
	// UpdateCommitmentProperty is update commitment key.
	UpdateCommitmentProperty = "updateCommitment"

	// RecoveryCommitmentProperty is recovery commitment key.
	RecoveryCommitmentProperty = "recoveryCommitment"

	// PublishedProperty is published key.
	PublishedProperty = "published"

	// DeactivatedProperty is deactivated flag key.
	DeactivatedProperty = "deactivated"

	// AnchorOriginProperty is anchor origin key.
	AnchorOriginProperty = "anchorOrigin"

	// CreatedProperty is the time that document was created - anchoring time of first successful create operation.
	CreatedProperty = "created"

	// UpdatedProperty is the time of last document update - anchoring time of update/recover operations.
	UpdatedProperty = "updated"

	// VersionIDProperty is version ID key.
	VersionIDProperty = "versionId"

	// CanonicalIDProperty is canonical ID key.
	CanonicalIDProperty = "canonicalId"

	// EquivalentIDProperty is equivalent ID array.
	EquivalentIDProperty = "equivalentId"

	// MethodProperty is used for method metadata within did document metadata.
	MethodProperty = "method"

	// UnpublishedOperationsProperty holds unpublished did operations.
	UnpublishedOperationsProperty = "unpublishedOperations"

	// PublishedOperationsProperty holds published did operations.
	PublishedOperationsProperty = "publishedOperations"
)
View Source
const IDProperty = "id"

IDProperty describes id key.

View Source
const ServiceEndpointProperty = "serviceEndpoint"

ServiceEndpointProperty describes external service endpoint property.

Variables

This section is empty.

Functions

func StringArray added in v0.1.3

func StringArray(entry interface{}) []string

StringArray is utility function to return string array from interface.

Types

type DIDDocument

type DIDDocument map[string]interface{}

DIDDocument Defines DID Document data structure used by Sidetree for basic type safety checks.

func DIDDocumentFromReader

func DIDDocumentFromReader(r io.Reader) (DIDDocument, error)

DIDDocumentFromReader creates an instance of DIDDocument by reading a JSON document from Reader.

func DidDocumentFromBytes

func DidDocumentFromBytes(data []byte) (DIDDocument, error)

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

func DidDocumentFromJSONLDObject added in v0.1.3

func DidDocumentFromJSONLDObject(jsonldObject map[string]interface{}) DIDDocument

DidDocumentFromJSONLDObject creates an instance of DIDDocument from json ld object.

func (DIDDocument) AgreementKeys added in v0.1.5

func (doc DIDDocument) AgreementKeys() []interface{}

AgreementKeys returns agreement method array (mixture of strings and objects).

func (DIDDocument) AlsoKnownAs added in v1.0.0

func (doc DIDDocument) AlsoKnownAs() []string

AlsoKnownAs are alternate identifiers for DID subject.

func (DIDDocument) AssertionMethods added in v0.1.5

func (doc DIDDocument) AssertionMethods() []interface{}

AssertionMethods returns assertion method array (mixture of strings and objects).

func (DIDDocument) Authentications added in v0.1.5

func (doc DIDDocument) Authentications() []interface{}

Authentications returns authentication array (mixture of strings and objects).

func (DIDDocument) Context

func (doc DIDDocument) Context() []interface{}

Context is the context of did document.

func (DIDDocument) DelegationKeys added in v0.1.5

func (doc DIDDocument) DelegationKeys() []interface{}

DelegationKeys returns delegation method array (mixture of strings and objects).

func (DIDDocument) ID

func (doc DIDDocument) ID() string

ID is identifier for DID subject (what DID Document is about).

func (DIDDocument) InvocationKeys added in v0.1.5

func (doc DIDDocument) InvocationKeys() []interface{}

InvocationKeys returns invocation method array (mixture of strings and objects).

func (DIDDocument) JSONLdObject

func (doc DIDDocument) JSONLdObject() map[string]interface{}

JSONLdObject returns map that represents JSON LD Object.

func (DIDDocument) PublicKeys

func (doc DIDDocument) PublicKeys() []PublicKey

PublicKeys are used for digital signatures, encryption and other cryptographic operations.

func (DIDDocument) Services

func (doc DIDDocument) Services() []Service

Services is an array of service endpoints.

func (DIDDocument) VerificationMethods added in v0.1.5

func (doc DIDDocument) VerificationMethods() []PublicKey

VerificationMethods (formerly public keys) are used for digital signatures, encryption and other cryptographic operations.

type Document

type Document map[string]interface{}

Document defines generic document data structure.

func FromBytes

func FromBytes(data []byte) (Document, error)

FromBytes creates an instance of Document by reading a JSON document from bytes.

func FromJSONLDObject added in v0.1.3

func FromJSONLDObject(jsonldObject map[string]interface{}) Document

FromJSONLDObject creates an instance of Document from json ld object.

func (Document) Bytes

func (doc Document) Bytes() ([]byte, error)

Bytes returns byte representation of did document.

func (Document) Context added in v0.7.0

func (doc Document) Context() []interface{}

Context is the context of document.

func (Document) GetStringValue

func (doc Document) GetStringValue(key string) string

GetStringValue returns string value for specified key or "" if not found or wrong type.

func (Document) ID

func (doc Document) ID() string

ID is document identifier.

func (Document) JSONLdObject

func (doc Document) JSONLdObject() map[string]interface{}

JSONLdObject returns map that represents JSON LD Object.

func (Document) PublicKeys added in v0.1.3

func (doc Document) PublicKeys() []PublicKey

PublicKeys in generic document are used for managing operation keys.

type JWK added in v0.1.3

type JWK map[string]interface{}

JWK represents public key in JWK format.

func NewJWK added in v0.1.3

func NewJWK(jwk map[string]interface{}) JWK

NewJWK creates new JWK.

func (JWK) Crv added in v0.1.3

func (jwk JWK) Crv() string

Crv is curve.

func (JWK) Kty added in v0.1.3

func (jwk JWK) Kty() string

Kty is key type.

func (JWK) Validate added in v0.1.5

func (jwk JWK) Validate() error

Validate will validate JWK properties.

func (JWK) X added in v0.1.3

func (jwk JWK) X() string

X is x.

func (JWK) Y added in v0.1.3

func (jwk JWK) Y() string

Y is y.

type KeyPurpose added in v0.1.5

type KeyPurpose string

KeyPurpose defines key purpose.

type Metadata added in v0.1.5

type Metadata map[string]interface{}

Metadata can contains various metadata such as document metadata and method metadata..

type PublicKey

type PublicKey map[string]interface{}

PublicKey must include id and type properties, and exactly one value property.

func NewPublicKey

func NewPublicKey(pk map[string]interface{}) PublicKey

NewPublicKey creates new public key.

func ParsePublicKeys added in v0.1.3

func ParsePublicKeys(entry interface{}) []PublicKey

ParsePublicKeys is helper function for parsing public keys.

func (PublicKey) Controller

func (pk PublicKey) Controller() string

Controller identifies the entity that controls the corresponding private key.

func (PublicKey) ID

func (pk PublicKey) ID() string

ID is public key ID.

func (PublicKey) JSONLdObject added in v0.1.3

func (pk PublicKey) JSONLdObject() map[string]interface{}

JSONLdObject returns map that represents JSON LD Object.

func (PublicKey) PublicKeyBase58

func (pk PublicKey) PublicKeyBase58() string

PublicKeyBase58 is base58 encoded public key.

func (PublicKey) PublicKeyJwk added in v0.1.3

func (pk PublicKey) PublicKeyJwk() JWK

PublicKeyJwk is value property for JWK.

func (PublicKey) PublicKeyMultibase added in v1.0.0

func (pk PublicKey) PublicKeyMultibase() string

PublicKeyMultibase is multibase public key.

func (PublicKey) Purpose added in v0.1.4

func (pk PublicKey) Purpose() []string

Purpose describes key purpose.

func (PublicKey) Type

func (pk PublicKey) Type() string

Type is public key type.

type ReplaceDocument added in v0.1.4

type ReplaceDocument map[string]interface{}

ReplaceDocument defines replace document data structure.

func ReplaceDocumentFromBytes added in v0.1.4

func ReplaceDocumentFromBytes(data []byte) (ReplaceDocument, error)

ReplaceDocumentFromBytes creates an instance of replace document (for 'replace' patch, may be used for replace action).

func ReplaceDocumentFromJSONLDObject added in v0.1.4

func ReplaceDocumentFromJSONLDObject(jsonldObject map[string]interface{}) ReplaceDocument

ReplaceDocumentFromJSONLDObject creates an instance of ReplaceDocument from json ld object.

func (ReplaceDocument) JSONLdObject added in v0.1.4

func (doc ReplaceDocument) JSONLdObject() map[string]interface{}

JSONLdObject returns map that represents JSON LD Object.

func (ReplaceDocument) PublicKeys added in v0.1.4

func (doc ReplaceDocument) PublicKeys() []PublicKey

PublicKeys returns public keys for replace document.

func (ReplaceDocument) Services added in v0.1.4

func (doc ReplaceDocument) Services() []Service

Services returns services for replace document.

type ResolutionOption added in v1.0.0

type ResolutionOption func(opts *ResolutionOptions)

ResolutionOption is an option for specifying the resolution options for various resolvers.

func WithAdditionalOperations added in v1.0.0

func WithAdditionalOperations(additionalOperations []*operation.AnchoredOperation) ResolutionOption

WithAdditionalOperations sets the additional operations to be used in a Resolve call.

func WithVersionID added in v1.0.0

func WithVersionID(versionID string) ResolutionOption

WithVersionID sets the version ID to be used in a Resolve call.

func WithVersionTime added in v1.0.0

func WithVersionTime(versionTime string) ResolutionOption

WithVersionTime sets the version time to be used in a Resolve call.

type ResolutionOptions added in v1.0.0

type ResolutionOptions struct {
	AdditionalOperations []*operation.AnchoredOperation
	VersionID            string
	VersionTime          string
}

ResolutionOptions represent resolution options.

func GetResolutionOptions added in v1.0.0

func GetResolutionOptions(opts ...ResolutionOption) (ResolutionOptions, error)

GetResolutionOptions returns resolution options.

type ResolutionResult added in v0.1.3

type ResolutionResult struct {
	Context          interface{} `json:"@context"`
	Document         Document    `json:"didDocument"`
	DocumentMetadata Metadata    `json:"didDocumentMetadata,omitempty"`
}

ResolutionResult describes resolution result.

type Service

type Service map[string]interface{}

Service represents any type of service the entity wishes to advertise.

func NewService

func NewService(m map[string]interface{}) Service

NewService creates new service.

func ParseServices added in v0.1.3

func ParseServices(entry interface{}) []Service

ParseServices is utility for parsing array of service endpoints.

func (Service) ID

func (s Service) ID() string

ID is service ID.

func (Service) JSONLdObject added in v0.1.3

func (s Service) JSONLdObject() map[string]interface{}

JSONLdObject returns map that represents JSON LD Object.

func (Service) ServiceEndpoint added in v0.1.4

func (s Service) ServiceEndpoint() interface{}

ServiceEndpoint is service endpoint.

func (Service) Type

func (s Service) Type() string

Type is service type.

Jump to

Keyboard shortcuts

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