Skip to content

Commit

Permalink
bug fix with multiple sesion generation
Browse files Browse the repository at this point in the history
  • Loading branch information
endimion committed Apr 25, 2024
1 parent da45c3a commit 3547bb9
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 19 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "SERVER_URL=https://e291-2a02-587-870e-d900-e57-8841-12f9-5aca.ngrok-free.app node server.js"
"dev": "SERVER_URL=https://a8a3-2a02-587-870e-d900-4edf-d4c0-8e40-c64b.ngrok-free.app node server.js"
},
"author": "",
"license": "ISC",
Expand Down
39 changes: 22 additions & 17 deletions routes/codeFlowJwtRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ codeFlowRouter.get(["/offer-code"], async (req, res) => {
const codeSessions = getAuthCodeSessions();
if (codeSessions.sessions.indexOf(uuid) < 0) {
codeSessions.sessions.push(uuid);
codeSessions.results.push({ sessionId: uuid, status: "pending" });
// codeSessions.results.push({ sessionId: uuid, status: "pending" });
}

// console.log("active sessions");
Expand Down Expand Up @@ -99,22 +99,27 @@ codeFlowRouter.get("/authorize", async (req, res) => {

// If validations pass, redirect with a 302 Found response
const authorizationCode = null; //"SplxlOBeZQQYbYS6WxSbIA";
const codeSessions = getAuthCodeSessions();
codeSessions.requests.push({
challenge: codeChallenge,
method: codeChallengeMethod,
sessionId: authorizationCode,
issuerState: issuerState,
state: state,
});
codeSessions.results.push({
sessionId: authorizationCode,
issuerState: issuerState,
state: state,
status: "pending",
});
codeSessions.walletSessions.push(state); // push state as send by wallet
codeSessions.sessions.push(issuerState);
if (codeSessions.sessions.indexOf(issuerState)) {
const codeSessions = getAuthCodeSessions();
codeSessions.requests.push({
challenge: codeChallenge,
method: codeChallengeMethod,
sessionId: authorizationCode,
issuerState: issuerState,
state: state,
});
codeSessions.results.push({
sessionId: authorizationCode,
issuerState: issuerState,
state: state,
status: "pending",
});
codeSessions.walletSessions.push(state); // push state as send by wallet
}else{
console.log("ITB session not found")
}

// codeSessions.sessions.push(issuerState);

// for normal response not requesting VP from wallet
//const redirectUrl = `${redirectUri}?code=${authorizationCode}&state=${state}`;
Expand Down
2 changes: 1 addition & 1 deletion routes/codeFlowSdJwtRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ codeFlowRouterSDJWT.get(["/offer-code-sd-jwt"], async (req, res) => {
const codeSessions = getAuthCodeSessions();
if (codeSessions.sessions.indexOf(uuid) < 0) {
codeSessions.sessions.push(uuid);
codeSessions.results.push({ sessionId: uuid, status: "pending" });
// codeSessions.results.push({ sessionId: uuid, status: "pending" });
}
let credentialOffer = `openid-credential-offer://?credential_offer_uri=${serverURL}/credential-offer-code-sd-jwt/${uuid}`;

Expand Down

0 comments on commit 3547bb9

Please sign in to comment.