types

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2023 License: GPL-3.0 Imports: 2 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DIDJSON   ContentType = "application/did+json"
	DIDJSONLD ContentType = "application/did+ld+json"
	JSONLD    ContentType = "application/ld+json"
	JSON      ContentType = "application/json"

	DIDSchemaJSONLD                  = "https://www.w3.org/ns/did/v1"
	ResolutionSchemaJSONLD           = "https://w3id.org/did-resolution/v1"
	Ed25519VerificationKey2020JSONLD = "https://w3id.org/security/suites/ed25519-2020/v1"
	Ed25519VerificationKey2018JSONLD = "https://w3id.org/security/suites/ed25519-2018/v1"
	JsonWebKey2020JSONLD             = "https://w3id.org/security/suites/jws-2020/v1"
)

nolint

Variables

View Source
var (
	// ErrUnauthorized throws when lack of permissions
	ErrUnauthorized = errors.New("unauthorized")

	// ErrUnauthorizedNoSignature throws when request has not signature field
	ErrUnauthorizedNoSignature = errors.New("unauthorized, no signature")
)

Functions

This section is empty.

Types

type ContentType

type ContentType string

ContentType supported content types

type DIDDocument

type DIDDocument struct {
	Context              []string                `json:"@context,omitempty" example:"https://www.w3.org/ns/did/v1"`
	ID                   string                  `json:"id,omitempty" example:"did:obada:123"`
	Controller           []string                `json:"controller,omitempty" example:"did:obada:123"`
	VerificationMethod   []VerificationMethod    `json:"verificationMethod,omitempty"`
	Authentication       []string                `json:"authentication,omitempty" example:"did:obada:123#key-1"`
	AssertionMethod      []string                `json:"assertionMethod,omitempty"`
	CapabilityInvocation []string                `json:"capabilityInvocation,omitempty"`
	CapabilityDelegation []string                `json:"capability_delegation,omitempty"`
	KeyAgreement         []string                `json:"keyAgreement,omitempty"`
	Service              []Service               `json:"service,omitempty"`
	AlsoKnownAs          []string                `json:"alsoKnownAs,omitempty"`
	Metadata             Metadata                `json:"metadata,omitempty"`
	MetadataHistory      asset.DataArrayVersions `json:"-"`
}

DIDDocument structure that expresses the DID Document

func NewDIDDoc

func NewDIDDoc() DIDDocument

NewDIDDoc creates an empty DID Document

type Metadata

type Metadata struct {
	VersionID   int            `json:"versionID"`
	VersionHash string         `json:"versionHash"`
	RootHash    string         `json:"rootHash"`
	Objects     []asset.Object `json:"objects"`
}

Metadata actually represent asset objects (no formal spec yet)

type RegisterDID

type RegisterDID struct {
	DID                string               `json:"did"`
	VerificationMethod []VerificationMethod `json:"verificationMethod,omitempty"`
	Authentication     []string             `json:"authentication,omitempty"`
	Service            []Service            `json:"service,omitempty"`
}

RegisterDID describes payload for new DID registration

type SaveMetadata

type SaveMetadata struct {
	Objects   []asset.Object `json:"objects"`
	Signature string         `json:"signature"`
}

SaveMetadata payload for new DID saving metadata

type Service

type Service struct {
	Context         []string `json:"@context,omitempty"`
	ID              string   `json:"id,omitempty" example:"did:obada:123#service-1"`
	Type            string   `json:"type,omitempty" example:"did-communication"`
	ServiceEndpoint []string `json:"serviceEndpoint,omitempty" example:"https://www.tradeloop.com/usn/125"`
}

Service structure that expresses the Service

type VerificationMethod

type VerificationMethod struct {
	Context            []string    `json:"@context,omitempty"`
	ID                 string      `json:"id,omitempty"`
	Type               string      `json:"type,omitempty"`
	Controller         string      `json:"controller,omitempty"`
	PublicKeyJwk       interface{} `json:"publicKeyJwk,omitempty"`
	PublicKeyMultibase string      `json:"publicKeyMultibase,omitempty"`
	PublicKeyBase58    string      `json:"publicKeyBase58,omitempty"`
}

VerificationMethod structure that expresses the Verification Method

Jump to

Keyboard shortcuts

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