Merge branch 'satochip_debug' into satochip

This commit is contained in:
Toporin 2023-09-06 11:37:46 +01:00
commit 85c370c84a
2 changed files with 21 additions and 1 deletions

View file

@ -307,6 +307,13 @@ public class ECKey {
return pub.getEncoded();
}
/**
* Gets the raw public key value in compressed or uncompressed form. This is needed by Satochip
*/
public byte[] getPubKey(Boolean compressed) {
return pub.getEncoded(compressed);
}
/**
* Gets the x coordinate of the raw public key value. This appears in transaction scriptPubKeys for Taproot outputs.
*/

View file

@ -4,7 +4,7 @@ import java.util.Locale;
public enum WalletModel {
SEED, SPARROW, BITCOIN_CORE, ELECTRUM, TREZOR_1, TREZOR_T, COLDCARD, LEDGER_NANO_S, LEDGER_NANO_X, DIGITALBITBOX_01, KEEPKEY, SPECTER_DESKTOP, COBO_VAULT,
BITBOX_02, SPECTER_DIY, PASSPORT, BLUE_WALLET, KEYSTONE, SEEDSIGNER, CARAVAN, GORDIAN_SEED_TOOL, JADE, LEDGER_NANO_S_PLUS, EPS, TAPSIGNER, SATSCARD, LABELS, BSMS;
BITBOX_02, SPECTER_DIY, PASSPORT, BLUE_WALLET, KEYSTONE, SEEDSIGNER, CARAVAN, GORDIAN_SEED_TOOL, JADE, LEDGER_NANO_S_PLUS, EPS, TAPSIGNER, SATSCARD, SATOCHIP, LABELS, BSMS;
public static WalletModel getModel(String model) {
return valueOf(model.toUpperCase(Locale.ROOT));
@ -70,6 +70,19 @@ public enum WalletModel {
return (this == TAPSIGNER || this == SATSCARD);
}
// for card devices that require a PIN code, returns the minimum size of valid PIN code
public int getMinPinLength() {
if (this == TAPSIGNER || this == SATSCARD){
return 6;
}
else if (this == SATOCHIP){
return 4;
}
else {
return 0; // default?
}
}
public static WalletModel fromType(String type) {
for(WalletModel model : values()) {
if(model.getType().equalsIgnoreCase(type)) {