Skip to content

Commit

Permalink
blinding: fix backward compatability of get_master_blinding_key()
Browse files Browse the repository at this point in the history
Introduced in f59f491
  • Loading branch information
JamieDriver committed Mar 20, 2024
1 parent 566e961 commit b0072a4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
14 changes: 2 additions & 12 deletions jadepy/jade.py
Original file line number Diff line number Diff line change
Expand Up @@ -1220,28 +1220,18 @@ def sign_identity(self, identity, curve, challenge, index=0):
params = {'identity': identity, 'curve': curve, 'index': index, 'challenge': challenge}
return self._jadeRpc('sign_identity', params)

def get_master_blinding_key(self, only_if_silent=False):
def get_master_blinding_key(self):
"""
RPC call to fetch the master (SLIP-077) blinding key for the hw signer.
May block temporarily to request the user's permission to export. Passing 'only_if_silent'
causes the call to return the 'denied' error if it would normally ask the user.
NOTE: the master blinding key of any registered multisig wallets can be obtained from
the result of `get_registered_multisigs()`.
Parameters
----------
only_if_silent : boolean, optional
If True Jade will return the denied error if it would normally ask the user's permission
to export the master blinding key. Passing False (or letting default) may block while
asking the user to confirm the export on Jade.
Returns
-------
32-bytes
SLIP-077 master blinding key
"""
params = {'only_if_silent': only_if_silent}
return self._jadeRpc('get_master_blinding_key', params)
return self._jadeRpc('get_master_blinding_key')

def get_blinding_key(self, script, multisig_name=None):
"""
Expand Down
8 changes: 6 additions & 2 deletions main/process/get_master_blinding_key.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,18 @@ void get_master_blinding_key_process(void* process_ptr)
// We expect a current message to be present
ASSERT_CURRENT_MESSAGE(process, "get_master_blinding_key");
ASSERT_KEYCHAIN_UNLOCKED_BY_MESSAGE_SOURCE(process);
GET_MSG_PARAMS(process);

// Ask the user if necessary
if (keychain_get_confirm_export_blinding_key()) {
// Optional field to suppress asking user for permission and instead
// error in the cases where we would normally need to ask the user.
bool onlyIfSilent = false;
rpc_get_boolean("only_if_silent", &params, &onlyIfSilent);

CborValue params;
const CborError cberr = cbor_value_map_find_value(&process->ctx.value, CBOR_RPC_TAG_PARAMS, &params);
if (cberr == CborNoError || cbor_value_is_valid(&params) || cbor_value_is_map(&params)) {
rpc_get_boolean("only_if_silent", &params, &onlyIfSilent);
}

const char* question[] = { "Export master", "blinding key?" };
if (onlyIfSilent || !await_yesno_activity("Blinding Key", question, 2, true, "blkstrm.com/blindingkey")) {
Expand Down

0 comments on commit b0072a4

Please sign in to comment.