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

INTERNAL PR VidosResolver example #1

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.DS_Store
**/**/node_modules/
**/.env
2 changes: 2 additions & 0 deletions verifier-integration/js/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
VIDOS_RESOLVER_URL=
VIDOS_API_KEY=
2 changes: 2 additions & 0 deletions verifier-integration/js/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
VIDOS_RESOLVER_URL=<INSERT_RESOLVER_ENDPOINT_HERE>
VIDOS_API_KEY=<INSERT_API_KEY_HERE>
13 changes: 11 additions & 2 deletions verifier-integration/js/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require("dotenv").config();
const path = require("path");
const express = require("express");
const { auth, resolver, protocol } = require("@iden3/js-iden3-auth");
const { auth, resolver, VidosResolver } = require("@iden3/js-iden3-auth");
const getRawBody = require("raw-body");

const app = express();
Expand Down Expand Up @@ -85,9 +86,17 @@ async function callback(req, res) {
ethURL,
contractAddress
);
const vidosResolver =
process.env.VIDOS_RESOLVER_URL && process.env.VIDOS_API_KEY
? new VidosResolver(
process.env.VIDOS_RESOLVER_URL,
process.env.VIDOS_API_KEY,
'amoy'
)
: undefined;

const resolvers = {
["polygon:amoy"]: ethStateResolver,
["polygon:amoy"]: vidosResolver ?? ethStateResolver,
};

// fetch authRequest from sessionID
Expand Down
13 changes: 13 additions & 0 deletions verifier-integration/js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion verifier-integration/js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"dependencies": {
"@iden3/js-iden3-auth": "1.3.2",
"express": "^4.18.2"
"@iden3/js-iden3-core": "^1.3.1",
"express": "^4.18.2",
"dotenv": "^16.4.5"
}
}