Skip to content

Commit

Permalink
Merge branch 'develop' into feature/SPRIND-89
Browse files Browse the repository at this point in the history
# Conflicts:
#	packages/siop-oid4vp/lib/authorization-response/types.ts
#	packages/siop-oid4vp/lib/op/OP.ts
#	packages/siop-oid4vp/lib/schemas/AuthorizationResponseOpts.schema.ts
  • Loading branch information
Brummos committed Jan 24, 2025
2 parents fa16634 + 49de36e commit 147da96
Show file tree
Hide file tree
Showing 42 changed files with 1,053 additions and 511 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-test-on-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
node-version: '20.x'
- uses: pnpm/action-setup@v4
with:
version: 9
version: 9.15.3 # TODO remove later, we are temporary dealing with a broken pnpm version in the CI container
- run: pnpm install
- run: pnpm build
- name: run CI tests
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-test-publish-on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
node-version: '20.x'
- uses: pnpm/action-setup@v4
with:
version: 9
version: 9.15.3 # TODO remove later, we are temporary dealing with a broken pnpm version in the CI container
- run: pnpm install
- run: pnpm build
- name: run integration tests
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"node": ">=18"
},
"resolutions": {
"@sphereon/ssi-types": "0.30.2-feature.mdoc.funke2.367",
"@sphereon/ssi-types": "0.32.1-feature.VDX.341.53",
"dcql": "0.2.19",
"node-fetch": "2.6.12"
},
"prettier": {
Expand Down Expand Up @@ -66,4 +67,3 @@
"OID4VP"
]
}

