walletrpc: use bytes to represent master key fingerprint

The integer representation is not common and using bytes allows users to
easily confirm whether their master key fingerprint is correct.
This commit is contained in:
Wilmer Paulino committed 2021-05-07 13:07:10 -07:00
1 parent f7b130b5ca
commit e079a9583c
5 files changed
+54 -30

No files matched your search

+12 -10
View File
@@ -723,8 +723,9 @@ type Account struct {
//
//The fingerprint of the root key from which the account public key was
//derived from. This will always be zero for the default imported account in
//which single public keys are imported into.
MasterKeyFingerprint uint32 `protobuf:"varint,4,opt,name=master_key_fingerprint,json=masterKeyFingerprint,proto3" json:"master_key_fingerprint,omitempty"`
//which single public keys are imported into. The bytes are in big-endian
//order.
MasterKeyFingerprint []byte `protobuf:"bytes,4,opt,name=master_key_fingerprint,json=masterKeyFingerprint,proto3" json:"master_key_fingerprint,omitempty"`
//
//The derivation path corresponding to the account public key. This will
//always be empty for the default imported account in which single public keys
@@ -797,11 +798,11 @@ func (x *Account) GetExtendedPublicKey() string {
return ""
}
func (x *Account) GetMasterKeyFingerprint() uint32 {
func (x *Account) GetMasterKeyFingerprint() []byte {
if x != nil {
return x.MasterKeyFingerprint
}
return 0
return nil
}
func (x *Account) GetDerivationPath() string {
@@ -951,8 +952,9 @@ type ImportAccountRequest struct {
//
//The fingerprint of the root key (also known as the key with derivation path
//m/) from which the account public key was derived from. This may be required
//by some hardware wallets for proper identification and signing.
MasterKeyFingerprint uint32 `protobuf:"varint,3,opt,name=master_key_fingerprint,json=masterKeyFingerprint,proto3" json:"master_key_fingerprint,omitempty"`
//by some hardware wallets for proper identification and signing. The bytes
//must be in big-endian order.
MasterKeyFingerprint []byte `protobuf:"bytes,3,opt,name=master_key_fingerprint,json=masterKeyFingerprint,proto3" json:"master_key_fingerprint,omitempty"`
//
//An address type is only required when the extended account public key has a
//legacy version (xpub, tpub, etc.), such that the wallet cannot detect what
@@ -1013,11 +1015,11 @@ func (x *ImportAccountRequest) GetExtendedPublicKey() string {
return ""
}
func (x *ImportAccountRequest) GetMasterKeyFingerprint() uint32 {
func (x *ImportAccountRequest) GetMasterKeyFingerprint() []byte {
if x != nil {
return x.MasterKeyFingerprint
}
return 0
return nil
}
func (x *ImportAccountRequest) GetAddressType() AddressType {
@@ -2841,7 +2843,7 @@ var file_walletrpc_walletkit_proto_rawDesc = []byte{
0x63, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x65, 0x78, 0x74,
0x65, 0x6e, 0x64, 0x65, 0x64, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x4b, 0x65, 0x79, 0x12, 0x34,
0x0a, 0x16, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x66, 0x69, 0x6e,
0x67, 0x65, 0x72, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x14,
0x67, 0x65, 0x72, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x14,
0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x46, 0x69, 0x6e, 0x67, 0x65, 0x72, 0x70,
0x72, 0x69, 0x6e, 0x74, 0x12, 0x27, 0x0a, 0x0f, 0x64, 0x65, 0x72, 0x69, 0x76, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x64,
@@ -2872,7 +2874,7 @@ var file_walletrpc_walletkit_proto_rawDesc = []byte{
0x52, 0x11, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x64, 0x65, 0x64, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63,
0x4b, 0x65, 0x79, 0x12, 0x34, 0x0a, 0x16, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x5f, 0x6b, 0x65,
0x79, 0x5f, 0x66, 0x69, 0x6e, 0x67, 0x65, 0x72, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x18, 0x03, 0x20,
0x01, 0x28, 0x0d, 0x52, 0x14, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x46, 0x69,
0x01, 0x28, 0x0c, 0x52, 0x14, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x4b, 0x65, 0x79, 0x46, 0x69,
0x6e, 0x67, 0x65, 0x72, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x12, 0x39, 0x0a, 0x0c, 0x61, 0x64, 0x64,
0x72, 0x65, 0x73, 0x73, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32,
0x16, 0x2e, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x72, 0x70, 0x63, 0x2e, 0x41, 0x64, 0x64, 0x72,