Skip to content

Commit

Permalink
feat: implement Oid4VP authorization token support
Browse files Browse the repository at this point in the history
  • Loading branch information
nklomp committed Jun 14, 2024
1 parent d8869e4 commit 5fdbd65
Show file tree
Hide file tree
Showing 14 changed files with 508 additions and 249 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { fetch } from 'cross-fetch'
import express, { Application, NextFunction, Request, Response } from 'express'
import { importJWK, JWK, SignJWT } from 'jose'
import * as http from 'node:http'
import { EBSIScope, IEBSIAuthorizationClient, ScopeByDefinition } from '../../src'
import { EbsiEnvironment, IEBSIAuthorizationClient, ScopeByDefinition } from '../../src'

type ConfiguredAgent = TAgent<IKeyManager & IDIDManager & IDidAuthSiopOpAuthenticator & IEBSIAuthorizationClient>

Expand Down Expand Up @@ -241,12 +241,12 @@ export default (testContext: { getAgent: () => ConfiguredAgent; setup: () => Pro
})
.sign(importedJwk)
console.log(`URL: ${url}&request=${urlWithRequest}`)
const result = await fetch(`${url}&request=${urlWithRequest}`)
console.log(await result.text())
/* const result = await fetch(`${url}&request=${urlWithRequest}`)
console.log(await result.text())*/
})

it.skip('Should retrieve the discovery metadata', async () => {
await expect(agent.ebsiAuthASDiscoveryMetadataGet()).resolves.toEqual({
await expect(agent.ebsiAuthASDiscoveryMetadataGet({ environment: EbsiEnvironment.PILOT })).resolves.toEqual({
authorization_endpoint: 'https://api-pilot.ebsi.eu/authorisation/v4/authorize',
grant_types_supported: ['vp_token'],
id_token_signing_alg_values_supported: ['none'],
Expand Down Expand Up @@ -304,7 +304,7 @@ export default (testContext: { getAgent: () => ConfiguredAgent; setup: () => Pro
})

it.skip('should retrieve the presentation definition to onboard', async () => {
await expect(agent.ebsiAuthPresentationDefinitionGet({ scope: EBSIScope.didr_invite })).resolves.toEqual({
await expect(agent.ebsiAuthPresentationDefinitionGet({ scope: 'didr_invite' })).resolves.toEqual({
format: {
jwt_vp: {
alg: ['ES256', 'ES256K'],
Expand Down Expand Up @@ -352,7 +352,7 @@ export default (testContext: { getAgent: () => ConfiguredAgent; setup: () => Pro
definitionId: ScopeByDefinition.didr_invite_presentation,
did: identifier.did,
kid: `${identifier.did}#${id.keys[1].kid}`,
scope: EBSIScope.didr_invite,
scope: 'didr_invite',
}),
).resolves.toEqual({})
})
Expand Down
11 changes: 11 additions & 0 deletions packages/ebsi-authorization-client/agent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,15 @@ agent:
plugins:
- $ref: /keyManager
- $ref: /didManager
- $require: '@veramo/data-store#DataStore'
$args:
- $ref: /dbConnection
- $require: '@veramo/data-store#DataStoreORM'
$args:
- $ref: /dbConnection
- $require: '@veramo/credential-w3c#CredentialPlugin'
- $require: './packages/ebsi-authorization-client/dist#EBSIAuthorizationClient'
- $require: ./packages/presentation-exchange/dist#PresentationExchange
- $require: ./packages/siopv2-oid4vp-op-auth/dist#DidAuthSiopOpAuthenticator
# $args:
# - presentationSignCallback: { }
13 changes: 7 additions & 6 deletions packages/ebsi-authorization-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"@sphereon/did-auth-siop": "0.6.4",
"@sphereon/pex": "^3.3.3",
"@sphereon/pex-models": "^2.2.4",
"@sphereon/ssi-sdk.presentation-exchange": "workspace:*",
"@sphereon/ssi-sdk.oid4vci-holder": "workspace:*",
"@sphereon/ssi-sdk.siopv2-oid4vp-op-auth": "workspace:*",
"@sphereon/ssi-types": "workspace:*",
Expand All @@ -28,12 +29,12 @@
"uuidv4": "^6.2.13"
},
"devDependencies": {
"@sphereon/oid4vci-client": "0.10.3",
"@sphereon/oid4vci-common": "0.10.3",
"@sphereon/ssi-sdk-ext.did-provider-ebsi": "^0.18.2",
"@sphereon/ssi-sdk-ext.key-manager": "^0.18.2",
"@sphereon/ssi-sdk-ext.key-utils": "0.19.0",
"@sphereon/ssi-sdk-ext.kms-local": "^0.18.2",
"@sphereon/oid4vci-client": "0.10.4-next.31",
"@sphereon/oid4vci-common": "0.10.4-next.31",
"@sphereon/ssi-sdk-ext.did-provider-ebsi": "0.20.1-unstable.3",
"@sphereon/ssi-sdk-ext.key-manager": "0.20.1-unstable.3",
"@sphereon/ssi-sdk-ext.key-utils": "0.20.1-unstable.3",
"@sphereon/ssi-sdk-ext.kms-local": "0.20.1-unstable.3",
"@sphereon/ssi-sdk.agent-config": "workspace:*",
"@transmute/json-web-signature": "0.7.0-unstable.81",
"@types/express": "^4.17.21",
Expand Down
Loading

0 comments on commit 5fdbd65

Please sign in to comment.