@sphereon/ssi-sdk.oid4vci-holder 0.33.1-feature.vcdm2.4 → 0.33.1-feature.vcdm2.tsup.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/index.cjs +25401 -0
  2. package/dist/index.cjs.map +1 -0
  3. package/dist/index.d.cts +786 -0
  4. package/dist/index.d.ts +785 -11
  5. package/dist/index.js +25355 -11
  6. package/dist/index.js.map +1 -1
  7. package/package.json +44 -34
  8. package/src/agent/OID4VCIHolder.ts +1 -1
  9. package/dist/agent/OID4VCIHolder.d.ts +0 -59
  10. package/dist/agent/OID4VCIHolder.d.ts.map +0 -1
  11. package/dist/agent/OID4VCIHolder.js +0 -882
  12. package/dist/agent/OID4VCIHolder.js.map +0 -1
  13. package/dist/index.d.ts.map +0 -1
  14. package/dist/link-handler/index.d.ts +0 -31
  15. package/dist/link-handler/index.d.ts.map +0 -1
  16. package/dist/link-handler/index.js +0 -71
  17. package/dist/link-handler/index.js.map +0 -1
  18. package/dist/listeners/headlessStateNavListener.d.ts +0 -3
  19. package/dist/listeners/headlessStateNavListener.d.ts.map +0 -1
  20. package/dist/listeners/headlessStateNavListener.js +0 -32
  21. package/dist/listeners/headlessStateNavListener.js.map +0 -1
  22. package/dist/localization/Localization.d.ts +0 -9
  23. package/dist/localization/Localization.d.ts.map +0 -1
  24. package/dist/localization/Localization.js +0 -41
  25. package/dist/localization/Localization.js.map +0 -1
  26. package/dist/localization/translations/en.json +0 -19
  27. package/dist/localization/translations/nl.json +0 -18
  28. package/dist/machines/firstPartyMachine.d.ts +0 -15
  29. package/dist/machines/firstPartyMachine.d.ts.map +0 -1
  30. package/dist/machines/firstPartyMachine.js +0 -223
  31. package/dist/machines/firstPartyMachine.js.map +0 -1
  32. package/dist/machines/oid4vciMachine.d.ts +0 -7
  33. package/dist/machines/oid4vciMachine.d.ts.map +0 -1
  34. package/dist/machines/oid4vciMachine.js +0 -708
  35. package/dist/machines/oid4vciMachine.js.map +0 -1
  36. package/dist/mappers/OIDC4VCIBrandingMapper.d.ts +0 -16
  37. package/dist/mappers/OIDC4VCIBrandingMapper.d.ts.map +0 -1
  38. package/dist/mappers/OIDC4VCIBrandingMapper.js +0 -229
  39. package/dist/mappers/OIDC4VCIBrandingMapper.js.map +0 -1
  40. package/dist/services/FirstPartyMachineServices.d.ts +0 -9
  41. package/dist/services/FirstPartyMachineServices.d.ts.map +0 -1
  42. package/dist/services/FirstPartyMachineServices.js +0 -42
  43. package/dist/services/FirstPartyMachineServices.js.map +0 -1
  44. package/dist/services/OID4VCIHolderService.d.ts +0 -28
  45. package/dist/services/OID4VCIHolderService.d.ts.map +0 -1
  46. package/dist/services/OID4VCIHolderService.js +0 -516
  47. package/dist/services/OID4VCIHolderService.js.map +0 -1
  48. package/dist/types/FirstPartyMachine.d.ts +0 -112
  49. package/dist/types/FirstPartyMachine.d.ts.map +0 -1
  50. package/dist/types/FirstPartyMachine.js +0 -27
  51. package/dist/types/FirstPartyMachine.js.map +0 -1
  52. package/dist/types/IOID4VCIHolder.d.ts +0 -558
  53. package/dist/types/IOID4VCIHolder.d.ts.map +0 -1
  54. package/dist/types/IOID4VCIHolder.js +0 -111
  55. package/dist/types/IOID4VCIHolder.js.map +0 -1
