Skip to content

Commit

Permalink
feat: Add initial OID4VP ID2 support
Browse files Browse the repository at this point in the history
  • Loading branch information
nklomp committed Oct 13, 2023
1 parent 442bc7d commit 85325ae
Show file tree
Hide file tree
Showing 51 changed files with 193 additions and 400 deletions.
4 changes: 0 additions & 4 deletions packages/agent-config/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

**Note:** Version bump only for package @sphereon/ssi-sdk.agent-config





## [0.17.4](https://github.com/Sphereon-Opensource/SSI-SDK/compare/v0.17.3...v0.17.4) (2023-10-01)

**Note:** Version bump only for package @sphereon/ssi-sdk.agent-config
Expand Down
4 changes: 0 additions & 4 deletions packages/contact-manager-rest-api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

**Note:** Version bump only for package @sphereon/ssi-sdk.contact-manager-rest-api





## [0.17.4](https://github.com/Sphereon-Opensource/SSI-SDK/compare/v0.17.3...v0.17.4) (2023-10-01)

**Note:** Version bump only for package @sphereon/ssi-sdk.contact-manager-rest-api
Expand Down
4 changes: 0 additions & 4 deletions packages/contact-manager/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

**Note:** Version bump only for package @sphereon/ssi-sdk.contact-manager





## [0.17.4](https://github.com/Sphereon-Opensource/SSI-SDK/compare/v0.17.3...v0.17.4) (2023-10-01)

**Note:** Version bump only for package @sphereon/ssi-sdk.contact-manager
Expand Down
4 changes: 0 additions & 4 deletions packages/data-store/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

**Note:** Version bump only for package @sphereon/ssi-sdk.data-store





## [0.17.4](https://github.com/Sphereon-Opensource/SSI-SDK/compare/v0.17.3...v0.17.4) (2023-10-01)

**Note:** Version bump only for package @sphereon/ssi-sdk.data-store
Expand Down
4 changes: 0 additions & 4 deletions packages/dev/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

**Note:** Version bump only for package @sphereon/ssi-sdk.dev





## [0.17.4](https://github.com/Sphereon-Opensource/SSI-SDK/compare/v0.17.3...v0.17.4) (2023-10-01)

**Note:** Version bump only for package @sphereon/ssi-sdk.dev
Expand Down
4 changes: 0 additions & 4 deletions packages/issuance-branding/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

**Note:** Version bump only for package @sphereon/ssi-sdk.issuance-branding





## [0.17.4](https://github.com/Sphereon-Opensource/SSI-SDK/compare/v0.17.3...v0.17.4) (2023-10-01)

**Note:** Version bump only for package @sphereon/ssi-sdk.issuance-branding
Expand Down
4 changes: 0 additions & 4 deletions packages/kv-store/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

**Note:** Version bump only for package @sphereon/ssi-sdk.kv-store-temp





## [0.17.4](https://github.com/uport-project/veramo/compare/v0.17.3...v0.17.4) (2023-10-01)

**Note:** Version bump only for package @sphereon/ssi-sdk.kv-store-temp
Expand Down
4 changes: 0 additions & 4 deletions packages/ms-authenticator/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

**Note:** Version bump only for package @sphereon/ssi-sdk.ms-authenticator





## [0.17.4](https://github.com/Sphereon-Opensource/SSI-SDK/compare/v0.17.3...v0.17.4) (2023-10-01)

**Note:** Version bump only for package @sphereon/ssi-sdk.ms-authenticator
Expand Down
4 changes: 0 additions & 4 deletions packages/ms-request-api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

**Note:** Version bump only for package @sphereon/ssi-sdk.ms-request-api





## [0.17.4](https://github.com/Sphereon-Opensource/SSI-SDK/compare/v0.17.3...v0.17.4) (2023-10-01)

**Note:** Version bump only for package @sphereon/ssi-sdk.ms-request-api
Expand Down
4 changes: 0 additions & 4 deletions packages/oid4vci-issuer-rest-api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

