Skip to content

Commit

Permalink
feat: More test cases
Browse files Browse the repository at this point in the history
Signed-off-by: Tom Lanser <[email protected]>
  • Loading branch information
Tommylans committed Nov 26, 2024
1 parent c8cd156 commit f37ea75
Show file tree
Hide file tree
Showing 18 changed files with 207 additions and 12 deletions.
4 changes: 2 additions & 2 deletions agent/src/issuer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { mobileDriversLicenseMdoc, mobileDriversLicenseSdJwt } from './issuers/i
import { getX509Certificate } from './keyMethods'
import { DateOnly, oneYearInMilliseconds, serverStartupTimeInMilliseconds, tenDaysInMilliseconds } from './utils/date'
import { getVerifier } from './verifier'
import { animoVerifier } from './verifiers/animo'
import { bundesregierungVerifier } from './verifiers/bundesregierung'
import { pidMdocInputDescriptor, pidSdJwtInputDescriptor } from './verifiers/util'

export async function createOrUpdateIssuer(options: OpenId4VciCreateIssuerOptions & { issuerId: string }) {
Expand Down Expand Up @@ -52,7 +52,7 @@ export function getIssuerIdForCredentialConfigurationId(credentialConfigurationI

export const getVerificationSessionForIssuanceSession: OpenId4VciGetVerificationSessionForIssuanceSessionAuthorization =
async ({ agentContext, scopes }) => {
const verifier = await getVerifier(animoVerifier.verifierId)
const verifier = await getVerifier(bundesregierungVerifier.verifierId)
const x509Certificate = getX509Certificate()
const verifierApi = agentContext.dependencyManager.resolve(OpenId4VcVerifierApi)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { AGENT_HOST } from '../constants'
import { steuerIdMdoc, steuerIdSdJwt } from '../issuers/steuern'
import type { PlaygroundVerifierOptions } from '../verifier'
import { mdocDcqlCredential, pidMdocInputDescriptor, pidSdJwtInputDescriptor, sdJwtDcqlCredential } from './util'
import { mdocDcqlCredential, pidMdocInputDescriptor, sdJwtDcqlCredential } from './util'
import { pidSdJwtInputDescriptor } from './util'

export const animoVerifier = {
export const bundesregierungVerifier = {
verifierId: '019368ed-3787-7669-b7f4-8c012238e90d',
clientMetadata: {
logo_uri: `${AGENT_HOST}/assets/verifiers/animo/verifier.jpg`,
client_name: 'Animo',
logo_uri: `${AGENT_HOST}/assets/verifiers/bunde.png`,
client_name: 'Die Bundesregierung',
},
verifierId: 'd8662712-ee78-406c-a88c-df4ff1ed9468',
presentationRequests: [
{
id: '4db74328-9e94-49bb-97b7-bbfcb2d11a06',
Expand Down
39 changes: 39 additions & 0 deletions agent/src/verifiers/cheapCars.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { AGENT_HOST } from '../constants'
import { certificateOfResidenceSdJwt, certificateOfResidenceSdJwtData } from '../issuers/koln'
import { steuerIdSdJwt, steuerIdSdJwtData } from '../issuers/steuern'
import { healthIdSdJwt, healthIdSdJwtData } from '../issuers/techniker'
import type { PlaygroundVerifierOptions } from '../verifier'
import { pidMdocInputDescriptor, pidSdJwtInputDescriptor, sdJwtInputDescriptor } from './util'

export const cheapCarsVerifier = {
verifierId: '019368fe-ee82-7990-880c-7f0ceb92b0aa',
clientMetadata: {
logo_uri: `${AGENT_HOST}/assets/verifiers/cheap-cars.webp`,
client_name: 'Cheap Cars',
},
presentationRequests: [
{
id: '019368ff-0ec7-7eec-bdbf-861e512d0924',
name: 'PID and MDL - Secure car reservations (vc+sd-jwt)',
purpose: 'To secure your car reservations and finalize the transaction, we require the following attributes',
input_descriptors: [
// TODO: Add more fields
pidMdocInputDescriptor({
fields: [
'document_number',
'issue_date',
'expiry_date',
'issuing_country',
'issuing_authority',
'driving_priviliges',
],
}),
// TODO: Add more fields
pidSdJwtInputDescriptor({
fields: ['given_name', 'family_name', 'birth_date', 'address.country', 'nationalities'],
}),
],
},
],
dcqlRequests: [],
} as const satisfies PlaygroundVerifierOptions
12 changes: 12 additions & 0 deletions agent/src/verifiers/europeanUnion.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { AGENT_HOST } from '../constants'
import type { PlaygroundVerifierOptions } from '../verifier'

export const europeanUnionVerifier = {
verifierId: '01936907-56a3-7007-a61f-44bff8b5d175',
clientMetadata: {
logo_uri: `${AGENT_HOST}/assets/verifiers/eu.png`,
client_name: 'European Union',
},
presentationRequests: [],
dcqlRequests: [],
} as const satisfies PlaygroundVerifierOptions
12 changes: 12 additions & 0 deletions agent/src/verifiers/farmatec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { AGENT_HOST } from '../constants'
import type { PlaygroundVerifierOptions } from '../verifier'

export const farmatecVerifier = {
verifierId: '01936904-6f3c-7ccd-9e80-63e6d4945d93',
clientMetadata: {
logo_uri: `${AGENT_HOST}/assets/verifiers/farmatec.png`,
client_name: 'Farmatec',
},
presentationRequests: [],
dcqlRequests: [],
} as const satisfies PlaygroundVerifierOptions
60 changes: 58 additions & 2 deletions agent/src/verifiers/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
import type { PlaygroundVerifierOptions } from '../verifier'
import { animoVerifier } from './animo'
import { bundesregierungVerifier } from './bundesregierung'
import { cheapCarsVerifier } from './cheapCars'
import { europeanUnionVerifier } from './europeanUnion'
import { farmatecVerifier } from './farmatec'
import { kvkVerifier } from './kvk'
import { openHorizonBankVerifier } from './openHorizonBank'
import { pgeuVerifier } from './pgeu'
import { redcarePharmacyVerifier } from './redcarePharmacy'
import { turboKeysVerifier } from './sixt'
import type { TrustChain } from './trustChains'
import { trustPilotVerifier } from './trustPilot'

export const verifiers = [animoVerifier, turboKeysVerifier, kvkVerifier, trustPilotVerifier]
export const verifiers = [
turboKeysVerifier,
kvkVerifier,
trustPilotVerifier,
openHorizonBankVerifier,
bundesregierungVerifier,
cheapCarsVerifier,
redcarePharmacyVerifier,
farmatecVerifier,
pgeuVerifier,
europeanUnionVerifier,
] as const
export const allDefinitions = verifiers.flatMap(
(
v
Expand All @@ -15,16 +32,55 @@ export const allDefinitions = verifiers.flatMap(
)

export const verifierTrustChains = [
// --- Turbo keys ---
{
// Turbo keys is trusted by kvk
leaf: turboKeysVerifier.verifierId,
trustAnchor: kvkVerifier.verifierId,
},
{
// Turbo keys is trusted by trust pilot
leaf: turboKeysVerifier.verifierId,
trustAnchor: trustPilotVerifier.verifierId,
},
// --- Trust pilot ---
{
// Trust pilot is trusted by kvk
leaf: trustPilotVerifier.verifierId,
trustAnchor: kvkVerifier.verifierId,
},
// --- Open horizon bank ---
{
// Open horizon bank is trusted by bundesregierung
leaf: openHorizonBankVerifier.verifierId,
trustAnchor: bundesregierungVerifier.verifierId,
},
// --- Redcare pharmacy ---
{
// Redcare pharmacy is trusted by kvk
leaf: redcarePharmacyVerifier.verifierId,
trustAnchor: kvkVerifier.verifierId,
},
{
// Redcare pharmacy is trusted by farmatec
leaf: redcarePharmacyVerifier.verifierId,
trustAnchor: farmatecVerifier.verifierId,
},
{
// Redcare pharmacy is trusted by pgeu
leaf: redcarePharmacyVerifier.verifierId,
trustAnchor: pgeuVerifier.verifierId,
},
// --- Pgeu ---
{
// Pgeu is trusted by european union
leaf: pgeuVerifier.verifierId,
trustAnchor: europeanUnionVerifier.verifierId,
},
// --- Bundesregierung ---
{
// Bundesregierung is trusted by european union
leaf: bundesregierungVerifier.verifierId,
trustAnchor: europeanUnionVerifier.verifierId,
},
] as const satisfies Array<TrustChain>
40 changes: 40 additions & 0 deletions agent/src/verifiers/openHorizonBank.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { AGENT_HOST } from '../constants'
import { certificateOfResidenceSdJwt } from '../issuers/koln'
import { steuerIdSdJwt } from '../issuers/steuern'
import { healthIdSdJwt } from '../issuers/techniker'
import type { PlaygroundVerifierOptions } from '../verifier'
import { pidSdJwtInputDescriptor, sdJwtInputDescriptor } from './util'

export const openHorizonBankVerifier = {
verifierId: '019368e8-54aa-788e-81c4-e60a59a09d87',
clientMetadata: {
logo_uri: `${AGENT_HOST}/assets/verifiers/openbank.png`,
client_name: 'Open Horizon Bank',
},
presentationRequests: [
{
id: '019368e2-a893-799b-b7a5-cfcaa07b2229',
name: 'PID and MDL - Open an Open Horizon Bank account (vc+sd-jwt)',
purpose:
'To open an Open Horizon Bank account, we need to verify your name, date of birth, country of residence and nationality',
input_descriptors: [
sdJwtInputDescriptor({
vcts: [steuerIdSdJwt.vct],
fields: ['tax_number', 'affiliation_country'],
}),
sdJwtInputDescriptor({
vcts: [certificateOfResidenceSdJwt.vct],
fields: ['resident_address', 'arrival_date'],
}),
sdJwtInputDescriptor({
vcts: [healthIdSdJwt.vct],
fields: ['health_insurance_id', 'affiliation_country', 'matching_institution_id'],
}),
pidSdJwtInputDescriptor({
fields: ['given_name', 'family_name', 'birth_date', 'address.country', 'nationalities'],
}),
],
},
],
dcqlRequests: [],
} as const satisfies PlaygroundVerifierOptions
12 changes: 12 additions & 0 deletions agent/src/verifiers/pgeu.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { AGENT_HOST } from '../constants'
import type { PlaygroundVerifierOptions } from '../verifier'

export const pgeuVerifier = {
verifierId: '01936903-8879-733f-8eaf-6f2fa862099c',
clientMetadata: {
logo_uri: `${AGENT_HOST}/assets/verifiers/pgeu.png`,
client_name: 'The Pharmaceutical Group of the European Union',
},
presentationRequests: [],
dcqlRequests: [],
} as const satisfies PlaygroundVerifierOptions
26 changes: 26 additions & 0 deletions agent/src/verifiers/redcarePharmacy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { AGENT_HOST } from '../constants'
import { healthIdSdJwt } from '../issuers/techniker'
import type { PlaygroundVerifierOptions } from '../verifier'
import { sdJwtInputDescriptor } from './util'

export const redcarePharmacyVerifier = {
verifierId: '01936901-2390-722e-b9f1-bf42db4db7ca',
clientMetadata: {
logo_uri: `${AGENT_HOST}/assets/verifiers/redcare.png`,
client_name: 'Redcare Pharmacy',
},
presentationRequests: [
{
id: '01936901-3823-766e-b771-301158d79a60',
name: 'Finalize transaction (vc+sd-jwt)',
purpose: 'To receive your prescription and finalize the transaction, we require the following attributes',
input_descriptors: [
sdJwtInputDescriptor({
vcts: [healthIdSdJwt.vct],
fields: ['health_insurance_id', 'affiliation_country'],
}),
],
},
],
dcqlRequests: [],
} as const satisfies PlaygroundVerifierOptions
3 changes: 0 additions & 3 deletions agent/src/verifiers/trustChains.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import { animoVerifier } from './animo'
import { turboKeysVerifier } from './sixt'

export type EntityId = string

export type TrustChain = {
Expand Down
Binary file added app/public/assets/verifiers/bunde.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/public/assets/verifiers/cheap-cars.webp
Binary file not shown.
Binary file added app/public/assets/verifiers/eu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/public/assets/verifiers/farmatec.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/public/assets/verifiers/openbank.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/public/assets/verifiers/pgeu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/public/assets/verifiers/redcare.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/public/assets/verifiers/turbokeys/verifier.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f37ea75

Please sign in to comment.