Skip to content

Commit

Permalink
serve wellknown
Browse files Browse the repository at this point in the history
  • Loading branch information
eike-hass committed May 31, 2024
1 parent a91f24b commit 0135683
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 7 deletions.
11 changes: 11 additions & 0 deletions backend/src/app.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ import { AppService } from './app.service';
export class AppController {
constructor(private readonly appService: AppService) {}

@Get('.well-known/did-configuration.json')
didConfiguration(): string {
return JSON.stringify({
'@context':
'https://identity.foundation/.well-known/did-configuration/v1',
linked_dids: [
'eyJraWQiOiJkaWQ6aW90YTpybXM6MHg0ODY4ZDYxNzczYTlmOGU1NDc0MTI2MWEwZTgyZmM4ODNlMjk5YzI2MTRjOTRiMjQwMGUyNDIzZDRjNWJiZTZhIzBBaWpZdXFQcmNnYVYwU05GMlFRSW9neUs3UVR0MWRNQjhjNDlBUXItZVkiLCJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSJ9.eyJleHAiOjE3MzQwMTM1NjAsImlzcyI6ImRpZDppb3RhOnJtczoweDQ4NjhkNjE3NzNhOWY4ZTU0NzQxMjYxYTBlODJmYzg4M2UyOTljMjYxNGM5NGIyNDAwZTI0MjNkNGM1YmJlNmEiLCJuYmYiOjE3MDI0Nzc1NjAsInN1YiI6ImRpZDppb3RhOnJtczoweDQ4NjhkNjE3NzNhOWY4ZTU0NzQxMjYxYTBlODJmYzg4M2UyOTljMjYxNGM5NGIyNDAwZTI0MjNkNGM1YmJlNmEiLCJ2YyI6eyJAY29udGV4dCI6WyJodHRwczovL3d3dy53My5vcmcvMjAxOC9jcmVkZW50aWFscy92MSIsImh0dHBzOi8vaWRlbnRpdHkuZm91bmRhdGlvbi8ud2VsbC1rbm93bi9kaWQtY29uZmlndXJhdGlvbi92MSJdLCJ0eXBlIjpbIlZlcmlmaWFibGVDcmVkZW50aWFsIiwiRG9tYWluTGlua2FnZUNyZWRlbnRpYWwiXSwiY3JlZGVudGlhbFN1YmplY3QiOnsib3JpZ2luIjoiaHR0cHM6Ly9zZWx2LmlvdGEub3JnLyJ9fX0.OHdWQAa23-v56AEsSHB2EoaViRih8tO-C3DpkhO0h_GwlXcusfuZumYkXc2dPW1aHURAOZKFgbR2nQ-8lqowBg',
],
});
}

@Post('event-listener')
eventListener(@Body() body: any): void {
console.log(body);
Expand Down
4 changes: 0 additions & 4 deletions oid4vc/impierce/event_publisher_config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# Configure here to which events will be dispatched to a specific `target_url`. In the example below, the
# `EventPublisherHttp` will listen for the `SIOPv2AuthorizationResponseVerified` event which is part of the `connection`
# aggregate. The events will be dispatched to the `https://my-domain.example.org/event-subscriber` endpoint.

target_url: &target_url "http://backend:3000/event-listener"

connection: {
Expand Down
64 changes: 61 additions & 3 deletions tooling/API/OID4VC/Impierce/HTTP.http
Original file line number Diff line number Diff line change
@@ -1,20 +1,78 @@
@host=http://insurance.selv.local:81
###
POST /v1/credentials
Content-Type: application/json
{
"offerId": "TBD",
"credential": {
"credentialSubject": "did:key:z6MkfDvsiwx8ddaUitBuwxn8fCfyMZkK7ipQanMVS1FqvchE"
},
"isSigned": false
}
###
GET /v1/credentials/{credential_id}
GET /v1/credentials/TBD
###
POST /v1/offers
Content-Type: application/json
{
"offerId": "0d520cbe176ab9e1f7888c70888020d84a69672a4baabd3ce1c6aaad8f6420c0",
"preAuthorizedCode": "TBD"
}
###
POST /v1/authorization_requests
Content-Type: application/json
{
"nonce": "0d520cbe176ab9e1f7888c70888020d84a69672a4baabd3ce1c6aaad8f6420c0"
}
###
GET /v1/authorization_requests/06adfc99a128b078726c9cca383df3883db1e8dbd0270518bd4af7eb5a8e9191
GET /v1/authorization_requests/66725a3a0219fe0354fd6f95176c2eef978ffeb7a2ba502ec1479cf8a43a03a4
###
{{

const utils = require('../../scripting/dist/bundle5.js');

const jwt = async () => {

const { didDocument, keyPairs } = await utils.getDIDKey();
const { id:did, authentication } = didDocument;

const issuer_did = "test"

const header = {
kid: `${authentication}`,
alg: "EdDSA",
typ: "JWT"
}

const encodedHeaders = Buffer.from(JSON.stringify(header), "utf8").toString("base64url");

const claims = {
"iat": 1714775844,
"request_uri": "http%3A%2F%2Fbank.selv.local%3A81%2Fapi%2Foffer%2F9f38f7c9-708b-4351-99b4-12cc75f9c94c",
"response_type": "id_token",
"state": "7d8d4b3a-e45e-41ce-b9af-4fef1fa5a909",
"nonce": "3X8JDguMcK76sYRZifbRJ",
"client_metadata": {
"subject_syntax_types_supported": [
"did:iota:rms"
]
},
"redirect_uri": "http://insurance.selv.local:81/redirect",
"scope": "openid",
"response_mode": "post",
"client_id": "did:iota:rms:0x29a66aa42902d3ba8a9f4746aee3a30549fef72ccf69ccc60b5b36525deb3ab4"
}
const encodedPayload = Buffer.from(JSON.stringify(claims), "utf8").toString("base64url");

const encodedSignature = await utils.sign(`${encodedHeaders}.${encodedPayload}`)

const jwt = `${encodedHeaders}.${encodedPayload}.${encodedSignature}`;
return jwt;
}
exports.jwt = jwt();
}}

POST /redirect
Content-Type: application/x-www-form-urlencoded

id_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJFZERTQSIsImtpZCI6ImRpZDppb3RhOnJtczoweDI5YTY2YWE0MjkwMmQzYmE4YTlmNDc0NmFlZTNhMzA1NDlmZWY3MmNjZjY5Y2NjNjBiNWIzNjUyNWRlYjNhYjQjOHlCS2w1dmdQcVlKVlN0aEVJdVktdUNUV2JoTnMzcmR4bFBQeFhZQW9pbyJ9.eyJjbGllbnRfaWQiOiJkaWQ6aW90YTpybXM6MHgyOWE2NmFhNDI5MDJkM2JhOGE5ZjQ3NDZhZWUzYTMwNTQ5ZmVmNzJjY2Y2OWNjYzYwYjViMzY1MjVkZWIzYWI0IiwicmVkaXJlY3RfdXJpIjoiaHR0cDovL2luc3VyYW5jZS5zZWx2LmxvY2FsOjgxL3JlZGlyZWN0Iiwic3RhdGUiOiJhYmM2Y2YxYy1kYzgzLTRjNjAtYTA3MC0yZGVlYTkxN2MzZWMiLCJyZXNwb25zZV90eXBlIjoiaWRfdG9rZW4iLCJzY29wZSI6Im9wZW5pZCIsInJlc3BvbnNlX21vZGUiOiJkaXJlY3RfcG9zdCIsIm5vbmNlIjoidGVzdCIsImNsaWVudF9tZXRhZGF0YSI6eyJzdWJqZWN0X3N5bnRheF90eXBlc19zdXBwb3J0ZWQiOlsiZGlkOmlvdGE6cm1zIl19fQ.21VgOxEATtpuQMaEB8Ct2k-oy3LcKCq7FhrjgaIfiQywETJaF_zc1BneRbYhyC4dTkfiYORBOwYrNLWYvDG3Bw
id_token={{jwt}}

0 comments on commit 0135683

Please sign in to comment.