@@ -11,6 +11,8 @@ import CryptoSwift
11
11
12
12
class web3swift_Keystores_tests : XCTestCase {
13
13
14
+ let mnemonic = " fruit wave dwarf banana earth journey tattoo true farm silk olive fence "
15
+
14
16
func testBIP39 ( ) {
15
17
var entropy = Data . fromHex ( " 00000000000000000000000000000000 " ) !
16
18
var phrase = BIP39 . generateMnemonicsFromEntropy ( entropy: entropy)
@@ -88,7 +90,6 @@ class web3swift_Keystores_tests: XCTestCase {
88
90
}
89
91
90
92
func testBIP32keystoreMatching( ) {
91
- let mnemonic = " fruit wave dwarf banana earth journey tattoo true farm silk olive fence "
92
93
let keystore = try ! BIP32Keystore ( mnemonics: mnemonic, password: " " , mnemonicsPassword: " banana " )
93
94
XCTAssertNotNil ( keystore)
94
95
let account = keystore!. addresses![ 0 ]
@@ -98,15 +99,13 @@ class web3swift_Keystores_tests: XCTestCase {
98
99
}
99
100
100
101
func testBIP32keystoreMatchingRootNode( ) {
101
- let mnemonic = " fruit wave dwarf banana earth journey tattoo true farm silk olive fence "
102
102
let keystore = try ! BIP32Keystore ( mnemonics: mnemonic, password: " " , mnemonicsPassword: " banana " )
103
103
XCTAssertNotNil ( keystore)
104
104
let rootNode = try ! keystore!. serializeRootNodeToString ( password: " " )
105
105
XCTAssert ( rootNode == " xprvA2KM71v838kPwE8Lfr12m9DL939TZmPStMnhoFcZkr1nBwDXSG7c3pjYbMM9SaqcofK154zNSCp7W7b4boEVstZu1J3pniLQJJq7uvodfCV " )
106
106
}
107
107
108
108
func testBIP32keystoreCustomPathMatching( ) {
109
- let mnemonic = " fruit wave dwarf banana earth journey tattoo true farm silk olive fence "
110
109
let keystore = try ! BIP32Keystore ( mnemonics: mnemonic, password: " " , mnemonicsPassword: " banana " , prefixPath: " m/44'/60'/0'/0 " )
111
110
XCTAssertNotNil ( keystore)
112
111
let account = keystore!. addresses![ 0 ]
@@ -156,8 +155,8 @@ class web3swift_Keystores_tests: XCTestCase {
156
155
print ( recreatedStore!. addresses![ 0 ] . address)
157
156
print ( recreatedStore!. addresses![ 1 ] . address)
158
157
// This will fail. It wont fail if use scrypt from pod 'scrypt', '2.0', not from CryptoSwift
159
- XCTAssert ( keystore? . addresses![ 0 ] == recreatedStore? . addresses![ 1 ] )
160
- XCTAssert ( keystore? . addresses![ 1 ] == recreatedStore? . addresses![ 0 ] )
158
+ XCTAssert ( keystore? . addresses![ 1 ] == recreatedStore? . addresses![ 1 ] )
159
+ XCTAssert ( keystore? . addresses![ 0 ] == recreatedStore? . addresses![ 0 ] )
161
160
}
162
161
163
162
// func testPBKDF2() {
0 commit comments