**Note:** Version bump only for package @sphereon/ssi-sdk.oid4vci-issuer-rest-api





## [0.17.4](https://github.com/Sphereon-Opensource/SSI-SDK/compare/v0.17.3...v0.17.4) (2023-10-01)

**Note:** Version bump only for package @sphereon/ssi-sdk.oid4vci-issuer-rest-api
Expand Down
4 changes: 2 additions & 2 deletions packages/oid4vci-issuer-rest-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
"devDependencies": {
"@decentralized-identity/ion-sdk": "^0.6.0",
"@sphereon/did-uni-client": "^0.6.0",
"@sphereon/pex": "2.1.2",
"@sphereon/pex-models": "^2.1.0",
"@sphereon/pex": "2.2.0",
"@sphereon/pex-models": "^2.1.1",
"@sphereon/ssi-sdk-ext.did-provider-jwk": "0.15.0",
"@sphereon/ssi-sdk-ext.key-manager": "0.15.0",
"@sphereon/ssi-sdk-ext.key-utils": "0.15.0",
Expand Down
4 changes: 0 additions & 4 deletions packages/oid4vci-issuer-rest-client/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

**Note:** Version bump only for package @sphereon/ssi-sdk.oid4vci-issuer-rest-client





## [0.17.4](https://github.com/Sphereon-OpenSource/ssi-sdk/compare/v0.17.3...v0.17.4) (2023-10-01)

**Note:** Version bump only for package @sphereon/ssi-sdk.oid4vci-issuer-rest-client
Expand Down
4 changes: 0 additions & 4 deletions packages/oid4vci-issuer-store/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

**Note:** Version bump only for package @sphereon/ssi-sdk.oid4vci-issuer-store





## [0.17.4](https://github.com/Sphereon-Opensource/SSI-SDK/compare/v0.17.3...v0.17.4) (2023-10-01)

**Note:** Version bump only for package @sphereon/ssi-sdk.oid4vci-issuer-store
Expand Down
4 changes: 0 additions & 4 deletions packages/oid4vci-issuer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

**Note:** Version bump only for package @sphereon/ssi-sdk.oid4vci-issuer





## [0.17.4](https://github.com/Sphereon-Opensource/SSI-SDK/compare/v0.17.3...v0.17.4) (2023-10-01)

**Note:** Version bump only for package @sphereon/ssi-sdk.oid4vci-issuer
Expand Down
4 changes: 0 additions & 4 deletions packages/presentation-exchange/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

**Note:** Version bump only for package @sphereon/ssi-sdk.presentation-exchange





## [0.17.4](https://github.com/Sphereon-Opensource/SSI-SDK/compare/v0.17.3...v0.17.4) (2023-10-01)

**Note:** Version bump only for package @sphereon/ssi-sdk.presentation-exchange
Expand Down
4 changes: 2 additions & 2 deletions packages/presentation-exchange/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"build:clean": "tsc --build --clean && tsc --build"
},
"dependencies": {
"@sphereon/pex": "2.1.2",
"@sphereon/pex-models": "^2.1.0",
"@sphereon/pex": "2.2.0",
"@sphereon/pex-models": "^2.1.1",
"@sphereon/ssi-sdk-ext.did-utils": "0.15.0",
"@sphereon/ssi-sdk.kv-store-temp": "workspace:*",
"@sphereon/ssi-types": "workspace:*",
Expand Down
20 changes: 7 additions & 13 deletions packages/presentation-exchange/src/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,7 @@ export async function getPresentationDefinition(pexOptions?: IPEXOptions): Promi
}

