Skip to content

Commit 2d2c2f2

Browse files
authored
Merge pull request #67 from Sphereon-Opensource/feature/WAL-646
Allow for config section CredentialSupplierConfig in CredentialDataSupplierArgs
2 parents 36fd227 + 07c08d9 commit 2d2c2f2

8 files changed

Lines changed: 25 additions & 12 deletions

File tree

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"fix:lint": "eslint . --fix --ext .ts",
1212
"fix:prettier": "prettier --write \"{packages,__tests__,!dist}/**/*.{ts,tsx,js,json,md,yml}\"",
1313
"build": "pnpm -r --stream build",
14+
"build:clean": "lerna clean -y && pnpm install && lerna run build:clean --concurrency 1",
1415
"test:ci": "jest --config=jest.json",
1516
"test": "jest --verbose --config=jest.json --coverage=true --detectOpenHandles",
1617
"clean": "rimraf --glob **/dist **/coverage **/pnpm-lock.yaml packages/**/node_modules node_modules packages/**/tsconfig.tsbuildinfo",

packages/callback-example/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"main": "dist/index.js",
77
"types": "dist/index.d.ts",
88
"scripts": {
9-
"build": "tsc"
9+
"build": "tsc",
10+
"build:clean": "tsc --build --clean && tsc --build"
1011
},
1112
"dependencies": {
1213
"@digitalcredentials/did-method-key": "^2.0.3",

packages/common/lib/types/Generic.types.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ export type MetadataDisplay = NameAndLocale &
4141
name?: string; //OPTIONAL. String value of a display name for the Credential Issuer.
4242
};
4343

44+
export interface CredentialSupplierConfig {
45+
[key: string]: any; // This allows additional properties for credential suppliers
46+
}
47+
4448
export interface CredentialIssuerMetadataOpts {
4549
credential_endpoint?: string; // REQUIRED. URL of the Credential Issuer's Credential Endpoint. This URL MUST use the https scheme and MAY contain port, path and query parameter components.
4650
batch_credential_endpoint?: string; // OPTIONAL. URL of the Credential Issuer's Batch Credential Endpoint. This URL MUST use the https scheme and MAY contain port, path and query parameter components. If omitted, the Credential Issuer does not support the Batch Credential Endpoint.
@@ -49,6 +53,7 @@ export interface CredentialIssuerMetadataOpts {
4953
authorization_server?: string; // OPTIONAL. Identifier of the OAuth 2.0 Authorization Server (as defined in [RFC8414]) the Credential Issuer relies on for authorization. If this element is omitted, the entity providing the Credential Issuer is also acting as the AS, i.e. the Credential Issuer's identifier is used as the OAuth 2.0 Issuer value to obtain the Authorization Server metadata as per [RFC8414].
5054
token_endpoint?: string;
5155
display?: MetadataDisplay[]; // An array of objects, where each object contains display properties of a Credential Issuer for a certain language. Below is a non-exhaustive list of valid parameters that MAY be included:
56+
credential_supplier_config?: CredentialSupplierConfig
5257
}
5358

5459
// For now we extend the opts above. Only difference is that the credential endpoint is optional in the Opts, as it can come from other sources. The value is however required in the eventual Issuer Metadata

packages/common/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"main": "dist/index.js",
77
"types": "dist/index.d.ts",
88
"scripts": {
9-
"build": "tsc"
9+
"build": "tsc",
10+
"build:clean": "tsc --build --clean && tsc --build"
1011
},
1112
"dependencies": {
1213
"@sphereon/ssi-types": "0.17.2",

packages/issuer-rest/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"types": "dist/index.d.ts",
88
"scripts": {
99
"start": "ts-node lib/OID4VCIServer.ts",
10-
"build": "tsc"
10+
"build": "tsc",
11+
"build:clean": "tsc --build --clean && tsc --build"
1112
},
1213
"dependencies": {
1314
"@sphereon/oid4vci-common": "workspace:*",

packages/issuer/lib/VcIssuer.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import { v4 } from 'uuid'
4141

4242
import { assertValidPinNumber, createCredentialOfferObject, createCredentialOfferURIFromObject } from './functions'
4343
import { LookupStateManager } from './state-manager'
44-
import { CredentialDataSupplier, CredentialSignerCallback } from './types'
44+
import { CredentialDataSupplier, CredentialDataSupplierArgs, CredentialSignerCallback } from './types'
4545

4646
const SECOND = 1000
4747

@@ -275,12 +275,14 @@ export class VcIssuer<DIDDoc extends object> {
275275
throw Error('Credential Offer missing')
276276
}
277277
const credentialDataSupplierInput = opts.credentialDataSupplierInput ?? session.credentialDataSupplierInput
278-
const result = await credentialDataSupplier({
278+
279+
const result = await credentialDataSupplier({
279280
...cNonceState,
280-
credentialRequest: opts.credentialRequest,
281-
credentialOffer /*todo: clientId: */,
281+
credentialRequest: opts.credentialRequest,
282+
credentialSupplierConfig: this._issuerMetadata.credential_supplier_config,
283+
credentialOffer /*todo: clientId: */,
282284
...(credentialDataSupplierInput && { credentialDataSupplierInput }),
283-
})
285+
} as CredentialDataSupplierArgs)
284286
credential = result.credential
285287
if (result.format) {
286288
format = result.format

packages/issuer/lib/types/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import {
22
AssertedUniformCredentialOffer,
33
CNonceState,
4-
CredentialDataSupplierInput,
4+
CredentialDataSupplierInput, CredentialSupplierConfig,
55
JwtVerifyResult,
66
OID4VCICredentialFormat,
7-
UniformCredentialRequest,
7+
UniformCredentialRequest
88
} from '@sphereon/oid4vci-common'
99
import { ICredential, W3CVerifiableCredential } from '@sphereon/ssi-types'
1010

@@ -21,8 +21,9 @@ export type CredentialSignerCallback<T extends object> = (opts: {
2121

2222
export interface CredentialDataSupplierArgs extends CNonceState {
2323
credentialRequest: UniformCredentialRequest
24-
clientId?: string
2524
credentialOffer: AssertedUniformCredentialOffer
25+
clientId?: string
26+
credentialSupplierConfig?: CredentialSupplierConfig
2627
credentialDataSupplierInput?: CredentialDataSupplierInput
2728
}
2829

packages/issuer/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"main": "dist/index.js",
77
"types": "dist/index.d.ts",
88
"scripts": {
9-
"build": "tsc"
9+
"build": "tsc",
10+
"build:clean": "tsc --build --clean && tsc --build"
1011
},
1112
"dependencies": {
1213
"@sphereon/oid4vci-common": "workspace:*",

0 commit comments

Comments
 (0)