types

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	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"
)
View Source
const (
	DID_METHOD    = "cheqd"
	RESOLVER_PATH = "/1.0/identifiers/"
	RESOURCE_PATH = "/resources/"
	SWAGGER_PATH  = "/swagger/"
)

Variables

This section is empty.

Functions

func AddElemToSet added in v1.2.0

func AddElemToSet(set []string, newElement string) []string

func NewInvalidIdentifierError added in v1.3.0

func NewInvalidIdentifierError() error

Types

type Config

type Config struct {
	Networks         []Network
	ResolverListener string
	LogLevel         string
}

func (*Config) MarshalJson

func (c *Config) MarshalJson() (string, error)

func (*Config) MustMarshalJson

func (c *Config) MustMarshalJson() string

type ContentStreamI added in v1.2.0

type ContentStreamI interface {
	AddContext(newProtocol string)
	RemoveContext()
	GetBytes() []byte
}

type ContentType

type ContentType string
const (
	DIDJSON   ContentType = "application/did+json"
	DIDJSONLD ContentType = "application/did+ld+json"
	JSONLD    ContentType = "application/ld+json"
	JSON      ContentType = "application/json"
)

func (ContentType) IsSupported added in v1.2.0

func (cType ContentType) IsSupported() bool

type DereferencedResource

type DereferencedResource struct {
	ResourceURI       string    `` /* 130-byte string literal not displayed */
	CollectionId      string    `json:"resourceCollectionId" example:"55dbc8bf-fba3-4117-855c-1e0dc1d3bb47"`
	ResourceId        string    `json:"resourceId" example:"398cee0a-efac-4643-9f4c-74c48c72a14b"`
	Name              string    `json:"resourceName" example:"Image Resource"`
	ResourceType      string    `json:"resourceType" example:"Image"`
	MediaType         string    `json:"mediaType" example:"image/png"`
	Created           time.Time `json:"created" example:"2021-09-01T12:00:00Z"`
	Checksum          string    `json:"checksum" example:"a95380f460e63ad939541a57aecbfd795fcd37c6d78ee86c885340e33a91b559"`
	PreviousVersionId *string   `json:"previousVersionId" example:"ad7a8442-3531-46eb-a024-53953ec6e4ff"`
	NextVersionId     *string   `json:"nextVersionId" example:"d4829ac7-4566-478c-a408-b44767eddadc"`
}

func NewDereferencedResource added in v1.2.0

func NewDereferencedResource(did string, resource *resource.Metadata) *DereferencedResource

type DereferencedResourceData added in v1.2.0

type DereferencedResourceData []byte

func (*DereferencedResourceData) AddContext added in v1.2.0

func (e *DereferencedResourceData) AddContext(newProtocol string)

func (*DereferencedResourceData) GetBytes added in v1.2.0

func (e *DereferencedResourceData) GetBytes() []byte

func (*DereferencedResourceData) RemoveContext added in v1.2.0

func (e *DereferencedResourceData) RemoveContext()

type DereferencedResourceList added in v1.2.0

type DereferencedResourceList struct {
	Resources []DereferencedResource `json:"linkedResourceMetadata,omitempty"`
}

func NewDereferencedResourceList added in v1.2.0

func NewDereferencedResourceList(did string, protoResources []*resource.Metadata) *DereferencedResourceList

func (*DereferencedResourceList) AddContext added in v1.2.0

func (e *DereferencedResourceList) AddContext(newProtocol string)

func (*DereferencedResourceList) GetBytes added in v1.2.0

func (e *DereferencedResourceList) GetBytes() []byte

func (*DereferencedResourceList) RemoveContext added in v1.2.0

func (e *DereferencedResourceList) RemoveContext()

type DereferencingMetadata

type DereferencingMetadata ResolutionMetadata

func NewDereferencingMetadata

func NewDereferencingMetadata(did string, contentType ContentType, resolutionError string) DereferencingMetadata

type DidDereferencing

