datastore

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent struct {
	ID                    string
	Name                  string
	EndorsableSchemaNames []string
	PID                   string
	HasPublicDID          bool
	PublicDID             *DID
}

func (*Agent) CanIssue

func (r *Agent) CanIssue(schemaID string) bool

type AgentConnection

type AgentConnection struct {
	TheirLabel   string
	MyLabel      string
	AgentName    string
	TheirDID     string
	MyDID        string
	ConnectionID string
	ExternalID   string
}

type AgentCriteria

type AgentCriteria struct {
	Start, PageSize int
	Name            string
}

type AgentList

type AgentList struct {
	Count  int
	Agents []*Agent
}

type Attribute

type Attribute struct {
	Name string
	Type int32
}

type Credential

type Credential struct {
	ID string `json:"@id,omitempty"`
	// Description is an optional human-readable description of the content.
	Description string `json:"description,omitempty"`
	// MimeType describes the MIME type of the attached content. Optional but recommended.
	MimeType string `json:"mime-type,omitempty"`
	// LastModTime is a hint about when the content in this attachment was last modified.
	LastModTime time.Time `json:"lastmod_time,omitempty"`
	Data        []byte    `json:"data"`
}

type Criteria

type Criteria map[string]interface{}

type DID

type DID struct {
	ID       string
	DID      *identifiers.DID
	OwnerID  string
	KeyPair  *KeyPair
	Endpoint string
	Public   bool
}

type DIDCriteria

type DIDCriteria struct {
	Start, PageSize int
}

type DIDList

type DIDList struct {
	Count int
	DIDs  []*DID
}

type DIDs

type DIDs []*DID

type IssuedCredential

type IssuedCredential struct {
	ID                string
	AgentName         string
	MyDID             string
	TheirDID          string
	ProtocolID        string
	SchemaName        string
	RegistryOfferID   string
	ExternalSubjectID string
	Offer             *Offer
	Credential        *Credential
	SystemState       string
}

type KeyPair

type KeyPair struct {
	ID        string
	PublicKey string
}

func (*KeyPair) RawPublicKey

func (r *KeyPair) RawPublicKey() []byte

type Offer

type Offer struct {
	Comment string
	Type    string
	Preview []icprotocol.Attribute
	Data    []byte
}

type Presentation

type Presentation struct {
	TheirDID string
	MyDID    string
	Format   string
	Data     []byte
}

type PresentationRequest

type PresentationRequest struct {
	AgentID               string
	SchemaID              string
	ExternalID            string
	PresentationRequestID string
	Data                  []byte
}

type Provider

type Provider interface {
	// Open opens a store
	Open() (Store, error)

	// Close closes a store
	Close() error
}

Provider storage provider interface

type Schema

type Schema struct {
	ID               string
	Format           string
	Type             string
	Name             string
	Version          string
	ExternalSchemaID string
	Context          []string
	Attributes       []*Attribute
}

type SchemaCriteria

type SchemaCriteria struct {
	Start, PageSize int
	Name            string
}

type SchemaList

type SchemaList struct {
	Count  int
	Schema []*Schema
}

type Schemas

type Schemas []*Schema

type Store

type Store interface {
	// InsertDID add DID to store
	InsertDID(d *DID) error
	// ListDIDs query DIDs
	GetDID(id string) (*DID, error)
	// SetPublicDID update single DID to public, unset remaining
	ListDIDs(c *DIDCriteria) (*DIDList, error)
	// SetPublicDID update single DID to public, unset remaining
	SetPublicDID(DID *DID) error
	// GetPublicDID get public DID
	GetPublicDID() (*DID, error)

	// InsertSchema add Schema to store
	InsertSchema(s *Schema) (string, error)
	// ListSchema query schemas
	ListSchema(c *SchemaCriteria) (*SchemaList, error)
	// GetSchema return single Schema
	GetSchema(name string) (*Schema, error)
	// GetSchema return single Schema
	GetSchemaByExternalID(externalID string) (*Schema, error)
	// DeleteSchema delete single schema
	DeleteSchema(name string) error
	// UpdateSchema update single schema
	UpdateSchema(s *Schema) error

	// InsertCredential add Crednetial to store
	InsertCredential(c *IssuedCredential) (string, error)
	//FindCredentialByOffer finds credential in offer state
	FindCredentialByProtocolID(offerID string) (*IssuedCredential, error)
	// Update Credentia updates the credential
	UpdateCredential(c *IssuedCredential) error
	//Delete offer deletes the offer identifed by the offerID (thid of message)
	DeleteCredentialByOffer(offerID string) error

	// InsertAgent add agent to store
	InsertAgent(a *Agent) (string, error)
	// ListAgent query agents
	ListAgent(c *AgentCriteria) (*AgentList, error)
	// GetAgent return single agent
	GetAgent(id string) (*Agent, error)
	// GetAgentByIPublicDID return single agent
	GetAgentByPublicDID(DID string) (*Agent, error)
	// DeleteAgent delete single agent
	DeleteAgent(name string) error
	// UpdateAgent delete single agent
	UpdateAgent(a *Agent) error
	// InsertAgentConnection associates an agent with a connection
	InsertAgentConnection(a *Agent, externalID string, conn *didexchange.Connection) error
	// ListAgentConnections returns all the connections for an agent
	ListAgentConnections(a *Agent) ([]*AgentConnection, error)
	// GetAgentConnection return single connection between an agent and an external subject
	GetAgentConnection(a *Agent, externalID string) (*AgentConnection, error)
	// DeleteAgentConnection deletes a connection for an agent
	DeleteAgentConnection(a *Agent, externalID string) error

	// GetAgentConnectionForDID return single connection between an agent and an external subject
	GetAgentConnectionForDID(a *Agent, theirDID string) (*AgentConnection, error)

	ListWebhooks(typ string) ([]*Webhook, error)

	AddWebhook(hook *Webhook) error

	DeleteWebhook(typ string) error

	//InsertPresentationRequest inserts the presentation request
	InsertPresentationRequest(pr *PresentationRequest) (string, error)

	// InsertPresentation inserts the presentation
	InsertPresentation(p *Presentation) (string, error)

	// GetPresentationRequest retrieves the presentation request by ID
	GetPresentationRequest(ID string) (*PresentationRequest, error)
}

type Webhook

type Webhook struct {
	Type string
	URL  string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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