export async function createPEXPresentationSignCallback(
{
kid,
fetchRemoteContexts,
format,
domain,
challenge,
}: {
args: {
kid: string
fetchRemoteContexts?: boolean
format?: Format
Expand All @@ -39,15 +33,15 @@ export async function createPEXPresentationSignCallback(
domain?: string
challenge?: string
}): Promise<W3CVerifiablePresentation> => {
const formatOptions = format ?? presentationDefinition.format
const proofFormat = formatOptions && (!!formatOptions.ldp || !!formatOptions.ldp_vp) ? 'lds' : 'jwt'
const formatOptions = format ?? args.format ?? presentationDefinition.format
const proofFormat = formatOptions ?? 'jwt_vp'

const vp = await context.agent.createVerifiablePresentation({
presentation,
keyRef: kid,
domain,
challenge,
fetchRemoteContexts: fetchRemoteContexts !== undefined ? fetchRemoteContexts : true,
keyRef: args.kid,
domain: domain ?? args.domain,
challenge: challenge ?? args.challenge,
fetchRemoteContexts: args.fetchRemoteContexts !== undefined ? args?.fetchRemoteContexts : true,
proofFormat,
})
// makes sure we extract an actual JWT from the internal representation in case it is a JWT
Expand Down
4 changes: 0 additions & 4 deletions packages/qr-code-generator/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

**Note:** Version bump only for package @sphereon/ssi-sdk.qr-code-generator





## [0.17.4](https://github.com/Sphereon-Opensource/SSI-SDK/compare/v0.17.3...v0.17.4) (2023-10-01)

**Note:** Version bump only for package @sphereon/ssi-sdk.qr-code-generator
Expand Down
4 changes: 0 additions & 4 deletions packages/siopv2-oid4vp-common/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

**Note:** Version bump only for package @sphereon/ssi-sdk.siopv2-oid4vp-common





## [0.17.4](https://github.com/Sphereon-Opensource/SSI-SDK/compare/v0.17.3...v0.17.4) (2023-10-01)

**Note:** Version bump only for package @sphereon/ssi-sdk.siopv2-oid4vp-common
Expand Down
2 changes: 1 addition & 1 deletion packages/siopv2-oid4vp-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"access": "public"
},
"dependencies": {
"@sphereon/did-auth-siop": "0.4.2",
"@sphereon/did-auth-siop": "0.5.0-unstable.2",
"@sphereon/ssi-types": "workspace:*",
"uint8arrays": "3.1.1"
},
Expand Down
4 changes: 0 additions & 4 deletions packages/siopv2-oid4vp-op-auth/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

**Note:** Version bump only for package @sphereon/ssi-sdk.siopv2-oid4vp-op-auth





## [0.17.4](https://github.com/Sphereon-Opensource/SSI-SDK/compare/v0.17.3...v0.17.4) (2023-10-01)

**Note:** Version bump only for package @sphereon/ssi-sdk.siopv2-oid4vp-op-auth
Expand Down
6 changes: 3 additions & 3 deletions packages/siopv2-oid4vp-op-auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"build:clean": "tsc --build --clean && tsc --build"
},
"dependencies": {
"@sphereon/did-auth-siop": "0.4.2",
"@sphereon/pex": "2.1.2",
"@sphereon/pex-models": "2.1.0",
"@sphereon/did-auth-siop": "0.5.0-unstable.2",
"@sphereon/pex": "2.2.0",
"@sphereon/pex-models": "2.1.1",
"@sphereon/ssi-sdk-ext.did-utils": "0.15.0",
"@sphereon/ssi-sdk.core": "workspace:*",
"@sphereon/ssi-sdk.presentation-exchange": "workspace:*",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { IOpSessionArgs, schema } from '../index'
import { IAgentPlugin } from '@veramo/core'
import { OpSession } from '../session/OpSession'
import { OpSession } from '../session'
import { v4 as uuidv4 } from 'uuid'

import {
Expand All @@ -19,11 +19,6 @@ export class DidAuthSiopOpAuthenticator implements IAgentPlugin {
siopGetOPSession: this.siopGetOPSession.bind(this),
siopRegisterOPSession: this.siopRegisterOPSession.bind(this),
siopRemoveOPSession: this.siopRemoveOPSession.bind(this),
/*authenticateWithSiop: this.authenticateWithSiop.bind(this),
getSiopAuthorizationRequestFromRP: this.siopGetAuthorizationRequestFromRP.bind(this),
getSiopAuthorizationRequestDetails: this.getSiopAuthorizationRequestDetails.bind(this),
verifySiopAuthorizationRequestURI: this.siopVerifyAuthorizationRequestURI.bind(this),
sendSiopAuthorizationResponse: this.sendSiopAuthorizationResponse.bind(this),*/
siopRegisterOPCustomApproval: this.siopRegisterOPCustomApproval.bind(this),
siopRemoveOPCustomApproval: this.siopRemoveOPCustomApproval.bind(this),
}
Expand Down Expand Up @@ -79,53 +74,4 @@ export class DidAuthSiopOpAuthenticator implements IAgentPlugin {
private async siopRemoveOPCustomApproval(args: IRemoveCustomApprovalForSiopArgs, context: IRequiredContext): Promise<boolean> {
return delete this.customApprovals[args.key]
}
/*
private async authenticateWithSiop(args: IAuthenticateWithSiopArgs, context: IRequiredContext): Promise<Response> {
return this.siopGetOPSession({ sessionId: args.sessionId }, context).then((session: OpSession) =>
session.authenticateWithSiop({
...args,
customApprovals: this.customApprovals,
}).then(async (response: Response) => {
await context.agent.emit(events.DID_SIOP_AUTHENTICATED, response)
return response
}),
)
}
private async getSiopAuthorizationRequestDetails(
args: IGetSiopAuthorizationRequestDetailsArgs,
context: IRequiredContext,
): Promise<IAuthRequestDetails> {
const uniqueVcs: Array<UniqueVerifiableCredential> = await context.agent.dataStoreORMGetVerifiableCredentials(args.credentialFilter)
const verifiableCredentials: W3CVerifiableCredential[] = uniqueVcs.map(
(uniqueVc: UniqueVerifiableCredential) => uniqueVc.verifiableCredential as W3CVerifiableCredential,
)
return this.siopGetOPSession({ sessionId: args.sessionId }, context).then((session: OpSession) =>
session.getSiopAuthorizationRequestDetails({
...args,
verifiableCredentials,
presentationSignCallback: this.presentationSignCallback,
}),
)
}
private async siopVerifyAuthorizationRequestURI(
args: IVerifySiopAuthorizationRequestUriArgs,
context: IRequiredContext,
): Promise<VerifiedAuthorizationRequest> {
return this.siopGetOPSession({ sessionId: args.sessionId }, context).then((session: OpSession) =>
session.verifyAuthorizationRequest(args),
)
}
private async sendSiopAuthorizationResponse(args: ISendSiopAuthorizationResponseArgs, context: IRequiredContext): Promise<Response> {
return this.siopGetOPSession({ sessionId: args.sessionId }, context).then((session: OpSession) =>
session.sendSiopAuthorizationResponse(args).then(async (response: Response) => {
await context.agent.emit(events.DID_SIOP_AUTHENTICATED, response)
return response
}),
)
}*/
}
8 changes: 7 additions & 1 deletion packages/siopv2-oid4vp-op-auth/src/session/OID4VP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ export class OID4VP {
throw Error('No verifiable verifiableCredentials provided for presentation definition')
}

const proofOptions: ProofOptions = {
...opts?.proofOpts,
challenge: opts?.proofOpts?.challenge ?? this.session.nonce,
domain: opts?.proofOpts?.domain ?? (await this.session.getRedirectUri()),
}

let id: IIdentifier | undefined = opts?.identifierOpts?.identifier
if (!opts?.identifierOpts?.identifier) {
if (opts?.subjectIsHolder) {
Expand Down Expand Up @@ -114,7 +120,7 @@ export class OID4VP {
vcs.credentials,
signCallback,
{
proofOptions: opts?.proofOpts,
proofOptions,
holderDID: idOpts.identifier.did,
}
)
Expand Down
Loading

0 comments on commit 85325ae

Please sign in to comment.