0

I have a dApp where you login with your Elrond wallet and you generate a signature (containing the wallet address and some more data).

While making requests to an endpoint, I pass the signature on payload and I need to verify it on the backend (so you can't change the wallet address and make requests on someone else's behalf).

I am using PHP with Laravel Framework.

How can I verify the signature on the backend and get the wallet address?

TylerH
  • 20,799
  • 66
  • 75
  • 101
GPaul
  • 35
  • 6

1 Answers1

0

i've written a Laravel SDK for Elrond that can help you with that, or you can copy the logic from: https://github.com/Superciety/elrond-sdk-laravel

note: it's still work in progress & mostly undocumented - i'd welcome any contributions

to verify signatures coming from your dapp, you'd use it this way:

$isValid = Elrond::crypto()->verifyLogin($token, $signature, $address);

where $token is an arbitrary string unique to the user's session to avoid replay

michavie
  • 16
  • 1
  • 1
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 07 '22 at 11:45