Private Keys Module - tKey iOS SDK
The PrivateKeysModule module provides an interface for setting, getting and managing private keys for a ThresholdKey object.
To use the PrivateKeysModule in your Swift project, you will need to import the module as follows:
import tkey_pkg
PrivateKeysModule
is a class that provides the following methods:
Function | Description | Arguments | Async | return |
---|---|---|---|---|
set_private_key | Set private key to corresponding tKey | threshold_key: ThresholdKey, key: String?, format: String | Yes | Bool |
get_private_keys | Get Private Keys | threshold_key: ThresholdKey | No | [[String:String]] |
get_private_key_accounts | Get private Key accounts | threshold_key: ThresholdKey | No | [String] |
set_private_key()
set_private_key(threshold_key: ThresholdKey, key: String?, format: String) async throws -> Bool
Sets a private key for a ThresholdKey object.
Parameters
Parameters | Type | Description |
---|---|---|
threshold_key | ThresholdKey | A ThresholdKey object. |
key | String? | A private key in hex-encoded/mnemonic string format |
format | String | A string representing the format of the private key. |
Returns
- Bool: A boolean indicating whether the operation succeeded or not.
get_private_keys()
get_private_keys(threshold_key: ThresholdKey) throws -> [[String:String]]
Returns a list of private keys for a ThresholdKey object.
Parameters
Parameters | Type | Description |
---|---|---|
threshold_key | ThresholdKey | A ThresholdKey object. |
Returns
- [[String:String]]: A list of private keys as dictionaries.
Throws
- RuntimeError: If there is an error in during runtime.
get_private_key_accounts()
get_private_key_accounts(threshold_key: ThresholdKey) throws -> [String]
- Returns a list of accounts for which private keys are available.
Parameters
Parameters | Type | Description |
---|---|---|
threshold_key | ThresholdKey | A ThresholdKey object. |
Returns
- [String]: A list of accounts for which private keys are available.
Throws
- RuntimeError: If there is an error in during runtime.