Documentation
¶
Overview ¶
Package store provides a sample storage handler based on local-disk.
Index ¶
- type IdentifierRecord
- type LocalStore
- func (ls *LocalStore) Delete(name string) error
- func (ls *LocalStore) DeleteWallet(name string) error
- func (ls *LocalStore) Get(name string) (*did.Identifier, error)
- func (ls *LocalStore) List() map[string]*did.Identifier
- func (ls *LocalStore) ListWallets() (list []string)
- func (ls *LocalStore) OpenWallet(name, passphrase string) (string, error)
- func (ls *LocalStore) RenameWallet(old, nw string) error
- func (ls *LocalStore) Save(name string, id *did.Identifier) error
- func (ls *LocalStore) SaveWallet(name, mnemonic, passphrase string) error
- func (ls *LocalStore) Update(name string, id *did.Identifier) error
- func (ls *LocalStore) WalletExists(name string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IdentifierRecord ¶ added in v0.2.0
type IdentifierRecord struct { Version string `json:"version,omitempty"` Document *did.Document `json:"document"` Metadata *did.DocumentMetadata `json:"metadata,omitempty"` Proof *did.ProofLD `json:"proof,omitempty"` }
IdentifierRecord holds the identifier data, Document and DocumentMetadata, and is used to store the identifier locally.
type LocalStore ¶
type LocalStore struct {
// contains filtered or unexported fields
}
LocalStore provides a filesystem-backed store.
func NewLocalStore ¶
func NewLocalStore(home string) (*LocalStore, error)
NewLocalStore returns a local store handler. If the specified 'home' directory doesn't exist it will be created.
func (*LocalStore) Delete ¶
func (ls *LocalStore) Delete(name string) error
Delete a previously stored entry.
func (*LocalStore) DeleteWallet ¶
func (ls *LocalStore) DeleteWallet(name string) error
DeleteWallet will permanently delete the file handler for an existing wallet. This cannot be undone. Use with EXTREME care.
func (*LocalStore) Get ¶
func (ls *LocalStore) Get(name string) (*did.Identifier, error)
Get an existing entry based on its reference name.
func (*LocalStore) List ¶
func (ls *LocalStore) List() map[string]*did.Identifier
List currently registered entries.
func (*LocalStore) ListWallets ¶
func (ls *LocalStore) ListWallets() (list []string)
ListWallets returns a list of the names of all wallets locally stored.
func (*LocalStore) OpenWallet ¶
func (ls *LocalStore) OpenWallet(name, passphrase string) (string, error)
OpenWallet locates the wallet file and decrypts it using `passphrase`; the `mnemonic` value returned must be treated with extreme caution.
func (*LocalStore) RenameWallet ¶
func (ls *LocalStore) RenameWallet(old, nw string) error
RenameWallet will securely adjust the alias associated with a locally store wallet.
func (*LocalStore) Save ¶
func (ls *LocalStore) Save(name string, id *did.Identifier) error
Save add a new entry to the store.
func (*LocalStore) SaveWallet ¶
func (ls *LocalStore) SaveWallet(name, mnemonic, passphrase string) error
SaveWallet will securely store the wallet contents on the local FS. The `passphrase` value will be used to encrypt the `mnemonic` value before storing it.
func (*LocalStore) Update ¶
func (ls *LocalStore) Update(name string, id *did.Identifier) error
Update the contents of an existing entry.
func (*LocalStore) WalletExists ¶
func (ls *LocalStore) WalletExists(name string) bool
WalletExists returns `true` if a wallet with the provided name already exists.