type DidDereferencing struct {
	Context               string                   `json:"@context,omitempty" example:"https://w3id.org/did-resolution/v1"`
	DereferencingMetadata DereferencingMetadata    `json:"dereferencingMetadata"`
	ContentStream         ContentStreamI           `json:"contentStream"`
	Metadata              ResolutionDidDocMetadata `json:"contentMetadata"`
}

func (DidDereferencing) GetBytes added in v1.2.0

func (d DidDereferencing) GetBytes() []byte

func (DidDereferencing) GetContentType added in v1.2.0

func (d DidDereferencing) GetContentType() string

type DidDoc added in v1.2.0

type DidDoc struct {
	Context              []string             `json:"@context,omitempty" example:"https://www.w3.org/ns/did/v1"`
	Id                   string               `json:"id,omitempty" example:"did:cheqd:testnet:55dbc8bf-fba3-4117-855c-1e0dc1d3bb47"`
	Controller           []string             `json:"controller,omitempty" example:"did:cheqd:testnet:55dbc8bf-fba3-4117-855c-1e0dc1d3bb47"`
	VerificationMethod   []VerificationMethod `json:"verificationMethod,omitempty"`
	Authentication       []string             `json:"authentication,omitempty" example:"did:cheqd:testnet:55dbc8bf-fba3-4117-855c-1e0dc1d3bb47#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"`
}

func NewDidDoc added in v1.2.0

func NewDidDoc(protoDidDoc did.DidDoc) DidDoc

func (*DidDoc) AddContext added in v1.2.0

func (e *DidDoc) AddContext(newProtocol string)

func (*DidDoc) GetBytes added in v1.2.0

func (e *DidDoc) GetBytes() []byte

func (*DidDoc) RemoveContext added in v1.2.0

func (e *DidDoc) RemoveContext()

type DidProperties

type DidProperties struct {
	DidString        string `json:"didString,omitempty"`
	MethodSpecificId string `json:"methodSpecificId,omitempty"`
	Method           string `json:"method,omitempty"`
}

type DidResolution

type DidResolution struct {
	Context            string                   `json:"@context,omitempty"`
	ResolutionMetadata ResolutionMetadata       `json:"didResolutionMetadata"`
	Did                *DidDoc                  `json:"didDocument"`
	Metadata           ResolutionDidDocMetadata `json:"didDocumentMetadata"`
}

func (DidResolution) GetBytes added in v1.2.0

func (r DidResolution) GetBytes() []byte

func (DidResolution) GetContentType added in v1.2.0

func (r DidResolution) GetContentType() string

type IdentityError added in v1.2.0

type IdentityError struct {
	Code            int
	Message         string
	Internal        error
	Did             string
	ContentType     ContentType
	IsDereferencing bool
}

func NewIdentityError added in v1.2.0

func NewIdentityError(code int, message string, isDereferencing bool, did string, contentType ContentType, err error) *IdentityError

func NewInternalError added in v1.2.0

func NewInternalError(did string, contentType ContentType, err error, isDereferencing bool) *IdentityError

func NewInvalidDIDError added in v1.2.0

func NewInvalidDIDError(did string, contentType ContentType, err error, isDereferencing bool) *IdentityError

func NewInvalidDIDUrlError added in v1.2.0

func NewInvalidDIDUrlError(did string, contentType ContentType, err error, isDereferencing bool) *IdentityError

func NewMethodNotSupportedError added in v1.2.0

func NewMethodNotSupportedError(did string, contentType ContentType, err error, isDereferencing bool) *IdentityError

func NewNotFoundError added in v1.2.0

func NewNotFoundError(did string, contentType ContentType, err error, isDereferencing bool) *IdentityError

func NewRepresentationNotSupportedError added in v1.2.0

func NewRepresentationNotSupportedError(did string, contentType ContentType, err error, isDereferencing bool) *IdentityError

func (*IdentityError) DisplayMessage added in v1.2.0

func (e *IdentityError) DisplayMessage() ResolutionResultI

func (*IdentityError) Error added in v1.2.0

func (he *IdentityError) Error() string

Error makes it compatible with `error` interface.

func (IdentityError) GetDereferencingOutput added in v1.2.0

