Documentation ¶
Index ¶
- Constants
- func IsAgreementKey(usages []string) bool
- func IsAssertionKey(usages []string) bool
- func IsAuthenticationKey(usages []string) bool
- func IsDelegationKey(usages []string) bool
- func IsGeneralKey(usages []string) bool
- func IsInvocationKey(usages []string) bool
- func IsOperationsKey(usages []string) bool
- func StringArray(entry interface{}) []string
- func ValidateID(id string) error
- func ValidateJWK(jwk JWK) error
- func ValidateOperationsKey(pubKey PublicKey) error
- func ValidatePublicKeys(pubKeys []PublicKey) error
- func ValidateServices(services []Service) error
- type DIDDocument
- func (doc DIDDocument) AgreementKey() []interface{}
- func (doc DIDDocument) AssertionMethod() []interface{}
- func (doc DIDDocument) Authentication() []interface{}
- func (doc DIDDocument) Context() []string
- func (doc DIDDocument) DelegationKey() []interface{}
- func (doc DIDDocument) ID() string
- func (doc DIDDocument) InvocationKey() []interface{}
- func (doc DIDDocument) JSONLdObject() map[string]interface{}
- func (doc DIDDocument) PublicKeys() []PublicKey
- func (doc DIDDocument) Services() []Service
- type Document
- type JWK
- type MethodMetadata
- type PublicKey
- func (pk PublicKey) Controller() string
- func (pk PublicKey) ID() string
- func (pk PublicKey) JSONLdObject() map[string]interface{}
- func (pk PublicKey) JWK() JWK
- func (pk PublicKey) PublicKeyBase58() string
- func (pk PublicKey) PublicKeyJwk() JWK
- func (pk PublicKey) Type() string
- func (pk PublicKey) Usage() []string
- type ResolutionResult
- type Service
Constants ¶
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" )
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" )
const (
// Ed25519VerificationKey2018 requires special handling (convert to base58)
Ed25519VerificationKey2018 = "Ed25519VerificationKey2018"
)
const IDProperty = "id"
IDProperty describes id key
const ServiceEndpointProperty = "serviceEndpoint"
ServiceEndpointProperty defines service endpoint
Variables ¶
This section is empty.
Functions ¶
func IsAgreementKey ¶ added in v0.1.3
IsAgreementKey returns true if key is an agreement key
func IsAssertionKey ¶ added in v0.1.3
IsAssertionKey returns true if key is an assertion key
func IsAuthenticationKey ¶ added in v0.1.3
IsAuthenticationKey returns true if key is an authentication key
func IsDelegationKey ¶ added in v0.1.3
IsDelegationKey returns true if key is an delegation key
func IsGeneralKey ¶ added in v0.1.3
IsGeneralKey returns true if key is a general key
func IsInvocationKey ¶ added in v0.1.3
IsInvocationKey returns true if key is an invocation key
func IsOperationsKey ¶ added in v0.1.3
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 ValidateOperationsKey ¶ added in v0.1.3
ValidateOperationsKey validates operation key
func ValidatePublicKeys ¶ added in v0.1.3
ValidatePublicKeys validates public keys
func ValidateServices ¶ added in v0.1.3
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 FromJSONLDObject ¶ added in v0.1.3
FromJSONLDObject creates an instance of Document from json ld object
func (Document) GetStringValue ¶
GetStringValue returns string value for specified key or "" if not found or wrong type
func (Document) JSONLdObject ¶
JSONLdObject returns map that represents JSON LD Object
func (Document) PublicKeys ¶ added in v0.1.3
PublicKeys in generic document are used for managing operation keys
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 ¶
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 ¶
Controller identifies the entity that controls the corresponding private key.
func (PublicKey) JSONLdObject ¶ added in v0.1.3
JSONLdObject returns map that represents JSON LD Object
func (PublicKey) PublicKeyBase58 ¶
PublicKeyBase58 is base58 encoded public key
func (PublicKey) PublicKeyJwk ¶ added in v0.1.3
PublicKeyJwk is value property for JWK
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 ParseServices ¶ added in v0.1.3
func ParseServices(entry interface{}) []Service
ParseServices is utility for parsing array of service endpoints
func (Service) JSONLdObject ¶ added in v0.1.3
JSONLdObject returns map that represents JSON LD Object