did

package
v0.0.0-...-57c6170 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NameSpace for did store.
	NameSpace = "didstore"
)
View Source
const StoreName = "didconnection"

StoreName DID connection store name.

Variables

View Source
var ErrNotFound = errors.New("did not found under given key")

ErrNotFound signals that the entry for the given DID and key is not present in the store.

Functions

This section is empty.

Types

type ConnectionStore

type ConnectionStore interface {
	GetDID(key string) (string, error)
	SaveDID(did string, keys ...string) error
	SaveDIDFromDoc(doc *diddoc.Doc) error
	SaveDIDByResolving(did string, keys ...string) error
}

ConnectionStore provides interface for storing and retrieving DIDs.

type ConnectionStoreImpl

type ConnectionStoreImpl struct {
	// contains filtered or unexported fields
}

ConnectionStoreImpl stores DIDs indexed by key.

func NewConnectionStore

func NewConnectionStore(ctx connectionProvider) (*ConnectionStoreImpl, error)

NewConnectionStore returns a new ConnectionStore backed by provided storage and VDR.

func (*ConnectionStoreImpl) GetDID

func (c *ConnectionStoreImpl) GetDID(key string) (string, error)

GetDID gets the DID stored under the given key.

func (*ConnectionStoreImpl) SaveDID

func (c *ConnectionStoreImpl) SaveDID(did string, keys ...string) error

SaveDID saves a DID, indexed using the given public keys.

func (*ConnectionStoreImpl) SaveDIDByResolving

func (c *ConnectionStoreImpl) SaveDIDByResolving(did string, keys ...string) error

SaveDIDByResolving resolves a DID using the VDR then saves the map from keys -> did

keys: fallback keys in case the DID can't be resolved

func (*ConnectionStoreImpl) SaveDIDFromDoc

func (c *ConnectionStoreImpl) SaveDIDFromDoc(doc *diddoc.Doc) error

SaveDIDFromDoc saves a map from a did doc's keys to the did.

type Record

type Record struct {
	Name string `json:"name,omitempty"`
	ID   string `json:"id,omitempty"`
}

Record model.

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store stores did doc.

func New

func New(ctx provider) (*Store, error)

New returns a new did store.

func (*Store) GetDID

func (s *Store) GetDID(id string) (*did.Doc, error)

GetDID retrieves a didDoc based on ID.

func (*Store) GetDIDByName

func (s *Store) GetDIDByName(name string) (string, error)

GetDIDByName retrieves did id based on name.

func (*Store) GetDIDRecords

func (s *Store) GetDIDRecords() []*Record

GetDIDRecords retrieves the didDoc records containing name and didID.

func (*Store) SaveDID

func (s *Store) SaveDID(name string, didDoc *did.Doc) error

SaveDID saves a did doc.

Jump to

Keyboard shortcuts

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