Skip to main content

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:

FunctionDescriptionArgumentsAsyncreturn
set_private_keySet private key to corresponding tKeythreshold_key: ThresholdKey, key: String?, format: StringYesBool
get_private_keysGet Private Keysthreshold_key: ThresholdKeyNo[[String:String]]
get_private_key_accountsGet private Key accountsthreshold_key: ThresholdKeyNo[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

ParametersTypeDescription
threshold_keyThresholdKeyA ThresholdKey object.
keyString?A private key in hex-encoded/mnemonic string format
formatStringA 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

ParametersTypeDescription
threshold_keyThresholdKeyA 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

ParametersTypeDescription
threshold_keyThresholdKeyA ThresholdKey object.

Returns

  • [String]: A list of accounts for which private keys are available.

Throws

  • RuntimeError: If there is an error in during runtime.