Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into feature/VDX-316
Browse files Browse the repository at this point in the history
  • Loading branch information
nklomp committed Jan 22, 2024
2 parents 5bfdb41 + 77c9c24 commit 9ba138a
Show file tree
Hide file tree
Showing 10 changed files with 134 additions and 143 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-test-on-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ jobs:
with:
fetch-depth: 0
- name: Use Node.js
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: '16.x'
node-version: '18.18.0'
- uses: pnpm/action-setup@v2
with:
version: 8
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-test-publish-on-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ jobs:
with:
fetch-depth: 0
- name: Use Node.js
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: '16.x'
node-version: '18.18.0'
- uses: pnpm/action-setup@v2
with:
version: 8
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"prettier": "^3.0.1",
"rimraf": "^5.0.1",
"ts-jest": "^29.1.1",
"typescript": "4.9.5"
"typescript": "5.3.3"
},
"keywords": [
"Sphereon",
Expand Down
2 changes: 1 addition & 1 deletion packages/callback-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@sphereon/oid4vci-client": "workspace:*",
"@sphereon/oid4vci-common": "workspace:*",
"@sphereon/oid4vci-issuer": "workspace:*",
"@sphereon/ssi-types": "0.17.6-unstable.69",
"@sphereon/ssi-types": "^0.18.1",
"jose": "^4.10.0"
},
"devDependencies": {
Expand Down
8 changes: 4 additions & 4 deletions packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
"dependencies": {
"@sphereon/oid4vci-common": "workspace:*",
"@sphereon/ssi-types": "0.17.6-unstable.69",
"@sphereon/ssi-types": "^0.18.1",
"cross-fetch": "^3.1.8",
"debug": "^4.3.4"
},
Expand Down Expand Up @@ -44,11 +44,11 @@
"open-cli": "^7.2.0",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"typescript": "4.9.5",
"uint8arrays": "3.1.1"
"uint8arrays": "3.1.1",
"typescript": "5.3.3"
},
"engines": {
"node": ">=16"
"node": ">=18"
},
"files": [
"lib/**/*",
Expand Down
6 changes: 3 additions & 3 deletions packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
"build:clean": "tsc --build --clean && tsc --build"
},
"dependencies": {
"@sphereon/ssi-types": "0.17.6-unstable.69",
"@sphereon/ssi-types": "^0.18.1",
"cross-fetch": "^3.1.8",
"jwt-decode": "^3.1.2"
},
"devDependencies": {
"@types/jest": "^29.5.3",
"typescript": "5.0.4"
"typescript": "5.3.3"
},
"engines": {
"node": ">=16"
"node": ">=18"
},
"files": [
"lib/**/*",
Expand Down
9 changes: 5 additions & 4 deletions packages/issuer-rest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@
"dependencies": {
"@sphereon/oid4vci-common": "workspace:*",
"@sphereon/oid4vci-issuer": "workspace:*",
"@sphereon/ssi-express-support": "0.17.6-unstable.69",
"@sphereon/ssi-types": "0.17.6-unstable.69",
"@sphereon/ssi-express-support": "^0.18.1",
"@sphereon/ssi-types": "^0.18.1",
"body-parser": "^1.20.2",
"cookie-parser": "^1.4.6",
"cors": "^2.8.5",
"dotenv-flow": "^3.2.0",
"express": "^4.18.2",
"http-terminator": "^3.2.0",
"uuid": "^9.0.0"
"uuid": "^9.0.0",
"typescript": "5.3.3"
},
"devDependencies": {
"@digitalcredentials/did-method-key": "^2.0.3",
Expand All @@ -42,7 +43,7 @@
"ts-jest": "^29.1.0"
},
"engines": {
"node": ">=16"
"node": ">=18"
},
"files": [
"lib/**/*",
Expand Down
38 changes: 25 additions & 13 deletions packages/issuer/lib/VcIssuer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,8 @@ export class VcIssuer<DIDDoc extends object> {

const { preAuthSession, authSession, cNonceState, jwtVerifyResult } = validated
const did = jwtVerifyResult.did
const jwk = jwtVerifyResult.jwk
const kid = jwtVerifyResult.kid
const newcNonce = opts.newCNonce ? opts.newCNonce : v4()
const newcNonceState = {
cNonce: newcNonce,
Expand Down Expand Up @@ -305,20 +307,28 @@ export class VcIssuer<DIDDoc extends object> {
if (!credential) {
throw Error('A credential needs to be supplied at this point')
}
if (did) {
if (CredentialMapper.isSdJwtDecodedCredentialPayload(credential)) {
credential.sub = did
} else {
const credentialSubjects = Array.isArray(credential.credentialSubject) ? credential.credentialSubject : [credential.credentialSubject]
credentialSubjects.map((subject) => {
if (!subject.id) {
subject.id = did
}
return subject
})
credential.credentialSubject = Array.isArray(credential.credentialSubject) ? credentialSubjects : credentialSubjects[0]
// Bind credential to the provided proof of possession
if (CredentialMapper.isSdJwtDecodedCredentialPayload(credential) && (kid || jwk) && !credential.cnf) {
if (kid) {
credential.cnf = {
kid,
}
} else if (jwk) {
credential.cnf = {
jwk,
}
}
}
if (did && !CredentialMapper.isSdJwtDecodedCredentialPayload(credential)) {
const credentialSubjects = Array.isArray(credential.credentialSubject) ? credential.credentialSubject : [credential.credentialSubject]
credentialSubjects.map((subject) => {
if (!subject.id) {
subject.id = did
}
return subject
})
credential.credentialSubject = Array.isArray(credential.credentialSubject) ? credentialSubjects : credentialSubjects[0]
}

const verifiableCredential = await this.issueCredentialImpl(
{
Expand Down Expand Up @@ -418,8 +428,10 @@ export class VcIssuer<DIDDoc extends object> {
}) {
let preAuthorizedCode: string | undefined
let issuerState: string | undefined

const supportedIssuanceFormats = ['jwt_vc_json', 'jwt_vc_json-ld', 'vc+sd-jwt', 'ldp_vc']
try {
if (credentialRequest.format !== 'jwt_vc_json' && credentialRequest.format !== 'jwt_vc_json-ld' && credentialRequest.format !== 'vc+sd-jwt') {
if (!supportedIssuanceFormats.includes(credentialRequest.format)) {
throw Error(`Format ${credentialRequest.format} not supported yet`)
} else if (typeof this._jwtVerifyCallback !== 'function' && typeof jwtVerifyCallback !== 'function') {
throw new Error(JWT_VERIFY_CONFIG_ERROR)
Expand Down
7 changes: 4 additions & 3 deletions packages/issuer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"dependencies": {
"@sphereon/oid4vci-common": "workspace:*",
"@sphereon/ssi-types": "0.17.6-unstable.69",
"@sphereon/ssi-types": "^0.18.1",
"uuid": "^9.0.0"
},
"peerDependencies": {
Expand All @@ -27,10 +27,11 @@
"@types/jest": "^29.5.3",
"@types/node": "^18.17.3",
"@types/uuid": "^9.0.2",
"did-resolver": "^4.1.0"
"did-resolver": "^4.1.0",
"typescript": "5.3.3"
},
"engines": {
"node": ">=16"
"node": ">=18"
},
"files": [
"lib/**/*",
Expand Down
Loading

0 comments on commit 9ba138a

Please sign in to comment.