@@ -40,6 +40,8 @@ public class BIP32Keystore: AbstractKeystore {
40
40
41
41
// --------------
42
42
43
+ private static let KeystoreParamsBIP32Version = 4
44
+
43
45
public var keystoreParams : KeystoreParamsBIP32 ?
44
46
public var rootPrefix : String
45
47
@@ -53,7 +55,7 @@ public class BIP32Keystore: AbstractKeystore {
53
55
54
56
public init ? ( _ jsonData: Data ) {
55
57
guard var keystorePars = try ? JSONDecoder ( ) . decode ( KeystoreParamsBIP32 . self, from: jsonData) else { return nil }
56
- if ( keystorePars. version != 3 ) { return nil }
58
+ if ( keystorePars. version != Self . KeystoreParamsBIP32Version ) { return nil }
57
59
if ( keystorePars. crypto. version != nil && keystorePars. crypto. version != " 1 " ) { return nil }
58
60
if ( !keystorePars. isHDWallet) { return nil }
59
61
addressStorage = PathAddressStorage ( pathAddressPairs: keystorePars. pathAddressPairs)
@@ -181,7 +183,7 @@ public class BIP32Keystore: AbstractKeystore {
181
183
let kdfparams = KdfParamsV3 ( salt: saltData. toHexString ( ) , dklen: dkLen, n: N, p: P, r: R, c: nil , prf: nil )
182
184
let cipherparams = CipherParamsV3 ( iv: IV . toHexString ( ) )
183
185
let crypto = CryptoParamsV3 ( ciphertext: encryptedKeyData. toHexString ( ) , cipher: aesMode, cipherparams: cipherparams, kdf: " scrypt " , kdfparams: kdfparams, mac: mac. toHexString ( ) , version: nil )
184
- var keystorePars = KeystoreParamsBIP32 ( crypto: crypto, id: UUID ( ) . uuidString. lowercased ( ) , version: 3 )
186
+ var keystorePars = KeystoreParamsBIP32 ( crypto: crypto, id: UUID ( ) . uuidString. lowercased ( ) , version: Self . KeystoreParamsBIP32Version )
185
187
keystorePars. pathAddressPairs = addressStorage. toPathAddressPairs ( )
186
188
keystorePars. rootPath = self . rootPrefix
187
189
keystoreParams = keystorePars
0 commit comments