storage

package
v1.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAccountExists        = errors.New("account exists")
	ErrAccountNotFound      = errors.New("account not found")
	ErrDIDExists            = errors.New("DID document exists")
	ErrDIDNotFound          = errors.New("DID document not found")
	ErrIdentityNotFound     = errors.New("identity not found")
	ErrLockerNotFound       = errors.New("locker not found")
	ErrAccessKeyNotFound    = errors.New("access key not found")
	ErrPropertyNotFound     = errors.New("property not found")
	ErrRecoveryCodeNotFound = errors.New("recovery code not found")
)

Functions

func Register

func Register(storageType string, ctor IdentityBackendConstructor)

Types

type AccountBackend

type AccountBackend interface {
	CreateAccount(acct *account.Account) error
	UpdateAccount(acct *account.Account) error
	GetAccount(id string) (*account.Account, error)
	DeleteAccount(id string) error
	ListAccounts(parentAccountID, stateFilter string) ([]*account.Account, error)

	HasAccountAccess(accountID, targetAccountID string) (bool, error)

	ListAccessKeys(accountID string) ([]*model.AccessKey, error)
	StoreAccessKey(accessKey *model.AccessKey) error
	GetAccessKey(keyID string) (*model.AccessKey, error)
	DeleteAccessKey(keyID string) error

	StoreIdentity(accountID string, idy *account.DataEnvelope) error
	GetIdentity(accountID string, hash string) (*account.DataEnvelope, error)
	ListIdentities(accountID string, lvl model.AccessLevel) ([]*account.DataEnvelope, error)

	StoreLocker(accountID string, l *account.DataEnvelope) error
	GetLocker(accountID string, hash string) (*account.DataEnvelope, error)
	ListLockers(accountID string, lvl model.AccessLevel) ([]*account.DataEnvelope, error)
	ListLockerHashes(accountID string, lvl model.AccessLevel) ([]string, error)

	StoreProperty(accountID string, prop *account.DataEnvelope) error
	GetProperty(accountID string, hash string) (*account.DataEnvelope, error)
	ListProperties(accountID string, lvl model.AccessLevel) ([]*account.DataEnvelope, error)
	DeleteProperty(accountID string, hash string) error
}

type DIDBackend

type DIDBackend interface {
	CreateDIDDocument(ddoc *model.DIDDocument) error
	GetDIDDocument(iid string) (*model.DIDDocument, error)
	ListDIDDocuments() ([]*model.DIDDocument, error)
}

type IdentityBackend

type IdentityBackend interface {
	io.Closer
	DIDBackend
	AccountBackend
	RecoveryBackend

	IsNew() bool
}

IdentityBackend stores MetaLocker accounts and related entities such as encrypted identities, lockers, access keys, properties, DID documents and recovery codes. This is the main node-specific storage layer.

func CreateIdentityBackend

func CreateIdentityBackend(cfg *IdentityBackendConfig, resolver cmdbase.ParameterResolver) (IdentityBackend, error)

type IdentityBackendConfig

type IdentityBackendConfig struct {
	Type   string     `json:"type"`
	Params Parameters `json:"params"`
}

type IdentityBackendConstructor

type IdentityBackendConstructor func(def Parameters, resolver cmdbase.ParameterResolver) (IdentityBackend, error)

type Parameters

type Parameters map[string]any

type RecoveryBackend

type RecoveryBackend interface {
	CreateRecoveryCode(c *account.RecoveryCode) error
	GetRecoveryCode(code string) (*account.RecoveryCode, error)
	DeleteRecoveryCode(code string) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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