File tree 3 files changed +22
-3
lines changed
3 files changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import 'package:polyseed/src/mnemonics/zh_s_lang.dart';
10
10
import 'package:polyseed/src/mnemonics/zh_t_lang.dart' ;
11
11
import 'package:polyseed/src/utils/exceptions.dart' ;
12
12
import 'package:polyseed/src/utils/list_extension.dart' ;
13
+ import 'package:unorm_dart/unorm_dart.dart' as unorm;
13
14
14
15
class PolyseedLang {
15
16
/// The native name of the language
@@ -64,6 +65,7 @@ class PolyseedLang {
64
65
/// Get the [PolyseedLang] using the words of [phrase]
65
66
static PolyseedLang getByPhrase (String phrase) {
66
67
for (var language in languages) {
68
+ phrase = language.hasAccents ? unorm.nfkd (phrase) : phrase;
67
69
final phraseWords = phrase.split (language.separator);
68
70
if (language.words.containsAll (phraseWords)) {
69
71
return language;
@@ -83,8 +85,10 @@ class PolyseedLang {
83
85
}
84
86
85
87
/// Decode a valid seed [phrase] into it's coefficients
86
- List <int > decodePhrase (String phrase) =>
87
- phrase.split (separator).map ((e) => words.indexOf (e)).toList ();
88
+ List <int > decodePhrase (String phrase) => phrase
89
+ .split (separator)
90
+ .map ((e) => words.indexOf (hasAccents ? unorm.nfkd (e) : e))
91
+ .toList ();
88
92
89
93
/// Encode a seed [coefficients] into a valid seed phrase
90
94
String encodePhrase (List <int > coefficients) =>
Original file line number Diff line number Diff line change 1
1
name : polyseed
2
2
description : A pure dart implementation of the 16-word seed scheme for monero
3
- version : 0.0.4
3
+ version : 0.0.5
4
4
homepage : https://cakelabs.com
5
5
repository : https://github.com/cake-tech/polyseed_dart
6
6
issue_tracker : https://github.com/cake-tech/polyseed_dart/issues
@@ -11,6 +11,7 @@ environment:
11
11
dependencies :
12
12
pointycastle : ^3.7.3
13
13
hashlib : ^1.12.0
14
+ unorm_dart : ^0.3.0
14
15
15
16
dev_dependencies :
16
17
lints : ^2.1.1
Original file line number Diff line number Diff line change @@ -74,6 +74,20 @@ void main() {
74
74
expect (Polyseed .load (serializedSeed).birthday, seed.birthday);
75
75
});
76
76
77
+ test ('Normalize french seeds' , () {
78
+ final seedRaw =
79
+ "merle bureau littoral vaisseau relatif exprimer voiture légal utile académie graffiti ultime substrat redouter oisillon soudure" ;
80
+
81
+ expect (Polyseed .isValidSeed (seedRaw), true );
82
+ });
83
+
84
+ test ('Normalize spanish seeds' , () {
85
+ final seedRaw =
86
+ "remedio foca sujeto veneno bello humilde surco crear típico chacal célula empate moreno varón verde masa" ;
87
+
88
+ expect (Polyseed .isValidSeed (seedRaw), true );
89
+ });
90
+
77
91
group ('Convert to Legacy Seed' , () {
78
92
test ('Generate a 25 Word english LegacySeed from a Seed' , () {
79
93
final seed = Polyseed .decode (expectedSeedString, enLang, coin);
You can’t perform that action at this time.
0 commit comments