models

package
v0.0.0-...-1a43f7c Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 5 Imported by: 3

Documentation

Overview

Package models implement models

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheControl

type CacheControl struct {
	MaxAge uint32 `json:"maxAge"`
}

CacheControl holds cache settings for this file,

indicating to the recipient how long until they should check for a new version of the file.

type Consortium

type Consortium struct {
	// Domain is the domain name of the consortium
	Domain string `json:"domain,omitempty"`
	// Policy contains the consortium policy configuration
	Policy ConsortiumPolicy `json:"policy"`
	// Members is a list containing references to the stakeholders on this consortium
	Members []*StakeholderListElement `json:"members"`
	// Previous contains a hashlink to the previous version of this file. Optional.
	Previous string `json:"previous,omitempty"`
}

Consortium holds the configuration for a consortium, which is signed by stakeholders.

type ConsortiumFileData

type ConsortiumFileData struct {
	Config *Consortium
	JWS    *jose.JSONWebSignature
}

ConsortiumFileData holds the data within a consortium config file.

func ParseConsortium

func ParseConsortium(data []byte) (*ConsortiumFileData, error)

ParseConsortium parses the contents of a consortium file into a ConsortiumFileData object.

func (ConsortiumFileData) CacheLifetime

func (c ConsortiumFileData) CacheLifetime() (time.Duration, error)

CacheLifetime returns the cache lifetime of the consortium file before it needs to be checked for an update.

type ConsortiumPolicy

type ConsortiumPolicy struct {
	Cache      CacheControl `json:"cache"`
	NumQueries int          `json:"numQueries"`
}

ConsortiumPolicy holds consortium policy configuration.

type DIDConfiguration

type DIDConfiguration struct {
	Entries []DomainLinkageAssertion `json:"entries"`
}

DIDConfiguration asserts DID ownership over web domains using domain linkage assertions. Implements https://identity.foundation/specs/did-configuration/

type DomainLinkageAssertion

type DomainLinkageAssertion struct {
	DID string `json:"did,omitempty"`
	JWT string `json:"jwt,omitempty"`
}

DomainLinkageAssertion asserts a DID's ownership over a domain.

type DomainLinkageAssertionClaims

type DomainLinkageAssertionClaims struct {
	ISS    string `json:"iss"`
	Domain string `json:"domain"`
	Exp    int64  `json:"exp,omitempty"`
}

DomainLinkageAssertionClaims holds the JWT claims of a Domain Linkage Assertion.

type Endpoint

type Endpoint struct {
	URL    string
	Domain string
}

Endpoint include info about endpoint.

type PublicKey

type PublicKey struct {
	// ID  verification public key DID URL
	ID string `json:"id,omitempty"`
	// JWK verification public key in JWK format}
	JWK json.RawMessage `json:"jwk,omitempty"`
}

PublicKey is the verification key DID URL and public key.

type SidetreeConfig

type SidetreeConfig struct {
	MultiHashAlgorithm uint `json:"multihashAlgorithm"`
	MaxAge             uint `json:"-"`
}

SidetreeConfig sidetree configuration.

func (SidetreeConfig) CacheLifetime

func (c SidetreeConfig) CacheLifetime() (time.Duration, error)

CacheLifetime returns the cache lifetime of the sidetree config file before it needs to be checked for an update.

type Stakeholder

type Stakeholder struct {
	// Domain is the domain name of the stakeholder organisation,
	//   where the primary copy of the stakeholder config can be found
	Domain string `json:"domain,omitempty"`
	// DID is the DID of this stakeholder
	DID string `json:"did,omitempty"`
	// Policy contains stakeholder-specific configuration settings
	Policy StakeholderSettings `json:"policy"`
	// Endpoints is a list of sidetree endpoints owned by this stakeholder organization
	Endpoints []string `json:"endpoints"`
	// Previous is a hashlink to the previous version of this file
	Previous string `json:"previous,omitempty"`
}

Stakeholder holds the configuration for a stakeholder.

type StakeholderFileData

type StakeholderFileData struct {
	Config *Stakeholder
	JWS    *jose.JSONWebSignature
}

StakeholderFileData holds a stakeholder config file, with the original JWS and the unpacked payload.

func ParseStakeholder

func ParseStakeholder(data []byte) (*StakeholderFileData, error)

ParseStakeholder parses a stakeholder config within a JWS.

func (StakeholderFileData) CacheLifetime

func (s StakeholderFileData) CacheLifetime() (time.Duration, error)

CacheLifetime returns the cache lifetime of the stakeholder file before it needs to be checked for an update.

type StakeholderListElement

type StakeholderListElement struct {
	// Domain is the domain name of the stakeholder
	Domain string `json:"domain,omitempty"`
	// DID is the DID of the stakeholder
	DID string `json:"did,omitempty"`
	// PublicKey is the verification key DID URL and public key
	PublicKey PublicKey `json:"publicKey,omitempty"`
}

StakeholderListElement holds the domain and DID of a stakeholder within the consortium.

type StakeholderSettings

type StakeholderSettings struct {
	Cache CacheControl `json:"cache"`
}

StakeholderSettings holds the stakeholder settings.

Jump to

Keyboard shortcuts

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