Skip to main content

Seed Phrase Module

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

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

import com.web3auth.tkey.ThresholdKey.ThresholdKey;
import com.web3auth.tkey.ThresholdKey.Modules.SeedPhraseModule;

SeedPhraseModule is a class that provides the following methods:

FunctionDescriptionArgumentsAsyncreturn
setSeedPhraseSet seed phrase to corresponding tKeythresholdKey: ThresholdKey, format: String, phrase: String?, number_of_wallets: UInt32Yesvoid
changePhraseChanges specific seed phrasethresholdKey: ThresholdKey, old_phrase: String, new_phrase: StringYesvoid
getPhrasesGets all seed phrases stored in tKey.thresholdKey: ThresholdKeyYes[seedPhraseStruct]
deletePhraseDelete the seed phrasethresholdKey: ThresholdKey, phrase: StringYesvoid

setSeedPhrase()

public static void setSeedPhrase(ThresholdKey thresholdKey, String format, @Nullable String phrase, int wallets, ThresholdKeyCallback<Boolean> callback)

This function sets the seed phrase for the given ThresholdKey.

Parameters

ParametersTypeDescription
thresholdKeyThresholdKeyThe 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.
walletsintThe number of wallets to derive from the seed phrase.

Returns

  • Void

Throws

  • Error: An error if the operation fails.

changePhrase()

public static void changePhrase(ThresholdKey thresholdKey, String oldPhrase, String newPhrase, ThresholdKeyCallback<Boolean> callback)

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
thresholdKeyThresholdKeyThe ThresholdKey object to change the seed phrase for.
oldPhraseStringThe old seed phrase.
newPhraseStringThe new seed phrase.

Returns

  • Void

Throws

  • Error: An error if the operation fails.

getPhrases()

public static String getPhrases(ThresholdKey thresholdKey) throws RuntimeError

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

Parameters

ParametersTypeDescription
thresholdKeyThresholdKeyThe ThresholdKey object to get the seed phrases for.

Returns

  • seedPhraseStruct

Throws

  • RuntimeError: An error if the operation fails.

deletePhrase()

public static void deletePhrase(ThresholdKey thresholdKey, String phrase, ThresholdKeyCallback<Boolean> callback)

This method deletes a seed phrase from the given ThresholdKey.

Parameters

ParametersTypeDescription
thresholdKeyThresholdKeyThe 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.