document

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2020 License: Apache-2.0 Imports: 9 Imported by: 44

Documentation

Index

Constants

View Source
const (

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

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

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

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

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

	// AgreementKeyProperty defines key for agreement key property
	AgreementKeyProperty = "agreementKey"

	// 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"

	// UsageProperty describes key usage property
	UsageProperty = "usage"

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

	// JwkProperty describes internal public key JWK
	JwkProperty = "jwk"

	// TypeProperty describes type
	TypeProperty = "type"

	// PublicKeyBase58Property defines base 58 encoding for public key
	PublicKeyBase58Property = "publicKeyBase58"
)
View Source
const (

	// Ed25519VerificationKey2018 requires special handling (convert to base58)
	Ed25519VerificationKey2018 = "Ed25519VerificationKey2018"
)
View Source
const IDProperty = "id"

IDProperty describes id key

View Source
const ServiceEndpointProperty = "serviceEndpoint"

ServiceEndpointProperty defines service endpoint

Variables

This section is empty.

Functions

func IsAgreementKey added in v0.1.3

func IsAgreementKey(usages []string) bool

IsAgreementKey returns true if key is an agreement key

func IsAssertionKey added in v0.1.3

func IsAssertionKey(usages []string) bool

IsAssertionKey returns true if key is an assertion key

func IsAuthenticationKey added in v0.1.3

func IsAuthenticationKey(usages []string) bool

IsAuthenticationKey returns true if key is an authentication key

func IsDelegationKey added in v0.1.3

func IsDelegationKey(usages []string) bool

IsDelegationKey returns true if key is an delegation key

func IsGeneralKey added in v0.1.3

func IsGeneralKey(usages []string) bool

IsGeneralKey returns true if key is a general key

func IsInvocationKey added in v0.1.3

func IsInvocationKey(usages []string) bool

IsInvocationKey returns true if key is an invocation key

func IsOperationsKey added in v0.1.3

func IsOperationsKey(usages []string) bool

IsOperationsKey returns true if key is an operations key

func StringArray added in v0.1.3

func StringArray(entry interface{}) []string

StringArray is utility function to return string array from interface

func ValidateID added in v0.1.3

func ValidateID(id string) error

ValidateID validates id

func ValidateJWK added in v0.1.3

func ValidateJWK(jwk JWK) error

ValidateJWK validates JWK

func ValidateOperationsKey added in v0.1.3

func ValidateOperationsKey(pubKey PublicKey) error

ValidateOperationsKey validates operation key

func ValidatePublicKeys added in v0.1.3

func ValidatePublicKeys(pubKeys []PublicKey) error

ValidatePublicKeys validates public keys

func ValidateServices added in v0.1.3

func ValidateServices(services []Service) error

ValidateServices validates services

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) AgreementKey added in v0.1.3

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

AgreementKey returns agreement method array (mixture of strings and objects)

func (DIDDocument) AssertionMethod added in v0.1.3

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

AssertionMethod returns assertion method array (mixture of strings and objects)

func (DIDDocument) Authentication added in v0.1.3

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

Authentication returns authentication array (mixture of strings and objects)

func (DIDDocument) Context

func (doc DIDDocument) Context() []string

Context is the context of did document

func (DIDDocument) DelegationKey added in v0.1.3

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

DelegationKey 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) InvocationKey added in v0.1.3

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

InvocationKey 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

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) 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) 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 MethodMetadata added in v0.1.3

type MethodMetadata struct {
	OperationPublicKeys []PublicKey `json:"operationPublicKeys,omitempty"`
	RecoveryKey         *jws.JWK    `json:"recoveryKey,omitempty"`
	Published           bool        `json:"published"`
}

MethodMetadata contains document 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) JWK added in v0.1.3

func (pk PublicKey) JWK() JWK

JWK is value property of internal keys

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) Type

func (pk PublicKey) Type() string

Type is public key type

func (PublicKey) Usage added in v0.1.3

func (pk PublicKey) Usage() []string

Usage describes key usage

type ResolutionResult added in v0.1.3

type ResolutionResult struct {
	Context        string         `json:"@context"`
	Document       Document       `json:"didDocument"`
	MethodMetadata MethodMetadata `json:"methodMetadata"`
}

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) Endpoint

func (s Service) Endpoint() string

Endpoint is service endpoint

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) 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