Pera Wallet
This guide will walk you through the process of integrating Sign-In with Algorand (SIWA) using Pera Wallet in your web application.
Last updated
This guide will walk you through the process of integrating Sign-In with Algorand (SIWA) using Pera Wallet in your web application.
Last updated
Install the mobile app for Pera on Apple or Android
Install the Pera Wallet library:
Pera wallet uses a direct message signing approach for SIWA messages. Here's how it works:
Connect to the Pera wallet
Prepare the SIWA message
Sign the message using Pera wallet's signData
method
Verify the signature
To connect to Pera wallet, use the PeraWalletConnect
class:
To sign a SIWA message with Pera wallet:
Prepare the message by hashing and encoding it
Use the peraWallet.signData
method to sign the message
Here's the code to accomplish this:
When verifying the SIWA message signature for Pera wallet, the process is straightforward as it uses direct message signing. Here's how it works:
The verification function receives the following parameters:
message
: The original SIWA message
signature
: The signature in base64 format
provider
: The wallet provider (in this case, "Pera")
The verification process for Pera wallet:
This verification process ensures that:
The message is properly hashed
The signature is valid for the given message and address
Key points to remember for Pera wallet verification:
The algosdk.verifyBytes
function is used to verify the signature against the hashed message and the signer's address.
Any errors during the verification process will result in a false
return value.
Remember to handle any potential errors during the verification process and ensure that all required parameters are provided.