diff --git a/package.json b/package.json index 96f4cf6..80bccec 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "type": "module", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "dev": "SERVER_URL=https://e756-2a02-587-8716-3600-5055-a1a8-76c2-c9a6.ngrok-free.app node server.js" + "dev": "SERVER_URL=https://5e40-2a02-587-8716-3600-20a7-3d19-b22b-ca04.ngrok-free.app node server.js" }, "author": "", "license": "ISC", diff --git a/routes/routes.js b/routes/routes.js index cd46ce0..396bf53 100644 --- a/routes/routes.js +++ b/routes/routes.js @@ -5,6 +5,7 @@ import { pemToJWK, generateNonce, base64UrlEncodeSha256, + buildVpRequestJwt } from "../utils/cryptoUtils.js"; import { buildAccessToken, @@ -220,8 +221,9 @@ router.get("/authorize", async (req, res) => { //5.1.5. Dynamic Credential Request https://openid.net/specs/openid-4-verifiable-credential-issuance-1_0-12.html#name-successful-authorization-re - const redirectUrl = `http://localhost:8080?state=${state}&client_id=${clientId}&redirect_uri=${serverURL}/direct_post_vci&response_type=id_token& - response_mode=direct_post&scope=openid&nonce=${nonce}&request_uri=http://localhost:8080` + const request_uri = buildVpRequestJwt(state,nonce,clientId,"response_uri",null,"jwk",serverURL,privateKey); + const redirectUrl = `http://localhost:8080?state=${state}&client_id=${clientId}&redirect_uri=${serverURL}/direct_post_vci&response_type=id_token&response_mode=direct_post&scope=openid&nonce=${nonce}&request=${request_uri}` + if (errors.length > 0) { @@ -241,6 +243,9 @@ router.get("/authorize", async (req, res) => { } }); + + + router.post("/direct_post_vci", async (req, res) => { console.log("direct_post VP for VCI is below!"); let state = req.body["state"]