Add missing bip39 wordlists (only en is used) (#1803)
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,11 @@
|
||||
// Copyright 2017-2023 @polkadot/util-crypto authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export { default as en } from './en.js';
|
||||
export { default as es } from './es.js';
|
||||
export { default as fr } from './fr.js';
|
||||
export { default as it } from './it.js';
|
||||
export { default as jp } from './jp.js';
|
||||
export { default as ko } from './ko.js';
|
||||
export { default as zhs } from './zh-s.js';
|
||||
export { default as zht } from './zh-t.js';
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -3,17 +3,21 @@
|
||||
|
||||
/// <reference types="@polkadot/dev-test/globals.d.ts" />
|
||||
|
||||
import * as lists from './bip39-lang/index.js';
|
||||
import { entropyToMnemonic, mnemonicToEntropy } from './bip39.js';
|
||||
import DEFAULT_WORDLIST from './bip39-en.js';
|
||||
|
||||
describe('wordlist', (): void => {
|
||||
it('has the correct number of words', (): void => {
|
||||
expect(DEFAULT_WORDLIST).toHaveLength(2048);
|
||||
});
|
||||
describe('wordlists', (): void => {
|
||||
for (const [k, v] of Object.entries(lists)) {
|
||||
describe(`language ${k}`, (): void => {
|
||||
it('has the correct number of words', (): void => {
|
||||
expect(v).toHaveLength(2048);
|
||||
});
|
||||
|
||||
it('has no empty words', (): void => {
|
||||
expect(DEFAULT_WORDLIST.some((n) => !n.length || n.trim() !== n)).toEqual(false);
|
||||
});
|
||||
it('has no empty words', (): void => {
|
||||
expect(v.some((n) => !n.length || n.trim() !== n)).toEqual(false);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
describe('bip39', (): void => {
|
||||
|
||||
@@ -19,7 +19,7 @@ import { stringToU8a, u8aToU8a } from '@polkadot/util';
|
||||
import { pbkdf2Encode } from '../pbkdf2/index.js';
|
||||
import { randomAsU8a } from '../random/index.js';
|
||||
import { sha256AsU8a } from '../sha/index.js';
|
||||
import DEFAULT_WORDLIST from './bip39-en.js';
|
||||
import DEFAULT_WORDLIST from './bip39-lang/en.js';
|
||||
|
||||
const INVALID_MNEMONIC = 'Invalid mnemonic';
|
||||
const INVALID_ENTROPY = 'Invalid entropy';
|
||||
|
||||
Reference in New Issue
Block a user