Skip to main content

Seed Phrase Module - tKey iOS SDK

SeedPhraseModule is a Swift module that provides functionality for setting, changing, getting, and deleting seed phrases for a ThresholdKey object.

To use the SeedPhraseModule in your Swift project, you will need to import the module as follows:

import tkey_pkg

SeedPhraseModule is a class that provides the following methods:

FunctionDescriptionArgumentsAsyncreturn
set_seed_phraseSet seed phrase to corresponding tKeythreshold_key: ThresholdKey, format: String, phrase: String?, number_of_wallets: UInt32Yesvoid
change_phraseChanges specific seed phrasethreshold_key: ThresholdKey, old_phrase: String, new_phrase: StringYesvoid
get_seed_phrasesGets all seed phrases stored in tKey.threshold_key: ThresholdKeyYes[seedPhraseStruct]
delete_seed_phraseDelete the seed phrasethreshold_key: ThresholdKey, phrase: StringYesvoid

set_seed_phrase()

set_seed_phrase(threshold_key: ThresholdKey, format: String, phrase: String?, number_of_wallets: UInt32) async throws

This function sets the seed phrase for the given ThresholdKey.

Parameters

ParametersTypeDescription
threshold_keyThresholdKeyThe ThresholdKey object to set the seed phrase for.
formatStringThe format of the seed phrase.
phraseString?The seed phrase. If nil, a random seed phrase is generated.
number_of_walletsUInt32The number of wallets to derive from the seed phrase.

Returns

  • Void

Throws

  • Error: An error if the operation fails.

change_phrase()

change_phrase(threshold_key: ThresholdKey, old_phrase: String, new_phrase: String) async throws

This function changes the seed phrase of the given ThresholdKey. The old_phrase parameter specifies the old seed phrase, and the new_phrase parameter specifies the new seed phrase. The function is asynchronous and can throw an error.

Parameters

ParametersTypeDescription
threshold_keyThresholdKeyThe ThresholdKey object to change the seed phrase for.
old_phraseStringThe old seed phrase.
new_phraseStringThe new seed phrase.

Returns

  • Void

Throws

  • Error: An error if the operation fails.

get_seed_phrases()

get_seed_phrases(threshold_key: ThresholdKey) throws -> [seedPhraseStruct]

This function returns an array of seedPhraseStruct objects, which contain the seed phrases and their type for the given ThresholdKey.

Parameters

ParametersTypeDescription
threshold_keyThresholdKeyThe ThresholdKey object to get the seed phrases for.

Returns

  • seedPhraseStruct

Throws

  • Error: An error if the operation fails.

delete_seed_phrase()

delete_seed_phrase(threshold_key: ThresholdKey, phrase: String ) async throws

This method deletes a seed phrase from the given ThresholdKey.

Parameters

ParametersTypeDescription
threshold_keyThresholdKeyThe ThresholdKey instance from which to delete the seed phrase.
phraseStringThe seed phrase to delete, as a string.

Returns

  • Void

Throws

  • Error: An error if the operation fails.