Skip to content

Commit

Permalink
fix token service
Browse files Browse the repository at this point in the history
  • Loading branch information
eike-hass committed May 2, 2024
1 parent 53eb0cf commit 92cb7c1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
3 changes: 1 addition & 2 deletions oid4vc/TangleLabs/src/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ export class Cache<K,V> {
}

async consumeItem(key: K) {
const item = this.memoryCache.retrieveItemValue(key);
const item = this.memoryCache.retrieveItemValue(key);
this.memoryCache.removeItem(key);
return item;
}

private generate
}
4 changes: 2 additions & 2 deletions oid4vc/TangleLabs/src/httpServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const createServer = (
asyncHandler(async (req, res) => {
const offer_id = req.params.id;

const offer = tokenCache.consumeItem(offer_id);
const offer = await tokenCache.consumeItem(offer_id);

if (!offer) {
res.status(500).send();
Expand All @@ -46,7 +46,7 @@ export const createServer = (
asyncHandler(async (req, res) => {
const offer_id = req.params.id;

const offer = credentialCache.consumeItem(offer_id);
const offer = await credentialCache.consumeItem(offer_id);

if (!offer) {
res.status(500).send();
Expand Down
2 changes: 1 addition & 1 deletion oid4vc/TangleLabs/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ import {Cache} from './cache';
});

const userService = new UserService();
const tokenCache = await Cache.init<string, any>();
const tokenCache = await Cache.init<string, string>();
const credentialCache = await Cache.init<string, any>();


Expand Down
7 changes: 6 additions & 1 deletion tooling/API/OID4VC/Impierce/HTTP.http
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,9 @@ Content-Type: application/json
"nonce": "0d520cbe176ab9e1f7888c70888020d84a69672a4baabd3ce1c6aaad8f6420c0"
}
###
GET /v1/authorization_requests/06adfc99a128b078726c9cca383df3883db1e8dbd0270518bd4af7eb5a8e9191
GET /v1/authorization_requests/06adfc99a128b078726c9cca383df3883db1e8dbd0270518bd4af7eb5a8e9191
###
POST /redirect
Content-Type: application/x-www-form-urlencoded

id_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSIsImtpZCI6ImRpZDppb3RhOnJtczoweGY4MGM1MTM0OGNmMzIzOGRmMTEzMzE1NmM3ODk2NWQxZDVmOWFiYTJiZjA3MGMyM2ZiYmI5NmVkYjMzNmUxNTQjbVpYbTltSndqN2Q2WHJtejIxS3VvRDA3ZXhvM0lTOVlWWXFwTlk1RjhYSSJ9

0 comments on commit 92cb7c1

Please sign in to comment.