Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✏️ add public #171

Merged
merged 2 commits into from
Sep 27, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Sources/BitcoinKit/Core/Keys/HDKeychain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
import Foundation

public final class HDKeychain {
let privateKey: HDPrivateKey
private let rootKey: HDPrivateKey

init(privateKey: HDPrivateKey) {
self.privateKey = privateKey
public init(rootKey: HDPrivateKey) {
self.rootKey = rootKey
}

public convenience init(seed: Data, network: Network) {
self.init(privateKey: HDPrivateKey(seed: seed, network: network))
self.init(rootKey: HDPrivateKey(seed: seed, network: network))
}
/// Parses the BIP32 path and derives the chain of keychains accordingly.
/// Path syntax: (m?/)?([0-9]+'?(/[0-9]+'?)*)?
Expand All @@ -54,8 +54,8 @@ public final class HDKeychain {
/// "m / 0 / 1" (contains spaces)
/// "m/b/c" (alphabetical characters instead of numerical indexes)
/// "m/1.2^3" (contains illegal characters)
func derivedKey(path: String) throws -> HDPrivateKey {
var key = privateKey
public func derivedKey(path: String) throws -> HDPrivateKey {
var key = rootKey

var path = path
if path == "m" || path == "/" || path == "" {
Expand Down