Skip to content

This demo discribe how to verify certifed_data returned by ICP and how to use it

Notifications You must be signed in to change notification settings

eliezhao/CustomDelegation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Custom Delegation Overview

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).

Functions:

  • 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.

Contracts

Custom Delegation

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.

Validator

The "Validator" directory contains code for validating MetaMask Personal Sign.

Example

The "Example" folder contains explanations on how CertifiedData is used and verified.

Others

You can use js-sdk as a JavaScript npm dependency to interact with custom delegation canister.

About

This demo discribe how to verify certifed_data returned by ICP and how to use it

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages