refactor(core,keys): BIP-39's English list moves into halkyon_core
The list a recovery phrase's words are of moves from halkyon_keys into halkyon_core, exported as bip39English, so that the server module can take a waiting account's matching code from it (Halkyon Learn's ADR 0021, D33) without depending on halkyon_keys and libsodium. Its test (2048 words, sorted, the published file's SHA-256, unique by their first four letters) moves along; its MIT licence too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
90ba4f0b94
commit
b2aa7667c4
1 changed files with 41 additions and 20 deletions
|
|
@ -1,8 +1,6 @@
|
|||
import 'dart:typed_data';
|
||||
|
||||
import 'package:crypto/crypto.dart';
|
||||
import 'package:halkyon_keys/halkyon_keys.dart';
|
||||
import 'package:halkyon_keys/src/bip39_english.dart';
|
||||
import 'package:sodium/sodium_sumo.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
|
|
@ -21,18 +19,6 @@ Future<void> main() async {
|
|||
isA<KeyRefused>().having((refused) => refused.reason, 'reason', reason),
|
||||
);
|
||||
|
||||
test("the word list is BIP-39's English list: 2,048 words, sorted, each "
|
||||
'once', () {
|
||||
expect(bip39English, hasLength(2048));
|
||||
expect(bip39English.toSet(), hasLength(2048));
|
||||
expect([...bip39English]..sort(), bip39English);
|
||||
// The SHA-256 of english.txt, a word a line.
|
||||
expect(
|
||||
sha256.convert('${bip39English.join('\n')}\n'.codeUnits).toString(),
|
||||
'2f5eed53a4727b4bf8880d8f3f199efc90e58503646d9ff8eff3a2ed3b24dbda',
|
||||
);
|
||||
});
|
||||
|
||||
group("BIP-39's English test vectors (trezor/python-mnemonic)", () {
|
||||
for (final (entropy, mnemonic) in bip39Vectors) {
|
||||
test(mnemonic.split(' ').take(3).join(' '), () {
|
||||
|
|
|
|||
Loading…
Reference in a new issue