1

So I'm making a Dapp that uses the user's secret key to encrypt the data. It also allows another user to encrypt something else using their public key hash, but how do I get the key pairs from the web wallet integrated with my Dapp?

2 Answers 2

2

You can't directly access private keys of your users; those should reside safely in their wallet only.

There is, however, a way you can have their wallet use those keys to sign data that you pass over.

This is described in CIP 30: https://cips.cardano.org/cips/cip30/#apisigndataaddraddresspayloadbytespromisedatasignature

You call this function in the browser like so:

window.cardano.signData(Address, HexMsgToSign)

The wallet will then open a window showing the message and asking the user to sign, and return the signature.

1

You can't access the secret/private key of a wallet connected to your web site.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.