Skip to main content

Seed Phrase Module - tKey JS SDK

@tkey/seed-phrase

The Seed Phrase Module helps you to store and use seed phrases on the metadata.

Installation

npm install --save @tkey/seed-phrase

Initialization

import { SeedPhraseModule } from "@tkey/seed-phrase";
const seedPhraseModule = new SeedPhraseModule();

Usage

With the SeedPhraseModule, you have access to the multiple functions as mentioned in the type reference, however, the most important ones are:

Set Seed Phrase

setSeedPhrase(seedPhraseType: string, seedPhrase?: string): Promise<void>;

  • seedPhraseType: The type of seed phrase to set.
  • seedPhrase: The seed phrase to set.

Example

await tKey.modules.privateKeyModule.setPrivateKey(seedPhraseType, seedPhrase);

Get Seed Phrase

getSeedPhrases(): Promise<ISeedPhraseStore[]>;

Return

  • Promise<ISeedPhraseStore[]>: A list of seed phrases.

Example

await tKey.modules.privateKeyModule.getSeedPhrases();

Type Reference

SeedPhraseModule

declare class SeedPhraseModule implements IModule {
moduleName: string;
tbSDK: ITKeyApi;
seedPhraseFormats: ISeedPhraseFormat[];
constructor(formats: ISeedPhraseFormat[]);
setModuleReferences(tbSDK: ITKeyApi): void;
initialize(): Promise<void>;
setSeedPhrase(seedPhraseType: string, seedPhrase?: string): Promise<void>;
setSeedPhraseStoreItem(partialStore: ISeedPhraseStore): Promise<void>;
CRITICAL_changeSeedPhrase(oldSeedPhrase: string, newSeedPhrase: string): Promise<void>;
getSeedPhrases(): Promise<ISeedPhraseStore[]>;
getSeedPhrasesWithAccounts(): Promise<ISeedPhraseStoreWithKeys[]>;
getAccounts(): Promise<BN[]>;
}