Show / Hide Table of Contents

Class Web3KeyStore

Web3 Secret Storage (i.e., Ethereum-style key store) compliant IKeyStore implementation. Key files are placed in a directory of the Path.

Use DefaultKeyStore property to get an instance.

In order to get an instance with a customized directory, use the Web3KeyStore(String) constructor.

Inheritance
Object
Web3KeyStore
Implements
IKeyStore
Namespace: Libplanet.KeyStore
Assembly: Libplanet.dll
Syntax
public class Web3KeyStore : object, IKeyStore

Constructors

| Improve this Doc View Source

Web3KeyStore(String)

Creates a Web3KeyStore instance with a custom directory path.

Declaration
public Web3KeyStore(string path)
Parameters
Type Name Description
String path

A path of the directory to store key files. A new directory is created if not exists.

See Also
DefaultKeyStore

Properties

| Improve this Doc View Source

DefaultKeyStore

A default Web3KeyStore instance which refers to a user-local directory. The Path differs on the platform:

OSDirectory path
Linux/macOS$HOME/.config/planetarium/keystore
Windows%AppData%\planetarium\keystore
Declaration
public static Web3KeyStore DefaultKeyStore { get; }
Property Value
Type Description
Web3KeyStore
See Also
Web3KeyStore(String)
| Improve this Doc View Source

Path

The path of the directory key files are placed.

Declaration
public string Path { get; }
Property Value
Type Description
String

Methods

| Improve this Doc View Source

Add(ProtectedPrivateKey)

Adds a new key into the key store.

Declaration
public Guid Add(ProtectedPrivateKey key)
Parameters
Type Name Description
ProtectedPrivateKey key

A key to add.

Returns
Type Description
Guid

The id of the added key.

| Improve this Doc View Source

Get(Guid)

Looks for a key having the requested id in the key store.

Declaration
public ProtectedPrivateKey Get(Guid id)
Parameters
Type Name Description
Guid id

The key ID to look for.

Returns
Type Description
ProtectedPrivateKey

The found key.

Exceptions
Type Condition
NoKeyException

Thrown when there are no key of the given id.

| Improve this Doc View Source

List()

Lists all keys in the key store.

Declaration
public IEnumerable<Tuple<Guid, ProtectedPrivateKey>> List()
Returns
Type Description
IEnumerable<Tuple<Guid, ProtectedPrivateKey>>

All keys in the key store. The order is undefined and not deterministic.

| Improve this Doc View Source

ListIds()

Lists all keys IDs in the key store.

Declaration
public IEnumerable<Guid> ListIds()
Returns
Type Description
IEnumerable<Guid>

All keys IDs in the key store. The order is undefined and not deterministic.

| Improve this Doc View Source

Remove(Guid)

Removes a key having the given from the key store.

Declaration
public void Remove(Guid id)
Parameters
Type Name Description
Guid id

The key ID to remove.

Exceptions
Type Condition
NoKeyException

Thrown when there is no key having the given id.

Implements

IKeyStore
  • Improve this Doc
  • View Source
Back to top Copyright © 2019–2020 Planetarium