didDocumentUtils

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckDidDataAndSintax

func CheckDidDataAndSintax(didData *DidData, didBase, resourceType, identifierKind string) string

func CheckDidSintax

func CheckDidSintax(did, didBase, resourceType, identifierKind string) string

func CreateDidPrefix

func CreateDidPrefix(didBase, resourceType, identifierKind string) string

Types

type DidData

type DidData struct {
	DidDocument           DidDoc              `json:"didDocument,omitempty" bson:"didDocument,omitempty"`
	DidDocumentMetadata   DidDocumentMetadata `json:"didDocumentMetadata,omitempty" bson:"didDocumentMetadata,omitempty"`
	DidResolutionMetadata DidDetailsAudit     `json:"didResolutionMetadata,omitempty" bson:"didResolutionMetadata,omitempty"`
}

DidData is the DID resolution data: https://w3c-ccg.github.io/did-resolution/ EBSIv2 DID resolution only returns the DID Document but not the metadata: https://ec.europa.eu/digital-building-blocks/wikis/display/EBSIDOC/Verifiable+Credential+API+and+Library

type DidDetailsAudit

type DidDetailsAudit struct {
	// JWKSet      jwkUtils.JWKeySet `json:"jwks,omitempty" bson:"jwks,omitempty"`
	Active      bool    `json:"active,omitempty" bson:"active,omitempty"`
	Hl          string  `json:"hl,omitempty" bson:"hl,omitempty"`                   // hash
	VersionId   string  `json:"versionId,omitempty" bson:"versionId,omitempty"`     // identifies a specific version of a DID document to be resolved (the version ID could be sequential, or a UUID, or method-specific).
	VersionTime string  `json:"versionTime,omitempty" bson:"versionTime,omitempty"` // identifies a certain version timestamp of a DID document to be resolved. The DID document was valid for a DID at a certain time. This datetime value MUST be normalized to UTC 00:00:00 and without sub-second decimal precision.
	Txn         *string `json:"txn,omitempty" bson:"txn,omitempty"`
	TxTime      *string `json:"txTime,omitempty" bson:"txTime,omitempty"`
}

DidDetailsAudit contains additional data on the blockchain (can be duplicated on the local DB or not). Some DID parameters are completely independent of any specific DID method and function the same way for all DIDs. Other DID parameters are not supported by all DID methods: https://www.w3.org/TR/did-core/#did-parameters

  • Txn and TxTime are non-standard parameters.
  • Hl (HashLink) example: "did:example:123?hl=zQmWvQxTqbG2Z9HPJgG57jjwR154cKhbtJenbyYTWkjgF3e"
  • VersionTime: identifies a certain version timestamp of a DID document to be resolved. The DID document was valid for a DID at a certain time. This datetime value MUST be normalized to UTC 00:00:00 (seconds, without sub-second decimal precision). Example for VersionTime parameter request: "did:example:123?versionTime=2016-10-17T02:41:00Z"

type DidDoc

type DidDoc struct {
	AlsoKnownAs          *[]string             `json:"alsoKnownAs,omitempty" bson:"alsoKnownAs,omitempty"`
	Context              []string              `json:"@context,omitempty" bson:"@context,omitempty"`
	Controller           *[]string             `json:"controller,omitempty" bson:"controller,omitempty"`
	ID                   string                `json:"id,omitempty" bson:"id,omitempty"`
	VerificationMethod   []VerificationMethod  `json:"verificationMethod,omitempty" bson:"verificationMethod,omitempty"`
	Service              []Service             `json:"service,omitempty" bson:"service,omitempty"`
	Authentication       *[]VerificationMethod `json:"authentication,omitempty" bson:"authentication,omitempty"`
	AssertionMethod      *[]VerificationMethod `json:"assertionMethod,omitempty" bson:"assertionMethod,omitempty"`
	CapabilityDelegation *[]VerificationMethod `json:"capabilityDelegation,omitempty" bson:"capabilityDelegation,omitempty"`
	CapabilityInvocation *[]VerificationMethod `json:"capabilityInvocation,omitempty" bson:"capabilityInvocation,omitempty"`
	KeyAgreement         *[]VerificationMethod `json:"keyAgreement,omitempty" bson:"keyAgreement,omitempty"`
	Created              *time.Time            `json:"created,omitempty" bson:"created,omitempty"`
	Updated              *time.Time            `json:"updated,omitempty" bson:"updated,omitempty"`
	Proof                []ProofGo             `json:"proof,omitempty" bson:"proof,omitempty"`
}

DidDoc DID Document definition: https://www.w3.org/TR/did-core/#core-properties The Controller property is OPTIONAL. If present, the value MUST be a string or a set of strings that conform to the rules in § 3.1 DID Syntax.

type DidDocumentMetadata

type DidDocumentMetadata struct {
	Deactivated bool    `json:"deactivated,omitempty" bson:"deactivated,omitempty"` // deactivation data will be the updated date.
	Created     string  `json:"created,omitempty" bson:"created,omitempty"`
	Updated     *string `json:"updated,omitempty" bson:"updated,omitempty"`
	VersionId   *string `json:"versionId,omitempty" bson:"versionId,omitempty"`
}

DidDocumentMetadata contains additional data on the local DB

type DidLocalStorage

type DidLocalStorage struct {
	Attributes DidData `json:"attributes,omitempty" bson:"attributes,omitempty"`
}

DidLocalStorage uses the JSON API structure where Attributes object represents some of the resource’s data. (see https://jsonapi.org/format/#document-resource-objects)

type ProofGo

type ProofGo struct {
	Type         string
	Created      *time.Time
	Creator      string
	ProofValue   []byte
	Domain       string
	Nonce        []byte
	ProofPurpose string
	// contains filtered or unexported fields
}

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

type Service

type Service struct {
	ID              string                 `json:"id"` // profile-code-authorization
	Type            string                 `json:"type"`
	Priority        uint                   `json:"priority,omitempty"`
	RecipientKeys   []string               `json:"recipientKeys,omitempty"`
	RoutingKeys     []string               `json:"routingKeys,omitempty"`
	ServiceEndpoint string                 `json:"serviceEndpoint"`
	Accept          []string               `json:"accept,omitempty"`
	Properties      map[string]interface{} `json:"properties,omitempty"`
}

Service DID doc service.

type VerificationMethod

type VerificationMethod struct {
	ID           string        `json:"id,omitempty" bson:"id,omitempty"`
	Type         string        `json:"type,omitempty" bson:"type,omitempty"`
	Controller   string        `json:"controller,omitempty" bson:"controller,omitempty"`
	PublicKeyJwk *jwkUtils.JWK `json:"publicKeyJwk,omitempty" bson:"publicKeyJwk,omitempty"`
}

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.

type VerificationRelationship

type VerificationRelationship int

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

const (
	// VerificationRelationshipGeneral is a special case of verification relationship: when a verification method
	// defined in Verification is not used by any Verification.
	VerificationRelationshipGeneral VerificationRelationship = iota

	// Authentication defines verification relationship.
	Authentication

	// AssertionMethod defines verification relationship.
	AssertionMethod

	// CapabilityDelegation defines verification relationship.
	CapabilityDelegation

	// CapabilityInvocation defines verification relationship.
	CapabilityInvocation

	// KeyAgreement defines verification relationship.
	KeyAgreement

	TypeVerificationJsonWebKey2020 = "JsonWebKey2020"
)

Jump to

Keyboard shortcuts

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