mirror of
https://github.com/movie-web/movie-web.git
synced 2024-12-29 15:06:10 +00:00
Add method to get keys from seed directly
This commit is contained in:
parent
852e6ff324
commit
ba2f3fd359
|
@ -21,9 +21,7 @@ export function verifyValidMnemonic(mnemonic: string) {
|
||||||
return validateMnemonic(mnemonic, wordlist);
|
return validateMnemonic(mnemonic, wordlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function keysFromMnemonic(mnemonic: string): Promise<Keys> {
|
export async function keysFromSeed(seed: Uint8Array): Promise<Keys> {
|
||||||
const seed = await seedFromMnemonic(mnemonic);
|
|
||||||
|
|
||||||
const { privateKey, publicKey } = forge.pki.ed25519.generateKeyPair({
|
const { privateKey, publicKey } = forge.pki.ed25519.generateKeyPair({
|
||||||
seed,
|
seed,
|
||||||
});
|
});
|
||||||
|
@ -35,6 +33,12 @@ export async function keysFromMnemonic(mnemonic: string): Promise<Keys> {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function keysFromMnemonic(mnemonic: string): Promise<Keys> {
|
||||||
|
const seed = await seedFromMnemonic(mnemonic);
|
||||||
|
|
||||||
|
return keysFromSeed(seed);
|
||||||
|
}
|
||||||
|
|
||||||
export function genMnemonic(): string {
|
export function genMnemonic(): string {
|
||||||
return generateMnemonic(wordlist);
|
return generateMnemonic(wordlist);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue