Skip to content

Commit

Permalink
Merge pull request #3407 from Emurgo/feat/YOEXT-958/cip95-sign-data
Browse files Browse the repository at this point in the history
implement CIP95 signData
  • Loading branch information
vsubhuman authored Jan 31, 2024
2 parents 928c69e + 0e31e91 commit dfabe15
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/yoroi-connector/src/cardanoApiInject.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@
.then(({ key, isRegistered }) => isRegistered ? [] : [key]);
},

signData(address, payload) {
return CardanoAPI._cardano_rpc_call("cip95_sign_data", [address, payload]);
},

})

experimental = Object.freeze({
Expand Down
1 change: 1 addition & 0 deletions packages/yoroi-extension/chrome/extension/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -1137,6 +1137,7 @@ async function handleInjectorMessage(message, sender) {
}
break;
case 'sign_data':
case 'cip95_sign_data':
try {
const rawAddress = message.params[0];
const payload = message.params[1];
Expand Down
5 changes: 5 additions & 0 deletions packages/yoroi-extension/chrome/extension/connector/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -1242,6 +1242,11 @@ export async function getAddressing(
return rewardAddressing;
}

const [ dRepPubKey, dRepAddressing ] = await _getDRepKeyAndAddressing(publicDeriver);
if (dRepPubKey.hash().to_hex() === address) {
return dRepAddressing;
}

const withUtxos = asGetAllUtxos(publicDeriver);
if (!withUtxos) {
throw new Error('unable to get UTxO addresses from public deriver');
Expand Down

0 comments on commit dfabe15

Please sign in to comment.