Skip to content

Commit

Permalink
chore: jwks.json support
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderPostma committed Oct 25, 2024
1 parent 7f19535 commit 242b861
Show file tree
Hide file tree
Showing 7 changed files with 239 additions and 35 deletions.
8 changes: 4 additions & 4 deletions packages/oid4vci-holder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
"@sphereon/kmp-mdl-mdoc": "0.2.0-SNAPSHOT.22",
"@sphereon/oid4vci-client": "0.16.1-feature.sdk.38.rfc8414.auth.server.metadata.161",
"@sphereon/oid4vci-common": "0.16.1-feature.sdk.38.rfc8414.auth.server.metadata.161",
"@sphereon/ssi-sdk-ext.did-utils": "0.24.1-unstable.130",
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.24.1-unstable.130",
"@sphereon/ssi-sdk-ext.jwt-service": "0.24.1-unstable.130",
"@sphereon/ssi-sdk-ext.key-utils": "0.24.1-unstable.130",
"@sphereon/ssi-sdk-ext.did-utils": "0.24.1-unstable.137",
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.24.1-unstable.137",
"@sphereon/ssi-sdk-ext.jwt-service": "0.24.1-unstable.137",
"@sphereon/ssi-sdk-ext.key-utils": "0.24.1-unstable.137",
"@sphereon/ssi-sdk.contact-manager": "workspace:*",
"@sphereon/ssi-sdk.core": "workspace:*",
"@sphereon/ssi-sdk.credential-store": "workspace:*",
Expand Down
4 changes: 2 additions & 2 deletions packages/oid4vci-issuer-store/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
},
"dependencies": {
"@sphereon/oid4vci-common": "0.16.1-feature.sdk.38.rfc8414.auth.server.metadata.161",
"@sphereon/ssi-sdk-ext.did-utils": "0.24.1-unstable.130",
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.24.1-unstable.130",
"@sphereon/ssi-sdk-ext.did-utils": "0.24.1-unstable.137",
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.24.1-unstable.137",
"@sphereon/ssi-sdk.kv-store-temp": "workspace:*",
"@veramo/core": "4.2.0",
"@veramo/credential-w3c": "4.2.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/oid4vci-issuer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"dependencies": {
"@sphereon/oid4vci-common": "0.16.1-feature.sdk.38.rfc8414.auth.server.metadata.161",
"@sphereon/oid4vci-issuer": "0.16.1-feature.sdk.38.rfc8414.auth.server.metadata.161",
"@sphereon/ssi-sdk-ext.did-utils": "0.24.1-unstable.130",
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.24.1-unstable.130",
"@sphereon/ssi-sdk-ext.did-utils": "0.24.1-unstable.137",
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.24.1-unstable.137",
"@sphereon/ssi-sdk.agent-config": "workspace:*",
"@sphereon/ssi-sdk.core": "workspace:*",
"@sphereon/ssi-sdk.kv-store-temp": "workspace:*",
Expand Down
12 changes: 11 additions & 1 deletion packages/public-key-hosting/src/api-functions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { checkAuth, ISingleEndpointOpts, sendErrorResponse } from '@sphereon/ssi-express-support'
import { ISphereonKeyManager } from '@sphereon/ssi-sdk-ext.key-manager'
import { contextHasPlugin } from '@sphereon/ssi-sdk.agent-config'
import { Request, Response, Router } from 'express'
import { JKWS_HOSTING_ALL_KEYS_PATH, JWKS_HOSTING_DID_KEYS_PATH } from './environment'
import { toJWKS } from './functions'
Expand All @@ -15,8 +17,16 @@ export function getAllJWKSEndpoint(router: Router, context: IRequiredContext, op
logger.info(`All JWKS endpoint enabled, path ${path}`)
router.get(path, checkAuth(opts?.endpoint), async (request: Request, response: Response) => {
try {
if (!contextHasPlugin<ISphereonKeyManager>(context, 'keyManagerListKeys')) {
return sendErrorResponse(
response,
500,
'Key manager plugin that can list keys is not found. Please enable the Sphereon Key Manager plugin if you want to use this endpoint',
)
}
response.statusCode = 202
return response.send({})
const keys = await context.agent.keyManagerListKeys()
return response.send(toJWKS({ keys }))
} catch (e) {
return sendErrorResponse(response, 500, e.message as string, e)
}
Expand Down
2 changes: 1 addition & 1 deletion packages/public-key-hosting/src/environment.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const JKWS_HOSTING_ALL_KEYS_PATH = process.env.JWKS_HOSTING_BASE_PATH ?? '/.well-known/jwks.json'
export const JWKS_HOSTING_DID_KEYS_PATH = process.env.JWKS_HOSTING_BASE_PATH ?? '/.well-known/jwks/dids/:did'
export const JWKS_HOSTING_DID_KEYS_PATH = process.env.JWKS_HOSTING_DID_PATH ?? '/.well-known/jwks/dids/:did'
6 changes: 3 additions & 3 deletions packages/siopv2-oid4vp-rp-auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
"@sphereon/did-auth-siop-adapter": "0.16.1-feature.sdk.38.rfc8414.auth.server.metadata.161",
"@sphereon/oid4vc-common": "0.16.1-feature.sdk.38.rfc8414.auth.server.metadata.161",
"@sphereon/pex": "5.0.0-unstable.9",
"@sphereon/ssi-sdk-ext.did-utils": "0.24.1-unstable.130",
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.24.1-unstable.130",
"@sphereon/ssi-sdk-ext.jwt-service": "0.24.1-unstable.130",
"@sphereon/ssi-sdk-ext.did-utils": "0.24.1-unstable.137",
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.24.1-unstable.137",
"@sphereon/ssi-sdk-ext.jwt-service": "0.24.1-unstable.137",
"@sphereon/ssi-sdk.core": "workspace:*",
"@sphereon/ssi-sdk.kv-store-temp": "workspace:*",
"@sphereon/ssi-sdk.mdl-mdoc": "workspace:*",
Expand Down
Loading

0 comments on commit 242b861

Please sign in to comment.