2 changes: 1 addition & 1 deletion packages/callback-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@sphereon/oid4vci-client": "workspace:*",
"@sphereon/oid4vci-common": "workspace:*",
"@sphereon/oid4vci-issuer": "workspace:*",
"@sphereon/ssi-types": "0.30.2-feature.mdoc.funke2.367",
"@sphereon/ssi-types": "0.32.1-feature.VDX.341.53",
"jose": "^4.10.0"
},
"devDependencies": {
Expand Down
6 changes: 6 additions & 0 deletions packages/client/lib/OpenID4VCIClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ export class OpenID4VCIClient {
pkce,
authorizationRequest,
createAuthorizationRequestURL,
endpointMetadata
}: {
credentialIssuer: string;
kid?: string;
Expand All @@ -145,6 +146,7 @@ export class OpenID4VCIClient {
createAuthorizationRequestURL?: boolean;
authorizationRequest?: AuthorizationRequestOpts; // Can be provided here, or when manually calling createAuthorizationUrl
pkce?: PKCEOpts;
endpointMetadata?: EndpointMetadataResult
}) {
const client = new OpenID4VCIClient({
kid,
Expand All @@ -153,6 +155,7 @@ export class OpenID4VCIClient {
credentialIssuer,
pkce,
authorizationRequest,
endpointMetadata
});
if (retrieveServerMetadata === undefined || retrieveServerMetadata) {
await client.retrieveServerMetadata();
Expand All @@ -179,6 +182,7 @@ export class OpenID4VCIClient {
createAuthorizationRequestURL,
authorizationRequest,
resolveOfferUri,
endpointMetadata
}: {
uri: string;
kid?: string;
Expand All @@ -189,6 +193,7 @@ export class OpenID4VCIClient {
pkce?: PKCEOpts;
clientId?: string;
authorizationRequest?: AuthorizationRequestOpts; // Can be provided here, or when manually calling createAuthorizationUrl
endpointMetadata?: EndpointMetadataResult
}): Promise<OpenID4VCIClient> {
const credentialOfferClient = await CredentialOfferClient.fromURI(uri, { resolve: resolveOfferUri });
const client = new OpenID4VCIClient({
Expand All @@ -198,6 +203,7 @@ export class OpenID4VCIClient {
clientId: clientId ?? authorizationRequest?.clientId ?? credentialOfferClient.clientId,
pkce,
authorizationRequest,
endpointMetadata
});

if (retrieveServerMetadata === undefined || retrieveServerMetadata) {
Expand Down
2 changes: 1 addition & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"dependencies": {
"@sphereon/oid4vc-common": "workspace:*",
"@sphereon/oid4vci-common": "workspace:*",
"@sphereon/ssi-types": "0.30.2-feature.mdoc.funke2.367",
"@sphereon/ssi-types": "0.32.1-feature.VDX.341.53",
"cross-fetch": "^3.1.8",
"debug": "^4.3.5"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"build:clean": "tsc --build --clean && tsc --build"
},
"dependencies": {
"@sphereon/ssi-types": "0.30.2-feature.mdoc.funke2.367",
"@sphereon/ssi-types": "0.32.1-feature.VDX.341.53",
"jwt-decode": "^4.0.0",
"sha.js": "^2.4.11",
"uint8arrays": "3.1.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/issuer-rest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@sphereon/oid4vci-common": "workspace:*",
"@sphereon/oid4vci-issuer": "workspace:*",
"@sphereon/ssi-express-support": "0.30.2-feature.mdoc.funke2.367",
"@sphereon/ssi-types": "0.30.2-feature.mdoc.funke2.367",
"@sphereon/ssi-types": "0.32.1-feature.VDX.341.53",
"body-parser": "^1.20.2",
"cookie-parser": "^1.4.6",
"cors": "^2.8.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/issuer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"dependencies": {
"@sphereon/oid4vc-common": "workspace:*",
"@sphereon/oid4vci-common": "workspace:*",
"@sphereon/ssi-types": "0.30.2-feature.mdoc.funke2.367",
"@sphereon/ssi-types": "0.32.1-feature.VDX.341.53",
"uuid": "^9.0.0"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/oid4vci-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"dependencies": {
"@sphereon/oid4vc-common": "workspace:*",
"@sphereon/ssi-types": "0.30.2-feature.mdoc.funke2.367",
"@sphereon/ssi-types": "0.32.1-feature.VDX.341.53",
"cross-fetch": "^3.1.8",
"debug": "^4.3.5",
"jwt-decode": "^4.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
VERIFIERZ_PURPOSE_TO_VERIFY,
VERIFIERZ_PURPOSE_TO_VERIFY_NL,
} from './data/mockedData'
import { DcqlQuery } from 'dcql'

const EXAMPLE_REDIRECT_URL = 'https://acme.com/hello'
const EXAMPLE_REFERENCE_URL = 'https://rp.acme.com/siop/jwts'
Expand Down Expand Up @@ -671,4 +672,85 @@ describe('create Request JWT should', () => {
}
await expect(URI.fromOpts(opts)).rejects.toThrow(SIOPErrors.REQUEST_CLAIMS_PRESENTATION_DEFINITION_NOT_VALID)
})

it('should succeed when requesting with a valid dcql query', async () => {
const dcqlQuery: DcqlQuery = {
credentials: [
{
id: 'Credentials',
format: 'jwt_vc_json',
claims: [
{
id: 'ID Card Credential',
path: ['$.issuer.id'],
values: ['did:example:issuer'],
},
],
},
],
}
const opts: CreateAuthorizationRequestOpts = {
version: SupportedVersion.SIOPv2_ID1,
payload: {
client_id: WELL_KNOWN_OPENID_FEDERATION,
scope: 'test',
response_type: 'vp_token',
request_object_signing_alg_values_supported: [SigningAlgo.ES256, SigningAlgo.EDDSA],
redirect_uri: EXAMPLE_REDIRECT_URL,
},
requestObject: {
jwtIssuer: { method: 'did', didUrl: KID, alg: SigningAlgo.ES256K },
passBy: PassBy.REFERENCE,
reference_uri: EXAMPLE_REFERENCE_URL,

createJwtCallback: getCreateJwtCallback({
hexPrivateKey: HEX_KEY,
did: DID,
kid: KID,
alg: SigningAlgo.ES256K,
}),
payload: {
client_id: WELL_KNOWN_OPENID_FEDERATION,
scope: 'test',
response_type: 'vp_token',
redirect_uri: EXAMPLE_REDIRECT_URL,
request_object_signing_alg_values_supported: [SigningAlgo.EDDSA, SigningAlgo.ES256],
claims: {
vp_token: {
dcql_query: JSON.stringify(dcqlQuery)
},
},
},
},
clientMetadata: {
client_id: WELL_KNOWN_OPENID_FEDERATION,
idTokenSigningAlgValuesSupported: [SigningAlgo.EDDSA, SigningAlgo.ES256],
requestObjectSigningAlgValuesSupported: [SigningAlgo.EDDSA, SigningAlgo.ES256],
responseTypesSupported: [ResponseType.ID_TOKEN],
scopesSupported: [Scope.OPENID_DIDAUTHN, Scope.OPENID],
subject_syntax_types_supported: ['did:ethr:', SubjectIdentifierType.DID],
subjectTypesSupported: [SubjectType.PAIRWISE],
vpFormatsSupported: {
ldp_vc: {
proof_type: [IProofType.EcdsaSecp256k1Signature2019, IProofType.EcdsaSecp256k1Signature2019],
},
},

passBy: PassBy.VALUE,

logo_uri: VERIFIER_LOGO_FOR_CLIENT,
clientName: VERIFIER_NAME_FOR_CLIENT,
'clientName#nl-NL': VERIFIER_NAME_FOR_CLIENT_NL + '2022100305',
clientPurpose: VERIFIERZ_PURPOSE_TO_VERIFY,
'clientPurpose#nl-NL': VERIFIERZ_PURPOSE_TO_VERIFY_NL,
},
}

const uriRequest = await URI.fromOpts(opts)

const uriDecoded = decodeURIComponent(uriRequest.encodedUri)
expect(uriDecoded.startsWith('openid4vp://?')).toBeTruthy()
expect(uriDecoded).toContain(`request_uri=https://rp.acme.com/siop/jwts`)
expect((await (await uriRequest.toAuthorizationRequest())?.requestObject?.getPayload())?.claims.vp_token).toBeDefined()
})
})
Loading

0 comments on commit 147da96

Please sign in to comment.