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.
Implements
Namespace: Libplanet.KeyStore
Assembly: Libplanet.dll
Syntax
public class Web3KeyStore : object, IKeyStore
Constructors
| Improve this Doc View SourceWeb3KeyStore(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
Properties
| Improve this Doc View SourceDefaultKeyStore
A default Web3KeyStore instance which refers to a user-local directory. The Path differs on the platform:
OS | Directory path |
---|---|
Linux/macOS | $HOME/.config/planetarium/keystore |
Windows | %AppData%\planetarium\keystore |
Declaration
public static Web3KeyStore DefaultKeyStore { get; }
Property Value
Type | Description |
---|---|
Web3KeyStore |
See Also
| Improve this Doc View SourcePath
The path of the directory key files are placed.
Declaration
public string Path { get; }
Property Value
Type | Description |
---|---|
String |
Methods
| Improve this Doc View SourceAdd(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 |
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
|
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. |
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. |
Remove(Guid)
Removes a key having the given
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 |