Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/SPRIND-89 #300

Merged
merged 33 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
6166dcd
added support for first party applications
Brummos Jan 9, 2025
5a567f1
chore: added isFirstParty flag to sendAuthorizationResponse on op ses…
Brummos Jan 9, 2025
e70cecb
chore: updated oid4vc packages
Brummos Jan 9, 2025
9d9ee22
Merge branch 'develop' into feature/SPRIND-89
Brummos Jan 9, 2025
2f19e12
feat: added first party flow to holder plugin
Brummos Jan 16, 2025
60533d5
chore: set correct localization keys
Brummos Jan 16, 2025
b23d4e6
chore: cleanup
Brummos Jan 16, 2025
e6cf6da
chore: add option to set navigation listener for first party machine
Brummos Jan 17, 2025
b2ac54c
chore: for first party flow use presentation id from issuer options
Brummos Jan 17, 2025
9d177cb
Merge branch 'develop' into feature/SPRIND-89
Brummos Jan 17, 2025
80d4b22
chore: fixes
Brummos Jan 17, 2025
f5b162f
chore: added contact to first party machine context
Brummos Jan 17, 2025
110209f
chore: instance fix
Brummos Jan 17, 2025
aacd184
chore: added select credentials event
Brummos Jan 17, 2025
cd879d7
chore: added first party machine navigation type
Brummos Jan 17, 2025
af5d5c8
chore: added endpointOpts & presentationDefinitionId
sanderPostma Jan 17, 2025
2586e48
Merge remote-tracking branch 'origin/feature/SPRIND-89' into feature/…
sanderPostma Jan 17, 2025
9953373
chore: added correct exports
Brummos Jan 17, 2025
400af04
Merge branch 'feature/SPRIND-89' of https://github.com/Sphereon-Opens…
Brummos Jan 17, 2025
5836673
chore: export type
Brummos Jan 17, 2025
bce6d49
chore: fix type exports
Brummos Jan 17, 2025
4972075
chore: field name change
Brummos Jan 17, 2025
0d31428
chore: generate new client id when client has none
Brummos Jan 21, 2025
ba19df3
chore: set issuer state
Brummos Jan 21, 2025
7fa6278
chore: add hasher option on did auth siop authenticator
Brummos Jan 21, 2025
8f989fe
chore: refactor DidAuthSiopOpAuthenticator to use an object as options
Brummos Jan 21, 2025
78cc636
chore: fix plugin args
Brummos Jan 21, 2025
bd4a614
chore: set hasher on getOID4VP
Brummos Jan 21, 2025
84eee96
chore: args fix
Brummos Jan 21, 2025
6200d5d
chore: added hasher to args
Brummos Jan 21, 2025
d30c8af
chore: delegate declined and aborted events from the first party machine
Brummos Jan 22, 2025
432128a
chore: added ticket number to FIXME
Brummos Jan 22, 2025
4b0cd7e
chore: update packages
Brummos Jan 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/ebsi-support/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
},
"dependencies": {
"@ethersproject/random": "^5.7.0",
"@sphereon/did-auth-siop": "0.16.1-next.233",
"@sphereon/did-auth-siop-adapter": "0.16.1-next.233",
"@sphereon/did-auth-siop": "0.16.1-next.339",
"@sphereon/did-auth-siop-adapter": "0.16.1-next.339",
"@sphereon/pex": "5.0.0-unstable.28",
"@sphereon/pex-models": "^2.3.2",
"@sphereon/ssi-sdk-ext.did-resolver-ebsi": "0.27.0",
Expand Down Expand Up @@ -44,8 +44,8 @@
"xstate": "^4.38.3"
},
"devDependencies": {
"@sphereon/oid4vci-client": "0.16.1-next.233",
"@sphereon/oid4vci-common": "0.16.1-next.233",
"@sphereon/oid4vci-client": "0.16.1-next.339",
"@sphereon/oid4vci-common": "0.16.1-next.339",
"@sphereon/ssi-express-support": "workspace:*",
"@sphereon/ssi-sdk-ext.key-manager": "0.27.0",
"@sphereon/ssi-sdk-ext.kms-local": "0.27.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/mdl-mdoc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"build:clean": "tsc --build --clean && tsc --build"
},
"dependencies": {
"@sphereon/did-auth-siop": "0.16.1-next.233",
"@sphereon/did-auth-siop": "0.16.1-next.339",
"@sphereon/kmp-mdoc-core": "0.2.0-SNAPSHOT.26",
"@sphereon/pex": "5.0.0-unstable.28",
"@sphereon/pex-models": "^2.3.2",
Expand All @@ -35,8 +35,8 @@
"uuid": "^9.0.1"
},
"devDependencies": {
"@sphereon/oid4vci-client": "0.16.1-next.233",
"@sphereon/oid4vci-common": "0.16.1-next.233",
"@sphereon/oid4vci-client": "0.16.1-next.339",
"@sphereon/oid4vci-common": "0.16.1-next.339",
"@sphereon/ssi-express-support": "workspace:*",
"@sphereon/ssi-sdk-ext.key-manager": "0.27.0",
"@sphereon/ssi-sdk-ext.kms-local": "0.27.0",
Expand Down
9 changes: 6 additions & 3 deletions packages/oid4vci-holder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
},
"dependencies": {
"@sphereon/kmp-mdoc-core": "0.2.0-SNAPSHOT.26",
"@sphereon/oid4vci-client": "0.16.1-next.233",
"@sphereon/oid4vci-common": "0.16.1-next.233",
"@sphereon/did-auth-siop": "0.16.1-next.339",
"@sphereon/oid4vci-client": "0.16.1-next.339",
"@sphereon/oid4vci-common": "0.16.1-next.339",
"@sphereon/ssi-sdk-ext.did-utils": "0.27.0",
"@sphereon/ssi-sdk-ext.identifier-resolution": "0.27.0",
"@sphereon/ssi-sdk-ext.jwt-service": "0.27.0",
Expand All @@ -30,6 +31,7 @@
"@sphereon/ssi-sdk.mdl-mdoc": "workspace:*",
"@sphereon/ssi-sdk.oidf-client": "workspace:*",
"@sphereon/ssi-sdk.sd-jwt": "workspace:*",
"@sphereon/ssi-sdk.siopv2-oid4vp-op-auth": "workspace:*",
"@sphereon/ssi-sdk.xstate-machine-persistence": "workspace:*",
"@sphereon/ssi-types": "workspace:*",
"@veramo/core": "4.2.0",
Expand All @@ -43,7 +45,8 @@
"xstate": "^4.38.3"
},
"devDependencies": {
"@sphereon/oid4vc-common": "0.16.1-next.187",
"@sphereon/oid4vc-common": "0.16.1-next.339",
"@sphereon/ssi-sdk.siopv2-oid4vp-common": "workspace:*",
"@sphereon/ssi-sdk-ext.did-resolver-jwk": "0.27.0",
"@types/i18n-js": "^3.8.9",
"@types/lodash.memoize": "^4.1.9",
Expand Down
43 changes: 23 additions & 20 deletions packages/oid4vci-holder/src/agent/OID4VCIHolder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ import {
import { asArray, computeEntryHash } from '@veramo/utils'
import { decodeJWT } from 'did-jwt'
import { v4 as uuidv4 } from 'uuid'
import { OID4VCIMachine } from '../machine/oid4vciMachine'
import { OID4VCIMachine } from '../machines/oid4vciMachine'
import {
AddContactIdentityArgs,
AssertValidCredentialsArgs,
Attribute,
createCredentialsToSelectFromArgs,
CreateCredentialsToSelectFromArgs,
CredentialToAccept,
CredentialToSelectFromResult,
GetContactArgs,
Expand All @@ -91,20 +91,23 @@ import {
OID4VCIHolderOptions,
OID4VCIMachine as OID4VCIMachineId,
OID4VCIMachineInstanceOpts,
OID4VCIMachineServiceDefinitions,
OID4VCIMachineServices,
OnContactIdentityCreatedArgs,
OnCredentialStoredArgs,
OnIdentifierCreatedArgs,
PrepareStartArgs,
RequestType,
RequiredContext,
SendNotificationArgs,
StartFirstPartApplicationMachine,
StartResult,
StoreCredentialBrandingArgs,
StoreCredentialsArgs,
StoreIssuerBrandingArgs,
VerificationResult,
VerifyEBSICredentialIssuerArgs,
VerifyEBSICredentialIssuerResult,
VerifyEBSICredentialIssuerResult
} from '../types/IOID4VCIHolder'
import {
getBasicIssuerLocaleBranding,
Expand All @@ -115,8 +118,8 @@ import {
mapCredentialToAccept,
selectCredentialLocaleBranding,
verifyCredentialToAccept,
} from './OID4VCIHolderService'

startFirstPartApplicationMachine
} from '../services/OID4VCIHolderService'
import 'cross-fetch/polyfill'

/**
Expand Down Expand Up @@ -307,27 +310,27 @@ export class OID4VCIHolder implements IAgentPlugin {
*/
private async oid4vciHolderGetMachineInterpreter(opts: OID4VCIMachineInstanceOpts, context: RequiredContext): Promise<OID4VCIMachineId> {
const authorizationRequestOpts = { ...this.defaultAuthorizationRequestOpts, ...opts.authorizationRequestOpts }
const services = {
start: (args: PrepareStartArgs) =>
const services: OID4VCIMachineServiceDefinitions = {
[OID4VCIMachineServices.start]: (args: PrepareStartArgs) =>
this.oid4vciHolderStart(
{
...args,
authorizationRequestOpts,
},
context,
),
createCredentialsToSelectFrom: (args: createCredentialsToSelectFromArgs) => this.oid4vciHolderCreateCredentialsToSelectFrom(args, context),
getContact: (args: GetContactArgs) => this.oid4vciHolderGetContact(args, context),
getCredentials: (args: GetCredentialsArgs) =>
this.oid4vciHolderGetCredentials({ accessTokenOpts: args.accessTokenOpts ?? opts.accessTokenOpts, ...args }, context),
addContactIdentity: (args: AddContactIdentityArgs) => this.oid4vciHolderAddContactIdentity(args, context),
getIssuerBranding: (args: GetIssuerBrandingArgs) => this.oid4vciHolderGetIssuerBranding(args, context),
storeIssuerBranding: (args: StoreIssuerBrandingArgs) => this.oid4vciHolderStoreIssuerBranding(args, context),
assertValidCredentials: (args: AssertValidCredentialsArgs) => this.oid4vciHolderAssertValidCredentials(args, context),
storeCredentialBranding: (args: StoreCredentialBrandingArgs) => this.oid4vciHolderStoreCredentialBranding(args, context),
storeCredentials: (args: StoreCredentialsArgs) => this.oid4vciHolderStoreCredentials(args, context),
sendNotification: (args: SendNotificationArgs) => this.oid4vciHolderSendNotification(args, context),
getFederationTrust: (args: GetFederationTrustArgs) => this.getFederationTrust(args, context),
[OID4VCIMachineServices.startFirstPartApplicationFlow]: (args: StartFirstPartApplicationMachine) => startFirstPartApplicationMachine({ ...args, stateNavigationListener: opts.firstPartyStateNavigationListener }, context),
[OID4VCIMachineServices.createCredentialsToSelectFrom]: (args: CreateCredentialsToSelectFromArgs) => this.oid4vciHolderCreateCredentialsToSelectFrom(args, context),
[OID4VCIMachineServices.getContact]: (args: GetContactArgs) => this.oid4vciHolderGetContact(args, context),
[OID4VCIMachineServices.getCredentials]: (args: GetCredentialsArgs) => this.oid4vciHolderGetCredentials({ accessTokenOpts: args.accessTokenOpts ?? opts.accessTokenOpts, ...args }, context),
[OID4VCIMachineServices.addContactIdentity]: (args: AddContactIdentityArgs) => this.oid4vciHolderAddContactIdentity(args, context),
[OID4VCIMachineServices.getIssuerBranding]: (args: GetIssuerBrandingArgs) => this.oid4vciHolderGetIssuerBranding(args, context),
[OID4VCIMachineServices.storeIssuerBranding]: (args: StoreIssuerBrandingArgs) => this.oid4vciHolderStoreIssuerBranding(args, context),
[OID4VCIMachineServices.assertValidCredentials]: (args: AssertValidCredentialsArgs) => this.oid4vciHolderAssertValidCredentials(args, context),
[OID4VCIMachineServices.storeCredentialBranding]: (args: StoreCredentialBrandingArgs) => this.oid4vciHolderStoreCredentialBranding(args, context),
[OID4VCIMachineServices.storeCredentials]: (args: StoreCredentialsArgs) => this.oid4vciHolderStoreCredentials(args, context),
[OID4VCIMachineServices.sendNotification]: (args: SendNotificationArgs) => this.oid4vciHolderSendNotification(args, context),
[OID4VCIMachineServices.getFederationTrust]: (args: GetFederationTrustArgs) => this.getFederationTrust(args, context),
}

const oid4vciMachineInstanceArgs: OID4VCIMachineInstanceOpts = {
Expand Down Expand Up @@ -463,7 +466,7 @@ export class OID4VCIHolder implements IAgentPlugin {
}

private async oid4vciHolderCreateCredentialsToSelectFrom(
args: createCredentialsToSelectFromArgs,
args: CreateCredentialsToSelectFromArgs,
context: RequiredContext,
): Promise<Array<CredentialToSelectFromResult>> {
const { credentialBranding, locale, selectedCredentials /*, openID4VCIClientState*/, credentialsSupported } = args
Expand Down
6 changes: 4 additions & 2 deletions packages/oid4vci-holder/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
*/

export { OID4VCIHolder, oid4vciHolderContextMethods, signCallback } from './agent/OID4VCIHolder'
export * from './agent/OID4VCIHolderService'
export * from './services/OID4VCIHolderService'
export * from './services/FirstPartyMachineServices'
export * from './types/IOID4VCIHolder'
export * from './machine/headlessStateNavListener'
export * from './types/FirstPartyMachine'
export * from './listeners/headlessStateNavListener'
export * from './link-handler'
17 changes: 12 additions & 5 deletions packages/oid4vci-holder/src/link-handler/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,28 @@ import { AuthorizationRequestOpts, AuthorizationServerClientOpts, AuthzFlowType,
import { DefaultLinkPriorities, LinkHandlerAdapter } from '@sphereon/ssi-sdk.core'
import { IMachineStatePersistence, interpreterStartOrResume, SerializableState } from '@sphereon/ssi-sdk.xstate-machine-persistence'
import { IAgentContext } from '@veramo/core'
import { GetMachineArgs, IOID4VCIHolder, OID4VCIMachineEvents, OID4VCIMachineInterpreter, OID4VCIMachineState } from '../types/IOID4VCIHolder'
import {
GetMachineArgs,
IOID4VCIHolder,
OID4VCIMachineEvents,
OID4VCIMachineStateNavigationListener
} from '../types/IOID4VCIHolder'
import { FirstPartyMachineStateNavigationListener } from '../types/FirstPartyMachine'

/**
* This handler only handles credential offer links (either by value or by reference)
*/
export class OID4VCIHolderLinkHandler extends LinkHandlerAdapter {
private readonly context: IAgentContext<IOID4VCIHolder & IMachineStatePersistence>
private readonly stateNavigationListener:
| ((oid4vciMachine: OID4VCIMachineInterpreter, state: OID4VCIMachineState, navigation?: any) => Promise<void>)
| undefined
private readonly stateNavigationListener?: OID4VCIMachineStateNavigationListener
private readonly firstPartyStateNavigationListener?: FirstPartyMachineStateNavigationListener
private readonly noStateMachinePersistence: boolean
private readonly authorizationRequestOpts?: AuthorizationRequestOpts
private readonly clientOpts?: AuthorizationServerClientOpts
private readonly trustAnchors?: Array<string>

constructor(
args: Pick<GetMachineArgs, 'stateNavigationListener' | 'authorizationRequestOpts' | 'clientOpts' | 'trustAnchors'> & {
args: Pick<GetMachineArgs, 'stateNavigationListener' | 'authorizationRequestOpts' | 'clientOpts' | 'trustAnchors' | 'firstPartyStateNavigationListener'> & {
priority?: number | DefaultLinkPriorities
protocols?: Array<string | RegExp>
noStateMachinePersistence?: boolean
Expand All @@ -32,6 +37,7 @@ export class OID4VCIHolderLinkHandler extends LinkHandlerAdapter {
this.context = args.context
this.noStateMachinePersistence = args.noStateMachinePersistence === true
this.stateNavigationListener = args.stateNavigationListener
this.firstPartyStateNavigationListener = args.firstPartyStateNavigationListener
this.trustAnchors = args.trustAnchors
}

Expand Down Expand Up @@ -63,6 +69,7 @@ export class OID4VCIHolderLinkHandler extends LinkHandlerAdapter {
authorizationRequestOpts: { ...this.authorizationRequestOpts, ...opts?.authorizationRequestOpts },
...((clientOpts.clientId || clientOpts.clientAssertionType) && { clientOpts: clientOpts as AuthorizationServerClientOpts }),
stateNavigationListener: this.stateNavigationListener,
firstPartyStateNavigationListener: this.firstPartyStateNavigationListener
})

const interpreter = oid4vciMachine.interpreter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,9 @@
"oid4vci_machine_initiation_error_title": "Initiate OID4VCI provider",
"oid4vci_machine_credential_verification_failed_message": "The credential verification resulted in an error.",
"oid4vci_machine_credential_verification_schema_failed_message": "The credential schema verification resulted in an error.",
"oid4vci_machine_retrieve_federation_trust_error_title": "Retrieve federation trust"
"oid4vci_machine_retrieve_federation_trust_error_title": "Retrieve federation trust",
"oid4vci_machine_first_party_error_title": "First party flow",
"oid4vci_machine_send_authorization_challenge_request_error_title": "Sending authorization challenge request",
"oid4vci_machine_create_config_error_title": "Creating siopV2 config",
"oid4vci_machine_get_request_error_title": "Getting siopV2 request"
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,9 @@
"oid4vci_machine_credential_selection_error_title": "Credential selectie",
"oid4vci_machine_initiation_error_title": "Initiëren OID4VCI provider",
"oid4vci_machine_credential_verification_failed_message": "Verificatie van de credential leidde tot een fout.",
"oid4vci_machine_retrieve_federation_trust_error_title": "Ophalen federatievertrouwen"
"oid4vci_machine_retrieve_federation_trust_error_title": "Ophalen federatievertrouwen",
"oid4vci_machine_first_party_error_title": "Eerste partijstroom",
"oid4vci_machine_send_authorization_challenge_request_error_title": "Versturen autorisatie-uitdaging aanvraag",
"oid4vci_machine_create_config_error_title": "SiopV2-configuratie aanmaken",
"oid4vci_machine_get_request_error_title": "SiopV2-verzoek ophalen"
}
Loading
Loading