Skip to content

Commit

Permalink
refactor: verifySeedPhrase should return a Uint8Array
Browse files Browse the repository at this point in the history
  • Loading branch information
mikesposito committed May 8, 2023
1 parent 09aacdb commit c415b7d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions packages/keyring-controller/src/KeyringController.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,11 @@ describe('KeyringController', () => {
const seedPhrase = await keyringController.verifySeedPhrase();
expect(seedPhrase).toBeDefined();
});

it('should return current seedphrase as Uint8Array', async () => {
const seedPhrase = await keyringController.verifySeedPhrase();
expect(seedPhrase).toBeInstanceOf(Uint8Array);
});
});

describe('validatePassword', () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/keyring-controller/src/KeyringController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -623,14 +623,14 @@ export class KeyringController extends BaseController<
*
* @returns Whether the verification succeeds.
*/
async verifySeedPhrase(): Promise<string> {
async verifySeedPhrase(): Promise<Uint8Array> {
const primaryKeyring = this.#keyring.getKeyringsByType(KeyringTypes.hd)[0];
/* istanbul ignore if */
if (!primaryKeyring) {
throw new Error('No HD keyring found.');
}

const seedWords = (await primaryKeyring.serialize()).mnemonic;
const seedWords = primaryKeyring.mnemonic;
const accounts = await primaryKeyring.getAccounts();
/* istanbul ignore if */
if (accounts.length === 0) {
Expand Down

0 comments on commit c415b7d

Please sign in to comment.