1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-22 07:28:10 +00:00

feat(proto): add descriptors related fields to GetPublicKey/PublicKey

This commit is contained in:
Pavol Rusnak 2020-11-21 11:11:53 +01:00
parent 9ba1c9aa50
commit edb1243f64
5 changed files with 15 additions and 1 deletions

View File

@ -62,6 +62,7 @@ message GetPublicKey {
optional bool show_display = 3; // optionally show on display before sending the result
optional string coin_name = 4 [default='Bitcoin']; // coin to use for verifying
optional InputScriptType script_type = 5 [default=SPENDADDRESS]; // used to distinguish between various address formats (non-segwit, segwit, etc.)
optional bool ignore_xpub_magic = 6; // ignore SLIP-0132 XPUB magic, use xpub/tpub prefix for all account types
}
/**
@ -71,6 +72,7 @@ message GetPublicKey {
message PublicKey {
optional common.HDNodeType node = 1; // BIP32 public node
optional string xpub = 2; // serialized form of public node
optional uint32 root_fingerprint = 3; // master root node fingerprint
}
/**

View File

@ -22,12 +22,14 @@ class GetPublicKey(p.MessageType):
show_display: bool = None,
coin_name: str = "Bitcoin",
script_type: EnumTypeInputScriptType = 0,
ignore_xpub_magic: bool = None,
) -> None:
self.address_n = address_n if address_n is not None else []
self.ecdsa_curve_name = ecdsa_curve_name
self.show_display = show_display
self.coin_name = coin_name
self.script_type = script_type
self.ignore_xpub_magic = ignore_xpub_magic
@classmethod
def get_fields(cls) -> Dict:
@ -37,4 +39,5 @@ class GetPublicKey(p.MessageType):
3: ('show_display', p.BoolType, None),
4: ('coin_name', p.UnicodeType, "Bitcoin"), # default=Bitcoin
5: ('script_type', p.EnumType("InputScriptType", (0, 1, 2, 3, 4)), 0), # default=SPENDADDRESS
6: ('ignore_xpub_magic', p.BoolType, None),
}

View File

@ -20,13 +20,16 @@ class PublicKey(p.MessageType):
*,
node: HDNodeType = None,
xpub: str = None,
root_fingerprint: int = None,
) -> None:
self.node = node
self.xpub = xpub
self.root_fingerprint = root_fingerprint
@classmethod
def get_fields(cls) -> Dict:
return {
1: ('node', HDNodeType, None),
2: ('xpub', p.UnicodeType, None),
3: ('root_fingerprint', p.UVarintType, None),
}

View File

@ -22,12 +22,14 @@ class GetPublicKey(p.MessageType):
show_display: bool = None,
coin_name: str = "Bitcoin",
script_type: EnumTypeInputScriptType = 0,
ignore_xpub_magic: bool = None,
) -> None:
self.address_n = address_n if address_n is not None else []
self.ecdsa_curve_name = ecdsa_curve_name
self.show_display = show_display
self.coin_name = coin_name
self.script_type = script_type
self.ignore_xpub_magic = ignore_xpub_magic
@classmethod
def get_fields(cls) -> Dict:
@ -37,4 +39,5 @@ class GetPublicKey(p.MessageType):
3: ('show_display', p.BoolType, None),
4: ('coin_name', p.UnicodeType, "Bitcoin"), # default=Bitcoin
5: ('script_type', p.EnumType("InputScriptType", (0, 1, 2, 3, 4)), 0), # default=SPENDADDRESS
6: ('ignore_xpub_magic', p.BoolType, None),
}

View File

@ -20,13 +20,16 @@ class PublicKey(p.MessageType):
*,
node: HDNodeType = None,
xpub: str = None,
root_fingerprint: int = None,
) -> None:
self.node = node
self.xpub = xpub
self.root_fingerprint = root_fingerprint
@classmethod
def get_fields(cls) -> Dict:
return {
1: ('node', HDNodeType, None),
2: ('xpub', p.UnicodeType, None),
3: ('root_fingerprint', p.UVarintType, None),
}