-
Notifications
You must be signed in to change notification settings - Fork 2
Register dApp with EVM account #171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request adds support for dApp registration using an EVM account by introducing new signature verification logic and address conversion.
- Introduces EVM signature verification with ethers.verifyMessage
- Converts EVM addresses to SS58 format when constructing the verification payload
- Updates the developer check to use the converted SS58 address
| ): Promise<boolean> { | ||
| const api = this._apiFactory.getApiInstance(network); | ||
| const isEvmSigner = isEthereumAddress(senderAddress); | ||
| const ss58SenderAddress = isEvmSigner ? evmToAddress(senderAddress, ASTAR_SS58_FORMAT) : senderAddress; |
Copilot
AI
May 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider adding an inline comment explaining why the sender address is converted to SS58 format for EVM signers and how this conversion aligns with the expected payload format.
| const signerAddress = ethers.verifyMessage(messageToVerify, signature); | ||
| isValidSignature = signerAddress.toLowerCase() === senderAddress.toLowerCase(); |
Copilot
AI
May 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider wrapping ethers.verifyMessage in a try-catch block to gracefully handle potential exceptions during signature verification for EVM signers.
| const signerAddress = ethers.verifyMessage(messageToVerify, signature); | |
| isValidSignature = signerAddress.toLowerCase() === senderAddress.toLowerCase(); | |
| try { | |
| const signerAddress = ethers.verifyMessage(messageToVerify, signature); | |
| isValidSignature = signerAddress.toLowerCase() === senderAddress.toLowerCase(); | |
| } catch (error) { | |
| console.error('Error verifying EVM signature:', error); | |
| isValidSignature = false; | |
| } |
|
Visit the preview URL for this PR (updated for commit 1b4c096): https://astar-token-api--pr171-feat-register-dapp-h-xya6fcmg.web.app (expires Fri, 30 May 2025 11:23:14 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: f99fa4f4f8f3bb450e6e842f7e1c7783d6d896a3 |
|
This is an intriguing improvement. |
This PR enables a dApp registration with EVM account. Until now the registration was possible with SS58 account only.