1

i have built an in game User interface around Cardano-wallet. now im looking for a way to let the player sign in using his wallet .

how can i approach it using cardano-wallet? is there a way to let the player sign some data using his private key , then on the server side i decode it using his public key ?

( one of the solutions i tried is to let the player send 1 ADA from his wallet to a server provided address , and i monitor the transaction to verify ... but bad approach obviously ..)

thank you for your attention. enter image description here

2 Answers 2

1

will wait for message sign / verify gets added to cardano-wallet api itself , https://github.com/input-output-hk/cardano-wallet/issues/3537 implementing it from scratch or doing other hacky ways will be inconvenient.

0

If your game is not browser based, one way to do this is to create a small website on which you let the user sign a message with a browser based wallet. The website can then send the signed message to your server.

To do this you can use the signData() method as specified in CIP-30.

Or if you have the private key of the user's wallet in your game, you can sign a message in your game and send it to the server.

On your server, you have to verify that the message is signed correctly. You can do this using the cardano-serialization-lib. More details on message signing can be found in CIP-8.

If the message is signed correctly, you can return something like an access token (e.g. a JWT) to the user.


This is a very simple example on how this could work and there are a lot of things you'd need to consider when you implement this like franken-address attacks or token lifetimes etc.

1
  • Thank you for your suggestion , i was looking for a way that wont force the user to leave the game or get interrupted from his virtual experience ( could be VR , PS5 , anywhere.. ) . github.com/input-output-hk/cardano-wallet/issues/3537 having the message sign-in / verify added to the cardano-wallet api itself , would do the trick. happpy to wait for that .
    – Nabil
    Oct 18, 2022 at 16:37

Your Answer

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

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