@@ -1,516 +0,0 @@
1
- import { LOG } from '@sphereon/oid4vci-client';
2
- import { getSupportedCredentials, getTypesFromCredentialSupported, getTypesFromObject, OpenId4VCIVersion, } from '@sphereon/oid4vci-common';
3
- import { KeyUse } from '@sphereon/ssi-sdk-ext.did-resolver-jwk';
4
- import { getOrCreatePrimaryIdentifier, SupportedDidMethodEnum } from '@sphereon/ssi-sdk-ext.did-utils';
5
- import { isIIdentifier, isManagedIdentifierDidResult, isManagedIdentifierResult, managedIdentifierToJwk, } from '@sphereon/ssi-sdk-ext.identifier-resolution';
6
- import { keyTypeFromCryptographicSuite } from '@sphereon/ssi-sdk-ext.key-utils';
7
- import { CredentialMapper, JoseSignatureAlgorithm, mdocDecodedCredentialToUniformCredential, sdJwtDecodedCredentialToUniformCredential, } from '@sphereon/ssi-types';
8
- import { asArray } from '@veramo/utils';
9
- import { translate } from '../localization/Localization';
10
- import { OID4VCIHolderEvent, } from '../types/IOID4VCIHolder';
11
- import { oid4vciGetCredentialBrandingFrom, sdJwtGetCredentialBrandingFrom, issuerLocaleBrandingFrom } from '../mappers/OIDC4VCIBrandingMapper';
12
- import { FirstPartyMachine } from '../machines/firstPartyMachine';
13
- import { FirstPartyMachineStateTypes } from '../types/FirstPartyMachine';
14
- import { defaultHasher } from '@sphereon/ssi-sdk.core';
15
- export const getCredentialBranding = async (args) => {
16
- const { credentialsSupported, context } = args;
17
- const credentialBranding = {};
18
- await Promise.all(Object.entries(credentialsSupported).map(async ([configId, credentialsConfigSupported]) => {
19
- let sdJwtTypeMetadata;
20
- if (credentialsConfigSupported.format === 'vc+sd-jwt') {
21
- const vct = credentialsConfigSupported.vct;
22
- if (vct.startsWith('http')) {
23
- try {
24
- sdJwtTypeMetadata = await context.agent.fetchSdJwtTypeMetadataFromVctUrl({ vct });
25
- }
26
- catch {
27
- // For now, we are just going to ignore and continue without any branding as we still have a fallback
28
- }
29
- }
30
- }
31
- let mappedLocaleBranding = [];
32
- if (sdJwtTypeMetadata) {
33
- mappedLocaleBranding = await sdJwtGetCredentialBrandingFrom({
34
- credentialDisplay: sdJwtTypeMetadata.display,
35
- claimsMetadata: sdJwtTypeMetadata.claims,
36
- });
37
- }
38
- else {
39
- mappedLocaleBranding = await oid4vciGetCredentialBrandingFrom({
40
- credentialDisplay: credentialsConfigSupported.display,
41
- issuerCredentialSubject:
42
- // @ts-ignore // FIXME SPRIND-123 add proper support for type recognition as claim display can be located elsewhere for v13
43
- credentialsSupported.claims !== undefined ? credentialsConfigSupported.claims : credentialsConfigSupported.credentialSubject,
44
- });
45
- }
46
- // TODO we should make the mapper part of the plugin, so that the logic for getting the branding becomes more clear and easier to use
47
- const localeBranding = await Promise.all(mappedLocaleBranding.map(async (localeBranding) => await context.agent.ibCredentialLocaleBrandingFrom({ localeBranding })));
48
- const defaultCredentialType = 'VerifiableCredential';
49
- const configSupportedTypes = getTypesFromCredentialSupported(credentialsConfigSupported);
50
- const credentialTypes = configSupportedTypes.length === 0 ? asArray(defaultCredentialType) : configSupportedTypes;
51
- const filteredCredentialTypes = credentialTypes.filter((type) => type !== defaultCredentialType);
52
- credentialBranding[filteredCredentialTypes[0]] = localeBranding; // TODO for now taking the first type
53
- }));
54
- return credentialBranding;
55
- };
56
- export const getBasicIssuerLocaleBranding = async (args) => {
57
- const { display, dynamicRegistrationClientMetadata, context } = args;
58
- return await Promise.all(display.map(async (issuerDisplay) => {
59
- // FIXME for now we do not have locale support for dynamicRegistrationClientMetadata, so we add all the metadata to every locale
60
- const branding = await issuerLocaleBrandingFrom({ issuerDisplay, dynamicRegistrationClientMetadata });
61
- return context.agent.ibIssuerLocaleBrandingFrom({ localeBranding: branding });
62
- }));
63
- };
64
- export const getCredentialConfigsBasedOnFormatPref = async (args) => {
65
- const { vcFormatPreferences, credentials } = args;
66
- const prefConfigs = {};
67
- Object.entries(credentials).forEach(([key, config]) => {
68
- const result = !config.format || vcFormatPreferences.map((pref) => pref.toLowerCase()).includes(config.format.toLowerCase());
69
- if (result) {
70
- prefConfigs[key] = config;
71
- }
72
- });
73
- return prefConfigs;
74
- };
75
- export const selectCredentialLocaleBranding = async (args) => {
76
- const { locale, localeBranding } = args;
77
- return localeBranding?.find((branding) => locale ? branding.locale?.startsWith(locale) || branding.locale === undefined : branding.locale === undefined);
78
- };
79
- export const verifyCredentialToAccept = async (args) => {
80
- const { mappedCredential, hasher, onVerifyEBSICredentialIssuer, schemaValidation, context } = args;
81
- const credential = mappedCredential.credentialToAccept.credentialResponse.credential;
82
- if (!credential) {
83
- return Promise.reject(Error('No credential found in credential response'));
84
- }
85
- const wrappedVC = CredentialMapper.toWrappedVerifiableCredential(credential, { hasher: hasher ?? defaultHasher });
86
- if (wrappedVC.decoded?.iss?.includes('did:ebsi:') ||
87
- (typeof wrappedVC.decoded?.vc?.issuer === 'string'
88
- ? wrappedVC.decoded?.vc?.issuer?.includes('did:ebsi:')
89
- : wrappedVC.decoded?.vc?.issuer?.existingInstanceId?.includes('did:ebsi:'))) {
90
- // TODO: Skipping VC validation for EBSI conformance issued credential, as their Issuer is not present in the ledger (sigh)
91
- // just calling the verifySchema functionality for ebsi credentials
92
- await context.agent.cvVerifySchema({ credential, hasher, validationPolicy: schemaValidation });
93
- if (JSON.stringify(wrappedVC.decoded).includes('vc:ebsi:conformance')) {
94
- return { source: wrappedVC, error: undefined, result: true, subResults: [] };
95
- }
96
- if (onVerifyEBSICredentialIssuer) {
97
- try {
98
- await onVerifyEBSICredentialIssuer({
99
- wrappedVc: wrappedVC,
100
- });
101
- }
102
- catch (e) {
103
- return { source: wrappedVC, error: e.message, result: true, subResults: [] };
104
- }
105
- }
106
- }
107
- const verificationResult = await context.agent.cvVerifyCredential({
108
- credential,
109
- hasher,
110
- // TODO WAL-675 we might want to allow these types of options as part of the context, now we have state machines. Allows us to pre-determine whether these policies apply and whether remote context should be fetched
111
- fetchRemoteContexts: true,
112
- policies: {
113
- schemaValidation: schemaValidation,
114
- credentialStatus: false,
115
- expirationDate: false,
116
- issuanceDate: false,
117
- },
118
- });
119
- if (!verificationResult.result || verificationResult.error) {
120
- return Promise.reject(Error(verificationResult.error ?? translate('oid4vci_machine_credential_verification_failed_message')));
121
- }
122
- return verificationResult;
123
- };
124
- export const mapCredentialToAccept = async (args) => {
125
- const { credentialToAccept, hasher } = args;
126
- const credentialResponse = credentialToAccept.credentialResponse;
127
- const verifiableCredential = credentialResponse.credential;
128
- if (!verifiableCredential) {
129
- return Promise.reject(Error('No credential found in credential response'));
130
- }
131
- const wrappedVerifiableCredential = CredentialMapper.toWrappedVerifiableCredential(verifiableCredential, { hasher });
132
- let uniformVerifiableCredential;
133
- if (CredentialMapper.isSdJwtDecodedCredential(wrappedVerifiableCredential.credential)) {
134
- uniformVerifiableCredential = await sdJwtDecodedCredentialToUniformCredential(wrappedVerifiableCredential.credential);
135
- }
136
- else if (CredentialMapper.isSdJwtEncoded(wrappedVerifiableCredential.credential)) {
137
- if (!hasher) {
138
- return Promise.reject('a hasher is required for encoded SD-JWT credentials');
139
- }
140
- const asyncHasher = (data, algorithm) => Promise.resolve(hasher(data, algorithm));
141
- const decodedSdJwt = await CredentialMapper.decodeSdJwtVcAsync(wrappedVerifiableCredential.credential, asyncHasher);
142
- uniformVerifiableCredential = sdJwtDecodedCredentialToUniformCredential(decodedSdJwt);
143
- }
144
- else if (CredentialMapper.isMsoMdocDecodedCredential(wrappedVerifiableCredential.credential)) {
145
- uniformVerifiableCredential = mdocDecodedCredentialToUniformCredential(wrappedVerifiableCredential.credential);
146
- }
147
- else {
148
- uniformVerifiableCredential = wrappedVerifiableCredential.credential;
149
- }
150
- const correlationId = typeof uniformVerifiableCredential.issuer === 'string'
151
- ? uniformVerifiableCredential.issuer
152
- : CredentialMapper.isSdJwtDecodedCredential(uniformVerifiableCredential)
153
- ? uniformVerifiableCredential.decodedPayload.iss
154
- : uniformVerifiableCredential.issuer.id;
155
- return {
156
- correlationId,
157
- credentialToAccept,
158
- types: credentialToAccept.types,
159
- rawVerifiableCredential: verifiableCredential,
160
- uniformVerifiableCredential,
161
- ...(credentialResponse.credential_subject_issuance && { credential_subject_issuance: credentialResponse.credential_subject_issuance }),
162
- };
163
- };
164
- export const getIdentifierOpts = async (args) => {
165
- const { issuanceOpt, context } = args;
166
- const { identifier: identifierArg } = issuanceOpt;
167
- if (identifierArg && isManagedIdentifierResult(identifierArg)) {
168
- return identifierArg;
169
- }
170
- const { supportedPreferredDidMethod, supportedBindingMethods, keyType = 'Secp256r1', kms = await context.agent.keyManagerGetDefaultKeyManagementSystem(), } = issuanceOpt;
171
- let identifier;
172
- if (identifierArg) {
173
- if (isIIdentifier(identifierArg.identifier)) {
174
- identifier = await context.agent.identifierManagedGet(identifierArg);
175
- }
176
- else if (!identifierArg.method && issuanceOpt.supportedBindingMethods.includes('jwk')) {
177
- identifier = await managedIdentifierToJwk(identifierArg, context);
178
- }
179
- else if (identifierArg.method && !supportedBindingMethods.includes(identifierArg.method)) {
180
- throw Error(`Supplied identifier method ${identifierArg.method} not supported by the issuer: ${supportedBindingMethods.join(',')}`);
181
- }
182
- else {
183
- identifier = await context.agent.identifierManagedGet(identifierArg);
184
- }
185
- }
186
- const agentContext = { ...context, agent: context.agent };
187
- if ((!identifierArg || isIIdentifier(identifierArg.identifier)) &&
188
- supportedPreferredDidMethod &&
189
- (!supportedBindingMethods || supportedBindingMethods.length === 0 || supportedBindingMethods.filter((method) => method.startsWith('did')))) {
190
- // previous code for managing DIDs only
191
- const { result, created } = await getOrCreatePrimaryIdentifier(agentContext, {
192
- method: supportedPreferredDidMethod,
193
- createOpts: {
194
- options: {
195
- type: issuanceOpt.keyType,
196
- use: KeyUse.Signature,
197
- codecName: issuanceOpt.codecName,
198
- kms: issuanceOpt.kms,
199
- },
200
- },
201
- });
202
- identifier = await context.agent.identifierManagedGetByDid({
203
- identifier: result,
204
- keyType,
205
- offlineWhenNoDIDRegistered: result.did.startsWith('did:ebsi:'),
206
- });
207
- if (created) {
208
- await agentContext.agent.emit(OID4VCIHolderEvent.IDENTIFIER_CREATED, { identifier });
209
- }
210
- }
211
- else if (supportedBindingMethods.includes('jwk')) {
212
- // todo: we probably should do something similar as with DIDs for re-use/new keys
213
- const key = await context.agent.keyManagerCreate({ type: keyType, kms, meta: { keyAlias: `key_${keyType}_${Date.now()}` } });
214
- // TODO. Create/move this to identifier service await agentContext.agent.emit(OID4VCIHolderEvent.IDENTIFIER_CREATED, { key })
215
- identifier = await managedIdentifierToJwk({ method: 'key', identifier: key, kmsKeyRef: key.kid }, context);
216
- // } else if (supportedBindingMethods.includes('cose_key')) {
217
- // // TODO COSE HERE
218
- // throw Error(`Holder currently does not support binding method: ${supportedBindingMethods.join(',')}`)
219
- }
220
- else {
221
- throw Error(`Holder currently does not support binding method: ${supportedBindingMethods.join(',')}`);
222
- }
223
- args.issuanceOpt.identifier = identifier;
224
- return identifier;
225
- };
226
- export const getCredentialConfigsSupportedMerged = async (args) => {
227
- let result = {};
228
- (await getCredentialConfigsSupported(args)).forEach((supported) => {
229
- result = { ...result, ...supported };
230
- });
231
- return result;
232
- };
233
- export const getCredentialConfigsSupported = async (args) => {
234
- const { types, configurationIds } = args;
235
- if (Array.isArray(types) && types.length > 0) {
236
- return Promise.all(types.map((type) => getCredentialConfigsSupportedBySingleTypeOrId({ ...args, types: type })));
237
- }
238
- else if (Array.isArray(configurationIds) && configurationIds.length > 0) {
239
- return Promise.all(configurationIds.map((configurationId) => getCredentialConfigsSupportedBySingleTypeOrId({
240
- ...args,
241
- configurationId,
242
- types: undefined,
243
- })));
244
- }
245
- const configs = await getCredentialConfigsSupportedBySingleTypeOrId({
246
- ...args,
247
- types: undefined,
248
- configurationId: undefined,
249
- });
250
- return configs && Object.keys(configs).length > 0 ? [configs] : [];
251
- };
252
- /**
253
- * Please note that this method only returns configs supported for a single set of credential types or a single config id.
254
- * If an offer contains multiple formats/types in an array or multiple config ids, you will have to call this method for all of them
255
- * @param args
256
- */
257
- export const getCredentialConfigsSupportedBySingleTypeOrId = async (args) => {
258
- const { client, vcFormatPreferences, configurationId } = args;
259
- let { format = undefined, types = undefined } = args;
260
- function createIdFromTypes(supported) {
261
- const format = supported.format;
262
- const type = getTypesFromObject(supported)?.join() ?? '';
263
- const id = `${type}:${format}`;
264
- return id;
265
- }
266
- if (configurationId) {
267
- const allSupported = client.getCredentialsSupported(false);
268
- return Object.fromEntries(Object.entries(allSupported).filter(([id, supported]) => id === configurationId || supported.id === configurationId || createIdFromTypes(supported) === configurationId));
269
- }
270
- if (!types && !client.credentialOffer) {
271
- return Promise.reject(Error('openID4VCIClient has no credentialOffer and no types where provided'));
272
- /*} else if (!format && !client.credentialOffer) {
273
- return Promise.reject(Error('openID4VCIClient has no credentialOffer and no formats where provided'))*/
274
- }
275
- // We should always have a credential offer at this point given the above
276
- if (!Array.isArray(format) && client.credentialOffer) {
277
- if (client.version() > OpenId4VCIVersion.VER_1_0_09 &&
278
- typeof client.credentialOffer.credential_offer === 'object' &&
279
- 'credentials' in client.credentialOffer.credential_offer) {
280
- format = client.credentialOffer.credential_offer.credentials
281
- .filter((cred) => typeof cred !== 'string')
282
- .map((cred) => cred.format);
283
- if (format?.length === 0) {
284
- format = undefined; // Otherwise we would match nothing
285
- }
286
- }
287
- }
288
- const offerSupported = getSupportedCredentials({
289
- types: types ? [types] : client.getCredentialOfferTypes(),
290
- format,
291
- version: client.version(),
292
- issuerMetadata: client.endpointMetadata.credentialIssuerMetadata,
293
- });
294
- let allSupported;
295
- if (!Array.isArray(offerSupported)) {
296
- allSupported = offerSupported;
297
- }
298
- else {
299
- allSupported = {};
300
- offerSupported.forEach((supported) => {
301
- if (supported.id) {
302
- allSupported[supported.id] = supported;
303
- return;
304
- }
305
- const id = createIdFromTypes(supported);
306
- allSupported[id] = supported;
307
- });
308
- }
309
- let credentialConfigsSupported = await getCredentialConfigsBasedOnFormatPref({
310
- credentials: allSupported,
311
- vcFormatPreferences,
312
- });
313
- if (!credentialConfigsSupported || Object.keys(credentialConfigsSupported).length === 0) {
314
- LOG.warning(`No matching supported credential found for ${client.getIssuer()}`);
315
- }
316
- if (client.credentialOffer === undefined) {
317
- return credentialConfigsSupported;
318
- }
319
- // Filter configurations based on the credential offer IDs
320
- const credentialOffer = client.credentialOffer.credential_offer;
321
- let credentialsToOffer;
322
- if ('credential_configuration_ids' in credentialOffer) {
323
- credentialsToOffer = Object.fromEntries(Object.entries(credentialConfigsSupported).filter(([configId, config]) => credentialOffer.credential_configuration_ids.includes(configId)));
324
- if (Object.keys(credentialsToOffer).length === 0) {
325
- throw new Error(`No matching supported credential configs found for offer ${credentialOffer.credential_configuration_ids.join(', ')}`);
326
- }
327
- }
328
- else {
329
- credentialsToOffer = credentialConfigsSupported;
330
- }
331
- if (Object.keys(credentialsToOffer).length === 0) {
332
- // Same check as above, but more generic error message, as it can also apply to below draft 13
333
- throw new Error(`No matching supported credential configs found for offer`);
334
- }
335
- return credentialsToOffer;
336
- };
337
- export const getIssuanceOpts = async (args) => {
338
- const { client, credentialsSupported,
339
- // serverMetadata,
340
- context, didMethodPreferences, jwtCryptographicSuitePreferences, jsonldCryptographicSuitePreferences, forceIssuanceOpt, } = args;
341
- if (credentialsSupported === undefined || Object.keys(credentialsSupported).length === 0) {
342
- return Promise.reject(Error('No credentials supported'));
343
- }
344
- const getIssuanceOpts = Object.values(credentialsSupported).map(async (credentialSupported) => {
345
- /*if (!serverMetadata?.credentialIssuerMetadata) {
346
- return await getDefaultIssuanceOpts({ credentialSupported, opts: { client }, context })
347
- }*/
348
- const cryptographicSuite = await getIssuanceCryptoSuite({
349
- credentialSupported,
350
- client,
351
- jwtCryptographicSuitePreferences,
352
- jsonldCryptographicSuitePreferences,
353
- });
354
- const { didMethod, methods } = await getIssuanceMethod({
355
- credentialSupported,
356
- client,
357
- didMethodPreferences,
358
- });
359
- if (methods.length == 0) {
360
- console.log(`Could not determine supported cryptographic_binding_methods_supported, will use DIDs`);
361
- methods.push('did');
362
- }
363
- const issuanceOpt = forceIssuanceOpt
364
- ? { ...credentialSupported, ...forceIssuanceOpt }
365
- : {
366
- ...credentialSupported,
367
- supportedPreferredDidMethod: didMethod,
368
- supportedBindingMethods: methods,
369
- format: credentialSupported.format,
370
- keyType: client.isEBSI() ? 'Secp256r1' : keyTypeFromCryptographicSuite({ crv: cryptographicSuite }),
371
- ...(client.isEBSI() && { codecName: 'EBSI' }),
372
- };
373
- const identifier = await getIdentifierOpts({ issuanceOpt, context });
374
- if (!client.clientId && isManagedIdentifierDidResult(identifier)) {
375
- // FIXME: We really should fetch server metadata. Have user select required credentials. Take the first cred to determine a kid when no clientId is present and set that.
376
- // Needs a preference service for crypto, keys, dids, and clientId, with ecosystem support
377
- client.clientId = identifier.issuer ?? identifier.did;
378
- }
379
- return { ...issuanceOpt, identifier };
380
- });
381
- return await Promise.all(getIssuanceOpts);
382
- };
383
- export const getIssuanceMethod = async (opts) => {
384
- const { client, credentialSupported, didMethodPreferences } = opts;
385
- const { format, cryptographic_binding_methods_supported } = credentialSupported;
386
- let methods = []; // we use the external identifier method, as we should be supporting all values in the server metadata anyway
387
- if (cryptographic_binding_methods_supported && Array.isArray(cryptographic_binding_methods_supported)) {
388
- methods = cryptographic_binding_methods_supported;
389
- const didMethods = didMethodPreferences.find((method) => cryptographic_binding_methods_supported.includes(`did:${method.toLowerCase() /*.replace('did:', '')*/}`));
390
- if (didMethods) {
391
- return { methods, didMethod: didMethods };
392
- }
393
- else if (cryptographic_binding_methods_supported.includes('did')) {
394
- return { methods, didMethod: format ? didMethodPreferences[1] : didMethodPreferences[0] };
395
- }
396
- else if (methods.length > 0) {
397
- return { methods };
398
- }
399
- console.warn(`We should have been able to determine cryptographic_binding_methods_supported, will fall back to legacy behaviour. This is likely a bug`);
400
- }
401
- if (client.isEBSI()) {
402
- return { methods: ['did'], didMethod: SupportedDidMethodEnum.DID_KEY };
403
- }
404
- // legacy fallback
405
- methods = ['did'];
406
- if (!format || (format.includes('jwt') && !format?.includes('jwt_vc_json_ld'))) {
407
- return { methods, didMethod: format ? didMethodPreferences[1] : didMethodPreferences[0] };
408
- }
409
- else {
410
- // JsonLD
411
- return { methods, didMethod: didMethodPreferences[0] };
412
- }
413
- };
414
- export const getIssuanceCryptoSuite = async (opts) => {
415
- const { client, credentialSupported, jwtCryptographicSuitePreferences, jsonldCryptographicSuitePreferences } = opts;
416
- let signing_algs_supported;
417
- if ('proof_types_supported' in credentialSupported && credentialSupported.proof_types_supported) {
418
- if ('jwt' in credentialSupported.proof_types_supported && credentialSupported.proof_types_supported.jwt) {
419
- signing_algs_supported = credentialSupported.proof_types_supported.jwt.proof_signing_alg_values_supported;
420
- }
421
- else if ('ldp_vp' in credentialSupported.proof_types_supported && credentialSupported.proof_types_supported.ldp_vp) {
422
- signing_algs_supported = credentialSupported.proof_types_supported.ldp_vp.proof_signing_alg_values_supported;
423
- }
424
- else if ('cwt' in credentialSupported.proof_types_supported && credentialSupported.proof_types_supported.cwt) {
425
- signing_algs_supported = credentialSupported.proof_types_supported.cwt.proof_signing_alg_values_supported;
426
- console.error('cwt proof type not supported. Likely that errors will occur after this point');
427
- }
428
- else {
429
- return Promise.reject(Error(`Unsupported proof_types_supported`));
430
- }
431
- }
432
- else {
433
- signing_algs_supported = asArray(
434
- // @ts-ignore // legacy
435
- credentialSupported.credential_signing_alg_values_supported ?? credentialSupported.proof_signing_alg_values_supported ?? []);
436
- }
437
- // TODO: Return array, so the wallet/user could choose
438
- switch (credentialSupported.format) {
439
- // @ts-ignore legacy value
440
- case 'jwt':
441
- case 'jwt_vc_json':
442
- case 'jwt_vc':
443
- case 'vc+sd-jwt':
444
- case 'mso_mdoc': {
445
- const supportedPreferences = jwtCryptographicSuitePreferences.filter((suite) => signing_algs_supported.includes(suite));
446
- if (supportedPreferences.length > 0) {
447
- return supportedPreferences[0];
448
- }
449
- else if (client.isEBSI()) {
450
- return JoseSignatureAlgorithm.ES256;
451
- }
452
- // if we cannot find supported cryptographic suites, we just try with the first preference
453
- const fallback = jwtCryptographicSuitePreferences[0];
454
- console.log(`Warn: We could not determine the crypto suites from the server metadata, and will fallback to a default: ${fallback}`);
455
- return fallback;
456
- }
457
- // @ts-ignore
458
- case 'ldp':
459
- // @ts-ignore
460
- case 'jwt_vc_json_ld':
461
- case 'ldp_vc': {
462
- const supportedPreferences = jsonldCryptographicSuitePreferences.filter((suite) => signing_algs_supported.includes(suite));
463
- if (supportedPreferences.length > 0) {
464
- return supportedPreferences[0];
465
- }
466
- // if we cannot find supported cryptographic suites, we just try with the first preference
467
- const fallback = jsonldCryptographicSuitePreferences[0];
468
- console.log(`Warn: We could not determine the crypto suites from the server metadata, and will fallback to a default: ${fallback}`);
469
- return fallback;
470
- }
471
- default:
472
- return Promise.reject(Error(`Credential format '${credentialSupported.format}' not supported`));
473
- }
474
- };
475
- export const startFirstPartApplicationMachine = async (args, context) => {
476
- const { openID4VCIClientState, stateNavigationListener, contact } = args;
477
- if (!openID4VCIClientState) {
478
- return Promise.reject(Error('Missing openID4VCI client state in context'));
479
- }
480
- if (!contact) {
481
- return Promise.reject(Error('Missing contact in context'));
482
- }
483
- const firstPartyMachineInstance = FirstPartyMachine.newInstance({
484
- openID4VCIClientState,
485
- contact,
486
- agentContext: context,
487
- stateNavigationListener,
488
- });
489
- return new Promise((resolve, reject) => {
490
- try {
491
- firstPartyMachineInstance.onTransition((state) => {
492
- if (state.matches(FirstPartyMachineStateTypes.done)) {
493
- const authorizationCodeResponse = state.context.authorizationCodeResponse;
494
- if (!authorizationCodeResponse) {
495
- reject(Error('No authorizationCodeResponse acquired'));
496
- }
497
- resolve(authorizationCodeResponse);
498
- }
499
- else if (state.matches(FirstPartyMachineStateTypes.aborted)) {
500
- resolve(FirstPartyMachineStateTypes.aborted);
501
- }
502
- else if (state.matches(FirstPartyMachineStateTypes.declined)) {
503
- resolve(FirstPartyMachineStateTypes.declined);
504
- }
505
- else if (state.matches(FirstPartyMachineStateTypes.error)) {
506
- reject(state.context.error);
507
- }
508
- });
509
- firstPartyMachineInstance.start();
510
- }
511
- catch (error) {
512
- reject(error);
513
- }
514
- });
515
- };
516
- //# sourceMappingURL=OID4VCIHolderService.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"OID4VCIHolderService.js","sourceRoot":"","sources":["../../src/services/OID4VCIHolderService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAA;AAC9C,OAAO,EAML,uBAAuB,EACvB,+BAA+B,EAC/B,kBAAkB,EAElB,iBAAiB,GAElB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,wCAAwC,CAAA;AAC/D,OAAO,EAAE,4BAA4B,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAA;AACtG,OAAO,EACL,aAAa,EACb,4BAA4B,EAC5B,yBAAyB,EAGzB,sBAAsB,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