Skip to content
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

Example Contract to write EIP712 credentials on chain #32

Closed
tim-schultz opened this issue Sep 12, 2023 · 4 comments · Fixed by passportxyz/passport#1702 · May be fixed by #33
Closed

Example Contract to write EIP712 credentials on chain #32

tim-schultz opened this issue Sep 12, 2023 · 4 comments · Fixed by passportxyz/passport#1702 · May be fixed by #33
Assignees

Comments

@tim-schultz
Copy link
Contributor

tim-schultz commented Sep 12, 2023

After the migration to compose db all VCs will be signed with an EIP712 signature type. This ticket is meant to create a solidity smart contract that verifies stamps EIP712 signed stamps

@tim-schultz tim-schultz self-assigned this Sep 12, 2023
@tim-schultz tim-schultz converted this from a draft issue Sep 12, 2023
@tim-schultz tim-schultz moved this from Backlog to In Progress (WIP) in Passport Sep 12, 2023
@tim-schultz
Copy link
Contributor Author

tim-schultz commented Sep 13, 2023

From what I'm seeing it looks like we can't produce a valid eip 712 signature without a domain seperator https://eips.ethereum.org/EIPS/eip-712#definition-of-typed-structured-data-%F0%9D%95%8A . It seems like it would still be a valid VC but not a valid

Unfortunately it doesn't look like we can build the VC without providing types to verifyCredential. Writing this part mostly so I don't forget where everything is since there is so much in didkit. here is where they are checking for passed types. If types don't exist generate_proof_info is called and an empty hash is returned as the domain value.

@tim-schultz tim-schultz moved this from In Progress (WIP) to Blocked in Passport Sep 14, 2023
@tim-schultz tim-schultz moved this from Blocked to In Progress (WIP) in Passport Sep 14, 2023
@tim-schultz
Copy link
Contributor Author

After further investigation we have determined that there are some differences between didkits eip712 signature and ethers/solidity. If types are not provided to the VC gneration didkit will sign an empty hash {} as the domain separator which is invalid within solidity/ethers/

Because of this we've decided to keep the types as part of the signature. https://github.com/digitalmnt/passport-vc-verification/tree/main can still act as an example of verifying a EIP712 signed VC

@tim-schultz tim-schultz moved this from In Progress (WIP) to Done in Passport Sep 18, 2023
@tim-schultz tim-schultz moved this from Done to Blocked in Passport Sep 18, 2023
@nutrina nutrina moved this from Blocked to In Progress (WIP) in Passport Sep 20, 2023
@nutrina
Copy link
Contributor

nutrina commented Sep 20, 2023

I have created this script https://github.com/nutrina/passport-vc-verification/blob/test_eip712/utils/didkitVerify.ts
that should verify the validity of a credential with ethers.

This works for credentials generated using: https://github.com/nutrina/passport-vc-verification/blob/test_eip712/utils/didkitSign.ts

But this does not work for credentials generated with Passport (When run on my local).

@nutrina nutrina moved this from In Progress (WIP) to Blocked in Passport Sep 22, 2023
@nutrina
Copy link
Contributor

nutrina commented Sep 22, 2023

We have limited ourselves to validating the credentials with ethers, will create a SC for validation at a later point

@nutrina nutrina moved this from Blocked to Product/UX Review in Passport Sep 22, 2023
@nutrina nutrina moved this from Product/UX Review to Ready to Deploy in Passport Sep 22, 2023
@erichfi erichfi moved this from Ready to Deploy to Done in Passport Sep 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants