Skip to content

Commit

Permalink
Fixed bug with CBOR serialization of master private keys and the publ…
Browse files Browse the repository at this point in the history
…ic keys directly derived from them (Addresses #182).
  • Loading branch information
wolfmcnally committed May 7, 2023
1 parent a81be2c commit 7fdd686
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ _For related Threat Modeling, see the [Seed Tool Manual](https://github.com/Bloc

[Join the Test Flight Open Beta](https://testflight.apple.com/join/0LIl6H1h)

### 1.6 (66)

Fixed bug with CBOR serialization of master private keys and the public keys directly derived from them (Issue #182).

### 1.6 (65)

Interim release.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/BlockchainCommons/BCSwiftEnvelope.git",
"state" : {
"revision" : "741f56f4b66ce521fb5094b707cde12a9bb857c6",
"version" : "0.10.1"
"revision" : "bf6bd2d67e884019ebf464be65ec87001583e72b",
"version" : "0.10.2"
}
},
{
Expand All @@ -77,8 +77,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/BlockchainCommons/BCSwiftFoundation",
"state" : {
"revision" : "b4c5e706b845acbe5cd773982fcf3709f6862e6c",
"version" : "7.2.1"
"revision" : "647c5afe41a23a5e49f59133152a439743ce0498",
"version" : "7.2.5"
}
},
{
Expand Down Expand Up @@ -302,8 +302,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/WolfMcNally/WolfBase",
"state" : {
"revision" : "21feeff132b57bbdf0eb57fae73a5e36d485b32d",
"version" : "5.3.0"
"revision" : "d7219c703316956c42a7f47f926a442d082f043f",
"version" : "5.3.1"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion SeedTool/Entropy/Tokens/CardToken.swift
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ extension CardToken: SeedProducer {
let a = buf.bindMemory(to: UInt64.self)
return (a[0], a[1], a[2], a[3])
}
var rng = Xoroshiro256StarStar(state: state)
var rng = Xoshiro256StarStar(state: state)
return rng.data(count: 16)
}
}
2 changes: 1 addition & 1 deletion SeedTool/Keys/KeyExportModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ final class KeyExportModel: ObservableObject {
}
privateHDKey = Self.deriveKey(seed: seed, useInfo: useInfo, keyType: .private, path: derivationPath, isDerivable: isDerivable)
publicHDKey = try! ModelHDKey(key: privateHDKey!, derivedKeyType: .public)
let masterKey = try! ModelHDKey(seed: seed, useInfo: useInfo, origin: nil, children: nil)
let masterKey = try! ModelHDKey(seed: seed, useInfo: useInfo, children: nil)
address = ModelAddress(masterKey: masterKey, derivationPath: derivationPath, name: seed.name, useInfo: useInfo, parentSeed: seed)
privateECKey = ModelPrivateKey(masterKey: masterKey, derivationPath: derivationPath, name: "Private Key from \(seed.name)", useInfo: useInfo)
}
Expand Down
4 changes: 2 additions & 2 deletions SeedTool/Keys/ModelHDKey.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ final class ModelHDKey: HDKeyProtocol, ModelObject, Printable {
self.seed = key.seed
}

convenience init(seed: ModelSeed, useInfo: UseInfo = .init(), origin: DerivationPath? = nil, children: DerivationPath? = nil) throws {
try self.init(HDKey(seed: seed, useInfo: useInfo, parent: origin, children: children))
convenience init(seed: ModelSeed, useInfo: UseInfo = .init(), children: DerivationPath? = nil) throws {
try self.init(HDKey(seed: seed, useInfo: useInfo, children: children))
self.name = "HDKey from \(seed.name)"
self.seed = seed
}
Expand Down

0 comments on commit 7fdd686

Please sign in to comment.