Interface IKeyApi
Manages cryptographic keys.
Namespace: Ipfs.CoreApi
Assembly: Ipfs.Core.dll
Syntax
public interface IKeyApi
Remarks
note
The Key API is work in progress! There be dragons here.
Methods
| Improve this Doc View SourceCreateAsync(String, String, Int32, CancellationToken)
Creates a new key.
Declaration
Task<IKey> CreateAsync(string name, string keyType, int size, CancellationToken cancel = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
String | name | The local name of the key. |
String | keyType | The type of key to create; "rsa" or "ed25519". |
Int32 | size | The size, in bits, of the key. |
CancellationToken | cancel | Is used to stop the task. When cancelled, the TaskCanceledException is raised. |
Returns
Type | Description |
---|---|
Task<IKey> | A task that represents the asynchronous operation. The task's result is the key that was created. |
ExportAsync(String, Char[], CancellationToken)
Export a key to a PEM encoded password protected PKCS #8 container.
Declaration
Task<string> ExportAsync(string name, char[] password, CancellationToken cancel = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
String | name | The local name of the key. |
Char[] | password | The PEM's password. |
CancellationToken | cancel | Is used to stop the task. When cancelled, the TaskCanceledException is raised. |
Returns
Type | Description |
---|---|
Task<String> | A task that represents the asynchronous operation. The task's result is the password protected PEM string. |
ImportAsync(String, String, Char[], CancellationToken)
Import a key from a PEM encoded password protected PKCS #8 container.
Declaration
Task<IKey> ImportAsync(string name, string pem, char[] password = null, CancellationToken cancel = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
String | name | The local name of the key. |
String | pem | The PEM encoded PKCS #8 container. |
Char[] | password | The |
CancellationToken | cancel | Is used to stop the task. When cancelled, the TaskCanceledException is raised. |
Returns
Type | Description |
---|---|
Task<IKey> | A task that represents the asynchronous operation. The task's result is the newly imported key. |
ListAsync(CancellationToken)
List all the keys.
Declaration
Task<IEnumerable<IKey>> ListAsync(CancellationToken cancel = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancel | Is used to stop the task. When cancelled, the TaskCanceledException is raised. |
Returns
Type | Description |
---|---|
Task<IEnumerable<IKey>> | A task that represents the asynchronous operation. The task's result is a sequence of IPFS keys. |
RemoveAsync(String, CancellationToken)
Delete the specified key.
Declaration
Task<IKey> RemoveAsync(string name, CancellationToken cancel = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
String | name | The local name of the key. |
CancellationToken | cancel | Is used to stop the task. When cancelled, the TaskCanceledException is raised. |
Returns
Type | Description |
---|---|
Task<IKey> | A task that represents the asynchronous operation. The task's result is the key that was deleted. |
RenameAsync(String, String, CancellationToken)
Rename the specified key.
Declaration
Task<IKey> RenameAsync(string oldName, string newName, CancellationToken cancel = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
String | oldName | The local name of the key. |
String | newName | The new local name of the key. |
CancellationToken | cancel | Is used to stop the task. When cancelled, the TaskCanceledException is raised. |
Returns
Type | Description |
---|---|
Task<IKey> | A task that represents the asynchronous operation. The task's result is a sequence of IPFS keys that were renamed. |