func (e IdentityError) GetDereferencingOutput() ResolutionResultI

func (IdentityError) GetResolutionOutput added in v1.2.0

func (e IdentityError) GetResolutionOutput() ResolutionResultI

type Network added in v1.2.0

type Network struct {
	Namespace string
	Endpoint  string
	UseTls    bool
	Timeout   time.Duration
}

type RawConfig added in v1.2.0

type RawConfig struct {
	MainnetEndpoint  string `mapstructure:"MAINNET_ENDPOINT"`
	TestnetEndpoint  string `mapstructure:"TESTNET_ENDPOINT"`
	ResolverListener string `mapstructure:"RESOLVER_LISTNER"`
	LogLevel         string `mapstructure:"LOG_LEVEL"`
}

type ResolutionDidDocMetadata added in v1.2.0

type ResolutionDidDocMetadata struct {
	Created     *time.Time             `json:"created,omitempty" example:"2021-09-01T12:00:00Z"`
	Updated     *time.Time             `json:"updated,omitempty" example:"2021-09-10T12:00:00Z"`
	Deactivated bool                   `json:"deactivated,omitempty" example:"false"`
	VersionId   string                 `json:"versionId,omitempty" example:"4979BAF49599FEF0BAD5ED0849FDD708156761EBBC8EBE78D0907F8BECC9CB2E"`
	Resources   []DereferencedResource `json:"linkedResourceMetadata,omitempty"`
}

Changed "Created time.Time" to "Create *time.Time". It needs to skip Created field when is empty.

func NewResolutionDidDocMetadata added in v1.2.0

func NewResolutionDidDocMetadata(did string, metadata did.Metadata, resources []*resource.Metadata) ResolutionDidDocMetadata

func TransformToFragmentMetadata added in v1.2.0

func TransformToFragmentMetadata(metadata ResolutionDidDocMetadata) ResolutionDidDocMetadata

type ResolutionMetadata

type ResolutionMetadata struct {
	ContentType     ContentType   `json:"contentType,omitempty" example:"application/did+ld+json"`
	ResolutionError string        `json:"error,omitempty"`
	Retrieved       string        `json:"retrieved,omitempty" example:"2021-09-01T12:00:00Z"`
	DidProperties   DidProperties `json:"did,omitempty"`
}

func NewResolutionMetadata

func NewResolutionMetadata(didUrl string, contentType ContentType, resolutionError string) ResolutionMetadata

type ResolutionResultI added in v1.2.0

type ResolutionResultI interface {
	GetContentType() string
	GetBytes() []byte
}

type Service added in v1.2.0

type Service struct {
	Context         []string `json:"@context,omitempty"`
	Id              string   `json:"id,omitempty" example:"did:cheqd:testnet:55dbc8bf-fba3-4117-855c-1e0dc1d3bb47#service-1"`
	Type            string   `json:"type,omitempty" example:"did-communication"`
	ServiceEndpoint []string `json:"serviceEndpoint,omitempty" example:"https://example.com/endpoint/8377464"`
}

func NewService added in v1.2.0

func NewService(protoService *did.Service) *Service

func (*Service) AddContext added in v1.2.0

func (e *Service) AddContext(newProtocol string)

func (*Service) GetBytes added in v1.2.0

func (e *Service) GetBytes() []byte

func (*Service) RemoveContext added in v1.2.0

func (e *Service) RemoveContext()

type VerificationMaterial added in v1.3.0

type VerificationMaterial interface{}

type VerificationMethod added in v1.2.0

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"`
}

func NewVerificationMethod added in v1.2.0

func NewVerificationMethod(protoVerificationMethod *did.VerificationMethod) *VerificationMethod

func (*VerificationMethod) AddContext added in v1.2.0

func (e *VerificationMethod) AddContext(newProtocol string)

func (*VerificationMethod) GetBytes added in v1.2.0

func (e *VerificationMethod) GetBytes() []byte

func (*VerificationMethod) RemoveContext added in v1.2.0

func (e *VerificationMethod) RemoveContext()

Jump to

Keyboard shortcuts

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