Skip to content

Commit

Permalink
Bump libwally-swift to v0.0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Sjors committed Nov 26, 2022
1 parent 99fb1a1 commit 1feeeea
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 21 deletions.
14 changes: 4 additions & 10 deletions NthKey/Model/DataManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,6 @@ extension DataManager {
return
}

guard let pathForDerive = BIP32Path("0") else {
completion(.failure(.wrongCosigner))
return
}

var receivePublicHDkeys: [HDKey] = []
var hdKeys: [(ExtendedKey, HDKey)] = []
desc.extendedKeys.forEach { key in
Expand All @@ -178,7 +173,7 @@ extension DataManager {
return
}
// ourself key
receivePublicHDkeys.append(try! selfKey.derive(pathForDerive))
receivePublicHDkeys.append(try! selfKey.derive("0"))
return
}
let extendedKey = Data(base58: key.xpub)!
Expand All @@ -195,7 +190,7 @@ extension DataManager {
}
hdKeys.append((key, aKey))
// cosigners keys
receivePublicHDkeys.append(try! aKey.derive(pathForDerive))
receivePublicHDkeys.append(try! aKey.derive("0"))
}

// Checking co-signers network
Expand Down Expand Up @@ -248,15 +243,14 @@ extension DataManager {
let signer = CosignerEntity(context: store.container.viewContext)
signer.name = ""
signer.fingerprint = Data(key.fingerprint)
signer.derivation = BIP32Path(key.origin)?.description
signer.derivation = key.origin
signer.xpub = hdKey.description
wallet.addToCosigners(signer)
}

for idx in 0..<1000 {
let pubKeys = receivePublicHDkeys.map {key -> PubKey in
let path = try! BIP32Path(idx, relative: true)
let childKey: HDKey = try! key.derive(path)
let childKey: HDKey = try! key.derive(String(idx))
return childKey.pubKey
}

Expand Down
2 changes: 1 addition & 1 deletion NthKey/Model/SeedManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ struct SeedManager {
let masterKey = HDKey(seedHex, network)!
assert(masterKey.fingerprint == fingerprint)

let path = BIP32Path("m/48h/\(network == .mainnet ? "0h" : "1h")/0h/2h")!
let path = "m/48h/\(network == .mainnet ? "0h" : "1h")/0h/2h"
let account = try! masterKey.derive(path)

// Specter compatible JSON format:
Expand Down
6 changes: 3 additions & 3 deletions NthKey/Model/Signer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import LibWally
public class Signer: NSObject, Identifiable {

public let fingerprint: Data
public let derivation: BIP32Path
public let derivation: String
public let hdKey: HDKey // TODO: store derivation and fingerprint in HDKey?
public let name: String

public init(fingerprint: Data, derivation: BIP32Path, hdKey: HDKey, name: String) {
public init(fingerprint: Data, derivation: String, hdKey: HDKey, name: String) {
self.fingerprint = fingerprint
self.name = name
self.derivation = derivation
Expand All @@ -30,7 +30,7 @@ public class Signer: NSObject, Identifiable {
let masterKey = HDKey(seedHex, network)!
assert(masterKey.fingerprint == fingerprint)

let path = BIP32Path("m/48h/\(network == .mainnet ? "0h" : "1h")/0h/2h")!
let path = "m/48h/\(network == .mainnet ? "0h" : "1h")/0h/2h"
let ourKey = try! masterKey.derive(path)

return Signer(fingerprint: fingerprint, derivation: path, hdKey: ourKey, name: "NthKey")
Expand Down
2 changes: 1 addition & 1 deletion Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ target 'NthKey' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!

pod 'LibWally', :git => 'https://github.com/sjors/LibWally-Swift.git', :tag => "v0.0.6", :submodules => true
pod 'LibWally', :git => 'https://github.com/sjors/LibWally-Swift.git', :tag => "v0.0.7", :submodules => true
pod 'OutputDescriptors', :git => 'https://github.com/sjors/output-descriptors-swift.git', :tag => "v0.0.2"

target 'NthKeyTests' do
Expand Down
12 changes: 6 additions & 6 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ PODS:
- OutputDescriptors (0.0.1)

DEPENDENCIES:
- LibWally (from `https://github.com/sjors/LibWally-Swift.git`, tag `v0.0.6`)
- LibWally (from `https://github.com/sjors/LibWally-Swift.git`, tag `v0.0.7`)
- OutputDescriptors (from `https://github.com/sjors/output-descriptors-swift.git`, tag `v0.0.2`)

EXTERNAL SOURCES:
LibWally:
:git: https://github.com/sjors/LibWally-Swift.git
:submodules: true
:tag: v0.0.6
:tag: v0.0.7
OutputDescriptors:
:git: https://github.com/sjors/output-descriptors-swift.git
:tag: v0.0.2
Expand All @@ -19,15 +19,15 @@ CHECKOUT OPTIONS:
LibWally:
:git: https://github.com/sjors/LibWally-Swift.git
:submodules: true
:tag: v0.0.6
:tag: v0.0.7
OutputDescriptors:
:git: https://github.com/sjors/output-descriptors-swift.git
:tag: v0.0.2

SPEC CHECKSUMS:
LibWally: 8192c453746bd8f86978c857aadef57477decbcc
LibWally: ce1e98813b64aa26b4cc3a92d3c7f57db97b2fb2
OutputDescriptors: 700e55b31d3997fb2bf6d9d84f6172ac17a3d573

PODFILE CHECKSUM: b4a77b28bc7832e680c78bba3eac23a48a0ccfa2
PODFILE CHECKSUM: 763e5e07a7bf1996fe1d09c9a02fe59870b62a0f

COCOAPODS: 1.10.0
COCOAPODS: 1.11.3

0 comments on commit 1feeeea

Please sign in to comment.