Skip to content

Commit

Permalink
refactor oid4vc api
Browse files Browse the repository at this point in the history
  • Loading branch information
eike-hass committed May 2, 2024
1 parent 5f379a0 commit 53eb0cf
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
10 changes: 5 additions & 5 deletions oid4vc/TangleLabs/src/httpServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ export const createServer = (
})
);

app.route("/token").get(
app.route("/api/token").get(
asyncHandler(async (req, res) => {
res.json(await issuer.createTokenResponse(req.body));
})
);

app.route("/api/offer/:id").post(
app.route("/api/offer/:id").get(
asyncHandler(async (req, res) => {
const offer_id = req.params.id;

Expand All @@ -42,7 +42,7 @@ export const createServer = (
})
);

app.route("/api/credential-offer/:id").post(
app.route("/api/credential-offer/:id").get(
asyncHandler(async (req, res) => {
const offer_id = req.params.id;

Expand Down Expand Up @@ -91,14 +91,14 @@ export const createServer = (
})
);

app.route("/.well-known/openid-credential-issuer").post(
app.route("/.well-known/openid-credential-issuer").get(
asyncHandler(async (req, res) => {
const metadata = issuer.getIssuerMetadata();
res.send(metadata);
})
);

app.route("/.well-known/oauth-authorization-server").post(
app.route("/.well-known/oauth-authorization-server").get(
asyncHandler(async (req, res) => {
const metadata = issuer.getOauthServerMetadata();
res.send(metadata);
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 @@ -68,7 +68,7 @@ import {Cache} from './cache';
kid: `${process.env.RP_DID}#${process.env.KEY_FRAGMENT}`,
cryptographicSuitesSupported: [SigningAlgs.EdDSA],
store: createStore(),
tokenEndpoint: `http://${process.env.PUBLIC_URL}/token`,
tokenEndpoint: `http://${process.env.PUBLIC_URL}/api/token`,
supportedCredentials: [
{
name: "wa_driving_license",
Expand Down
15 changes: 6 additions & 9 deletions tooling/API/OID4VC/TangleLabs/HTTP.http
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
@host=http://insurance.selv.iota.org
@host=http://bank.selv.local:81
###
GET /api/health
###
GET /api/token
###
GET /.well-known/oauth-authorization-server
###
GET /.well-known/openid-credential-issuer
###
GET /auth/token
###
GET /openid4vci/credential
POST /api/credential
###
GET /request/032f4ed9fbe94e6ea1b58e0a97f011dc4a6ca21e260da715c23bbf717574a434
GET /api/credential-offer/05c438e5-f27a-4572-b57b-8b2be990b6ba
###
POST /redirect
Content-Type: application/x-www-form-urlencoded

id_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSIsImtpZCI6ImRpZDppb3RhOnJtczoweGY4MGM1MTM0OGNmMzIzOGRmMTEzMzE1NmM3ODk2NWQxZDVmOWFiYTJiZjA3MGMyM2ZiYmI5NmVkYjMzNmUxNTQjbVpYbTltSndqN2Q2WHJtejIxS3VvRDA3ZXhvM0lTOVlWWXFwTlk1RjhYSSJ9
GET /api/offer/05c438e5-f27a-4572-b57b-8b2be990b6ba
###
{{
const crypto = require('crypto');
Expand Down

0 comments on commit 53eb0cf

Please sign in to comment.