mirror of
https://github.com/sparrowwallet/drongo.git
synced 2024-12-25 01:26:45 +00:00
allow hardened character selection when writing key
This commit is contained in:
parent
96df6284e1
commit
efc9d9d554
1 changed files with 6 additions and 1 deletions
|
@ -623,12 +623,17 @@ public class OutputDescriptor {
|
|||
}
|
||||
|
||||
public static String writeKey(ExtendedKey pubKey, KeyDerivation keyDerivation, String childDerivation, boolean addKeyOrigin, boolean addKey) {
|
||||
return writeKey(pubKey, keyDerivation, childDerivation, addKeyOrigin, addKey, false);
|
||||
}
|
||||
|
||||
public static String writeKey(ExtendedKey pubKey, KeyDerivation keyDerivation, String childDerivation, boolean addKeyOrigin, boolean addKey, boolean useApostrophes) {
|
||||
StringBuilder keyBuilder = new StringBuilder();
|
||||
if(keyDerivation != null && keyDerivation.getMasterFingerprint() != null && keyDerivation.getMasterFingerprint().length() == 8 && Utils.isHex(keyDerivation.getMasterFingerprint()) && addKeyOrigin) {
|
||||
keyBuilder.append("[");
|
||||
keyBuilder.append(keyDerivation.getMasterFingerprint());
|
||||
if(!keyDerivation.getDerivation().isEmpty()) {
|
||||
keyBuilder.append(keyDerivation.getDerivationPath().replaceFirst("^m?/", "/").replace('\'', 'h'));
|
||||
String path = keyDerivation.getDerivationPath().replaceFirst("^m?/", "/");
|
||||
keyBuilder.append(useApostrophes ? path : path.replace('\'', 'h'));
|
||||
}
|
||||
keyBuilder.append("]");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue