This Canister code allows you to use a custom signature verification method
to grant the frontend a Delegation Identity verified by the InternetComputer Blockchain (similar to InternetIdentity).
- You can create a Principal in a customized manner and bind this Principal with the session key generated by the frontend.
- By modifying the verification signature method,you can allow any wallet to sign and interact with the InternetComputer.
- ATTENTION: This project is for instructional use. Developers can modify the code themselves to better adapt it to their projects.
The Rust file within the custom delegation package contains the core code for delegating identity verification and authorization to Metamask accounts using certified variables. The operational mechanism involves initial validation of the Metamask signature, recovering the public key and address from the signature. Subsequently, a seed is computed from the address using a sha256 hash, and this seed is then certified to generate a delegation identity. Please note that the direct sha256 calculation of the seed from the address in this source code is not secure. Prior to usage, it's recommended to add a random number to the address to mitigate potential security issues. The specific requirements for the random number aren't defined.
The "Validator" directory contains code for validating MetaMask Personal Sign.
The "Example" folder contains explanations on how CertifiedData is used and verified.
You can use js-sdk as a JavaScript npm dependency to interact with custom delegation canister.