@sphereon/ssi-sdk.oid4vci-holder 0.34.1-next.29 → 0.34.1-next.299
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.
- package/dist/index.cjs +426 -420
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -7
- package/dist/index.d.ts +10 -7
- package/dist/index.js +533 -527
- package/dist/index.js.map +1 -1
- package/package.json +25 -24
- package/src/agent/OID4VCIHolder.ts +35 -34
- package/src/machines/firstPartyMachine.ts +1 -1
- package/src/machines/oid4vciMachine.ts +1 -1
- package/src/mappers/OIDC4VCIBrandingMapper.ts +1 -1
- package/src/services/OID4VCIHolderService.ts +46 -45
- package/src/types/FirstPartyMachine.ts +6 -5
- package/src/types/IOID4VCIHolder.ts +4 -2
package/dist/index.cjs
CHANGED
|
@@ -100,6 +100,7 @@ __export(index_exports, {
|
|
|
100
100
|
RequestType: () => RequestType,
|
|
101
101
|
SupportedLanguage: () => SupportedLanguage,
|
|
102
102
|
createConfig: () => createConfig,
|
|
103
|
+
extractCredentialFromResponse: () => extractCredentialFromResponse,
|
|
103
104
|
getBasicIssuerLocaleBranding: () => getBasicIssuerLocaleBranding,
|
|
104
105
|
getCredentialBranding: () => getCredentialBranding,
|
|
105
106
|
getCredentialConfigsBasedOnFormatPref: () => getCredentialConfigsBasedOnFormatPref,
|
|
@@ -139,9 +140,12 @@ var import_oid4vci_common4 = require("@sphereon/oid4vci-common");
|
|
|
139
140
|
var import_ssi_sdk_ext5 = require("@sphereon/ssi-sdk-ext.did-utils");
|
|
140
141
|
var import_ssi_sdk_ext6 = require("@sphereon/ssi-sdk-ext.identifier-resolution");
|
|
141
142
|
var import_ssi_sdk_ext7 = require("@sphereon/ssi-sdk-ext.key-utils");
|
|
142
|
-
var import_ssi_sdk2 = require("@sphereon/ssi-sdk.
|
|
143
|
+
var import_ssi_sdk2 = require("@sphereon/ssi-sdk.core");
|
|
144
|
+
var import_ssi_sdk3 = require("@sphereon/ssi-sdk.data-store-types");
|
|
145
|
+
var import_ssi_sdk4 = require("@sphereon/ssi-sdk.data-store-types");
|
|
143
146
|
var import_ssi_types2 = require("@sphereon/ssi-types");
|
|
144
147
|
var import_utils2 = require("@veramo/utils");
|
|
148
|
+
var import_cross_fetch = __toESM(require("cross-fetch"), 1);
|
|
145
149
|
var import_did_jwt = require("did-jwt");
|
|
146
150
|
var import_uuid2 = require("uuid");
|
|
147
151
|
|
|
@@ -154,18 +158,18 @@ var import_i18n_js = __toESM(require("i18n-js"), 1);
|
|
|
154
158
|
var import_lodash = __toESM(require("lodash.memoize"), 1);
|
|
155
159
|
|
|
156
160
|
// src/types/IOID4VCIHolder.ts
|
|
157
|
-
var OID4VCIHolderEvent = /* @__PURE__ */ function(OID4VCIHolderEvent2) {
|
|
161
|
+
var OID4VCIHolderEvent = /* @__PURE__ */ (function(OID4VCIHolderEvent2) {
|
|
158
162
|
OID4VCIHolderEvent2["CONTACT_IDENTITY_CREATED"] = "contact_identity_created";
|
|
159
163
|
OID4VCIHolderEvent2["CREDENTIAL_STORED"] = "credential_stored";
|
|
160
164
|
OID4VCIHolderEvent2["IDENTIFIER_CREATED"] = "identifier_created";
|
|
161
165
|
return OID4VCIHolderEvent2;
|
|
162
|
-
}({});
|
|
163
|
-
var SupportedLanguage = /* @__PURE__ */ function(SupportedLanguage2) {
|
|
166
|
+
})({});
|
|
167
|
+
var SupportedLanguage = /* @__PURE__ */ (function(SupportedLanguage2) {
|
|
164
168
|
SupportedLanguage2["ENGLISH"] = "en";
|
|
165
169
|
SupportedLanguage2["DUTCH"] = "nl";
|
|
166
170
|
return SupportedLanguage2;
|
|
167
|
-
}({});
|
|
168
|
-
var OID4VCIMachineStates = /* @__PURE__ */ function(OID4VCIMachineStates2) {
|
|
171
|
+
})({});
|
|
172
|
+
var OID4VCIMachineStates = /* @__PURE__ */ (function(OID4VCIMachineStates2) {
|
|
169
173
|
OID4VCIMachineStates2["start"] = "start";
|
|
170
174
|
OID4VCIMachineStates2["createCredentialsToSelectFrom"] = "createCredentialsToSelectFrom";
|
|
171
175
|
OID4VCIMachineStates2["getContact"] = "getContact";
|
|
@@ -196,18 +200,18 @@ var OID4VCIMachineStates = /* @__PURE__ */ function(OID4VCIMachineStates2) {
|
|
|
196
200
|
OID4VCIMachineStates2["error"] = "error";
|
|
197
201
|
OID4VCIMachineStates2["done"] = "done";
|
|
198
202
|
return OID4VCIMachineStates2;
|
|
199
|
-
}({});
|
|
200
|
-
var OID4VCIMachineAddContactStates = /* @__PURE__ */ function(OID4VCIMachineAddContactStates2) {
|
|
203
|
+
})({});
|
|
204
|
+
var OID4VCIMachineAddContactStates = /* @__PURE__ */ (function(OID4VCIMachineAddContactStates2) {
|
|
201
205
|
OID4VCIMachineAddContactStates2["idle"] = "idle";
|
|
202
206
|
OID4VCIMachineAddContactStates2["next"] = "next";
|
|
203
207
|
return OID4VCIMachineAddContactStates2;
|
|
204
|
-
}({});
|
|
205
|
-
var OID4VCIMachineVerifyPinStates = /* @__PURE__ */ function(OID4VCIMachineVerifyPinStates2) {
|
|
208
|
+
})({});
|
|
209
|
+
var OID4VCIMachineVerifyPinStates = /* @__PURE__ */ (function(OID4VCIMachineVerifyPinStates2) {
|
|
206
210
|
OID4VCIMachineVerifyPinStates2["idle"] = "idle";
|
|
207
211
|
OID4VCIMachineVerifyPinStates2["next"] = "next";
|
|
208
212
|
return OID4VCIMachineVerifyPinStates2;
|
|
209
|
-
}({});
|
|
210
|
-
var OID4VCIMachineEvents = /* @__PURE__ */ function(OID4VCIMachineEvents2) {
|
|
213
|
+
})({});
|
|
214
|
+
var OID4VCIMachineEvents = /* @__PURE__ */ (function(OID4VCIMachineEvents2) {
|
|
211
215
|
OID4VCIMachineEvents2["NEXT"] = "NEXT";
|
|
212
216
|
OID4VCIMachineEvents2["PREVIOUS"] = "PREVIOUS";
|
|
213
217
|
OID4VCIMachineEvents2["DECLINE"] = "DECLINE";
|
|
@@ -220,14 +224,15 @@ var OID4VCIMachineEvents = /* @__PURE__ */ function(OID4VCIMachineEvents2) {
|
|
|
220
224
|
OID4VCIMachineEvents2["INVOKED_AUTHORIZATION_CODE_REQUEST"] = "INVOKED_AUTHORIZATION_CODE_REQUEST";
|
|
221
225
|
OID4VCIMachineEvents2["PROVIDE_AUTHORIZATION_CODE_RESPONSE"] = "PROVIDE_AUTHORIZATION_CODE_RESPONSE";
|
|
222
226
|
return OID4VCIMachineEvents2;
|
|
223
|
-
}({});
|
|
224
|
-
var OID4VCIMachineGuards = /* @__PURE__ */ function(OID4VCIMachineGuards2) {
|
|
227
|
+
})({});
|
|
228
|
+
var OID4VCIMachineGuards = /* @__PURE__ */ (function(OID4VCIMachineGuards2) {
|
|
225
229
|
OID4VCIMachineGuards2["hasContactGuard"] = "oid4vciHasContactGuard";
|
|
226
230
|
OID4VCIMachineGuards2["hasNoContactGuard"] = "oid4vciHasNoContactGuard";
|
|
227
231
|
OID4VCIMachineGuards2["credentialsToSelectRequiredGuard"] = "oid4vciCredentialsToSelectRequiredGuard";
|
|
228
232
|
OID4VCIMachineGuards2["requirePinGuard"] = "oid4vciRequirePinGuard";
|
|
229
233
|
OID4VCIMachineGuards2["requireAuthorizationGuard"] = "oid4vciRequireAuthorizationGuard";
|
|
230
234
|
OID4VCIMachineGuards2["noAuthorizationGuard"] = "oid4vciNoAuthorizationGuard";
|
|
235
|
+
OID4VCIMachineGuards2["hasNonceEndpointGuard"] = "oid4vciHasNonceEndpointGuard ";
|
|
231
236
|
OID4VCIMachineGuards2["hasAuthorizationResponse"] = "oid4vciHasAuthorizationResponse";
|
|
232
237
|
OID4VCIMachineGuards2["hasNoContactIdentityGuard"] = "oid4vciHasNoContactIdentityGuard";
|
|
233
238
|
OID4VCIMachineGuards2["verificationCodeGuard"] = "oid4vciVerificationCodeGuard";
|
|
@@ -237,8 +242,8 @@ var OID4VCIMachineGuards = /* @__PURE__ */ function(OID4VCIMachineGuards2) {
|
|
|
237
242
|
OID4VCIMachineGuards2["contactHasLowTrustGuard"] = "oid4vciContactHasLowTrustGuard";
|
|
238
243
|
OID4VCIMachineGuards2["isFirstPartyApplication"] = "oid4vciIsFirstPartyApplication";
|
|
239
244
|
return OID4VCIMachineGuards2;
|
|
240
|
-
}({});
|
|
241
|
-
var OID4VCIMachineServices = /* @__PURE__ */ function(OID4VCIMachineServices2) {
|
|
245
|
+
})({});
|
|
246
|
+
var OID4VCIMachineServices = /* @__PURE__ */ (function(OID4VCIMachineServices2) {
|
|
242
247
|
OID4VCIMachineServices2["start"] = "start";
|
|
243
248
|
OID4VCIMachineServices2["getContact"] = "getContact";
|
|
244
249
|
OID4VCIMachineServices2["getFederationTrust"] = "getFederationTrust";
|
|
@@ -253,17 +258,17 @@ var OID4VCIMachineServices = /* @__PURE__ */ function(OID4VCIMachineServices2) {
|
|
|
253
258
|
OID4VCIMachineServices2["storeCredentials"] = "storeCredentials";
|
|
254
259
|
OID4VCIMachineServices2["startFirstPartApplicationFlow"] = "startFirstPartApplicationFlow";
|
|
255
260
|
return OID4VCIMachineServices2;
|
|
256
|
-
}({});
|
|
257
|
-
var RequestType = /* @__PURE__ */ function(RequestType2) {
|
|
261
|
+
})({});
|
|
262
|
+
var RequestType = /* @__PURE__ */ (function(RequestType2) {
|
|
258
263
|
RequestType2["OPENID_INITIATE_ISSUANCE"] = "openid-initiate-issuance";
|
|
259
264
|
RequestType2["OPENID_CREDENTIAL_OFFER"] = "openid-credential-offer";
|
|
260
265
|
RequestType2["URL"] = "URL";
|
|
261
266
|
return RequestType2;
|
|
262
|
-
}({});
|
|
263
|
-
var IdentifierAliasEnum = /* @__PURE__ */ function(IdentifierAliasEnum2) {
|
|
267
|
+
})({});
|
|
268
|
+
var IdentifierAliasEnum = /* @__PURE__ */ (function(IdentifierAliasEnum2) {
|
|
264
269
|
IdentifierAliasEnum2["PRIMARY"] = "primary";
|
|
265
270
|
return IdentifierAliasEnum2;
|
|
266
|
-
}({});
|
|
271
|
+
})({});
|
|
267
272
|
|
|
268
273
|
// src/localization/Localization.ts
|
|
269
274
|
var Localization = class Localization2 {
|
|
@@ -305,7 +310,7 @@ var Localization = class Localization2 {
|
|
|
305
310
|
var translate = Localization.translate;
|
|
306
311
|
|
|
307
312
|
// src/types/FirstPartyMachine.ts
|
|
308
|
-
var FirstPartyMachineStateTypes = /* @__PURE__ */ function(FirstPartyMachineStateTypes2) {
|
|
313
|
+
var FirstPartyMachineStateTypes = /* @__PURE__ */ (function(FirstPartyMachineStateTypes2) {
|
|
309
314
|
FirstPartyMachineStateTypes2["sendAuthorizationChallengeRequest"] = "sendAuthorizationChallengeRequest";
|
|
310
315
|
FirstPartyMachineStateTypes2["sendAuthorizationResponse"] = "sendAuthorizationResponse";
|
|
311
316
|
FirstPartyMachineStateTypes2["selectCredentials"] = "selectCredentials";
|
|
@@ -316,21 +321,21 @@ var FirstPartyMachineStateTypes = /* @__PURE__ */ function(FirstPartyMachineStat
|
|
|
316
321
|
FirstPartyMachineStateTypes2["aborted"] = "aborted";
|
|
317
322
|
FirstPartyMachineStateTypes2["declined"] = "declined";
|
|
318
323
|
return FirstPartyMachineStateTypes2;
|
|
319
|
-
}({});
|
|
320
|
-
var FirstPartyMachineServices = /* @__PURE__ */ function(FirstPartyMachineServices2) {
|
|
324
|
+
})({});
|
|
325
|
+
var FirstPartyMachineServices = /* @__PURE__ */ (function(FirstPartyMachineServices2) {
|
|
321
326
|
FirstPartyMachineServices2["sendAuthorizationChallengeRequest"] = "sendAuthorizationChallengeRequest";
|
|
322
327
|
FirstPartyMachineServices2["sendAuthorizationResponse"] = "sendAuthorizationResponse";
|
|
323
328
|
FirstPartyMachineServices2["createConfig"] = "createConfig";
|
|
324
329
|
FirstPartyMachineServices2["getSiopRequest"] = "getSiopRequest";
|
|
325
330
|
return FirstPartyMachineServices2;
|
|
326
|
-
}({});
|
|
327
|
-
var FirstPartyMachineEvents = /* @__PURE__ */ function(FirstPartyMachineEvents2) {
|
|
331
|
+
})({});
|
|
332
|
+
var FirstPartyMachineEvents = /* @__PURE__ */ (function(FirstPartyMachineEvents2) {
|
|
328
333
|
FirstPartyMachineEvents2["NEXT"] = "NEXT";
|
|
329
334
|
FirstPartyMachineEvents2["PREVIOUS"] = "PREVIOUS";
|
|
330
335
|
FirstPartyMachineEvents2["DECLINE"] = "DECLINE";
|
|
331
336
|
FirstPartyMachineEvents2["SET_SELECTED_CREDENTIALS"] = "SET_SELECTED_CREDENTIALS";
|
|
332
337
|
return FirstPartyMachineEvents2;
|
|
333
|
-
}({});
|
|
338
|
+
})({});
|
|
334
339
|
|
|
335
340
|
// src/machines/oid4vciMachine.ts
|
|
336
341
|
var oid4vciHasNoContactGuard = /* @__PURE__ */ __name((_ctx, _event) => {
|
|
@@ -1060,271 +1065,10 @@ var import_ssi_sdk_ext = require("@sphereon/ssi-sdk-ext.did-resolver-jwk");
|
|
|
1060
1065
|
var import_ssi_sdk_ext2 = require("@sphereon/ssi-sdk-ext.did-utils");
|
|
1061
1066
|
var import_ssi_sdk_ext3 = require("@sphereon/ssi-sdk-ext.identifier-resolution");
|
|
1062
1067
|
var import_ssi_sdk_ext4 = require("@sphereon/ssi-sdk-ext.key-utils");
|
|
1068
|
+
var import_ssi_sdk = require("@sphereon/ssi-sdk.core");
|
|
1063
1069
|
var import_ssi_types = require("@sphereon/ssi-types");
|
|
1064
1070
|
var import_utils = require("@veramo/utils");
|
|
1065
1071
|
|
|
1066
|
-
// src/mappers/OIDC4VCIBrandingMapper.ts
|
|
1067
|
-
var oid4vciGetCredentialBrandingFrom = /* @__PURE__ */ __name(async (args) => {
|
|
1068
|
-
const { credentialDisplay, issuerCredentialSubject } = args;
|
|
1069
|
-
return oid4vciCombineDisplayLocalesFrom({
|
|
1070
|
-
...issuerCredentialSubject && {
|
|
1071
|
-
issuerCredentialSubjectLocales: await oid4vciIssuerCredentialSubjectLocalesFrom({
|
|
1072
|
-
issuerCredentialSubject
|
|
1073
|
-
})
|
|
1074
|
-
},
|
|
1075
|
-
...credentialDisplay && {
|
|
1076
|
-
credentialDisplayLocales: await oid4vciCredentialDisplayLocalesFrom({
|
|
1077
|
-
credentialDisplay
|
|
1078
|
-
})
|
|
1079
|
-
}
|
|
1080
|
-
});
|
|
1081
|
-
}, "oid4vciGetCredentialBrandingFrom");
|
|
1082
|
-
var oid4vciCredentialDisplayLocalesFrom = /* @__PURE__ */ __name(async (args) => {
|
|
1083
|
-
const { credentialDisplay } = args;
|
|
1084
|
-
return credentialDisplay.reduce((localeDisplays, display) => {
|
|
1085
|
-
const localeKey = display.locale || "";
|
|
1086
|
-
localeDisplays.set(localeKey, display);
|
|
1087
|
-
return localeDisplays;
|
|
1088
|
-
}, /* @__PURE__ */ new Map());
|
|
1089
|
-
}, "oid4vciCredentialDisplayLocalesFrom");
|
|
1090
|
-
var oid4vciIssuerCredentialSubjectLocalesFrom = /* @__PURE__ */ __name(async (args) => {
|
|
1091
|
-
const { issuerCredentialSubject } = args;
|
|
1092
|
-
const localeClaims = /* @__PURE__ */ new Map();
|
|
1093
|
-
const processClaimObject = /* @__PURE__ */ __name((claim, parentKey = "") => {
|
|
1094
|
-
Object.entries(claim).forEach(([key, value]) => {
|
|
1095
|
-
if (key === "mandatory" || key === "value_type") {
|
|
1096
|
-
return;
|
|
1097
|
-
}
|
|
1098
|
-
if (key === "display" && Array.isArray(value)) {
|
|
1099
|
-
value.forEach(({ name, locale = "" }) => {
|
|
1100
|
-
if (!name) {
|
|
1101
|
-
return;
|
|
1102
|
-
}
|
|
1103
|
-
if (!localeClaims.has(locale)) {
|
|
1104
|
-
localeClaims.set(locale, []);
|
|
1105
|
-
}
|
|
1106
|
-
localeClaims.get(locale).push({
|
|
1107
|
-
key: parentKey,
|
|
1108
|
-
name
|
|
1109
|
-
});
|
|
1110
|
-
});
|
|
1111
|
-
} else if (typeof value === "object" && value !== null) {
|
|
1112
|
-
processClaimObject(value, parentKey ? `${parentKey}.${key}` : key);
|
|
1113
|
-
}
|
|
1114
|
-
});
|
|
1115
|
-
}, "processClaimObject");
|
|
1116
|
-
processClaimObject(issuerCredentialSubject);
|
|
1117
|
-
return localeClaims;
|
|
1118
|
-
}, "oid4vciIssuerCredentialSubjectLocalesFrom");
|
|
1119
|
-
var oid4vciCredentialLocaleBrandingFrom = /* @__PURE__ */ __name(async (args) => {
|
|
1120
|
-
const { credentialDisplay } = args;
|
|
1121
|
-
return {
|
|
1122
|
-
...credentialDisplay.name && {
|
|
1123
|
-
alias: credentialDisplay.name
|
|
1124
|
-
},
|
|
1125
|
-
...credentialDisplay.locale && {
|
|
1126
|
-
locale: credentialDisplay.locale
|
|
1127
|
-
},
|
|
1128
|
-
...credentialDisplay.logo && {
|
|
1129
|
-
logo: {
|
|
1130
|
-
...(credentialDisplay.logo.url || credentialDisplay.logo.uri) && {
|
|
1131
|
-
uri: credentialDisplay.logo?.url ?? credentialDisplay.logo.uri
|
|
1132
|
-
},
|
|
1133
|
-
...credentialDisplay.logo.alt_text && {
|
|
1134
|
-
alt: credentialDisplay.logo?.alt_text
|
|
1135
|
-
}
|
|
1136
|
-
}
|
|
1137
|
-
},
|
|
1138
|
-
...credentialDisplay.description && {
|
|
1139
|
-
description: credentialDisplay.description
|
|
1140
|
-
},
|
|
1141
|
-
...credentialDisplay.text_color && {
|
|
1142
|
-
text: {
|
|
1143
|
-
color: credentialDisplay.text_color
|
|
1144
|
-
}
|
|
1145
|
-
},
|
|
1146
|
-
...(credentialDisplay.background_image || credentialDisplay.background_color) && {
|
|
1147
|
-
background: {
|
|
1148
|
-
...credentialDisplay.background_image && {
|
|
1149
|
-
image: {
|
|
1150
|
-
...(credentialDisplay.background_image.url || credentialDisplay.background_image.uri) && {
|
|
1151
|
-
uri: credentialDisplay.background_image?.url ?? credentialDisplay.background_image.uri
|
|
1152
|
-
},
|
|
1153
|
-
...credentialDisplay.background_image.alt_text && {
|
|
1154
|
-
alt: credentialDisplay.background_image?.alt_text
|
|
1155
|
-
}
|
|
1156
|
-
}
|
|
1157
|
-
},
|
|
1158
|
-
...credentialDisplay.background_color && {
|
|
1159
|
-
color: credentialDisplay.background_color
|
|
1160
|
-
}
|
|
1161
|
-
}
|
|
1162
|
-
}
|
|
1163
|
-
};
|
|
1164
|
-
}, "oid4vciCredentialLocaleBrandingFrom");
|
|
1165
|
-
var oid4vciCombineDisplayLocalesFrom = /* @__PURE__ */ __name(async (args) => {
|
|
1166
|
-
const { credentialDisplayLocales = /* @__PURE__ */ new Map(), issuerCredentialSubjectLocales = /* @__PURE__ */ new Map() } = args;
|
|
1167
|
-
const locales = Array.from(/* @__PURE__ */ new Set([
|
|
1168
|
-
...issuerCredentialSubjectLocales.keys(),
|
|
1169
|
-
...credentialDisplayLocales.keys()
|
|
1170
|
-
]));
|
|
1171
|
-
return Promise.all(locales.map(async (locale) => {
|
|
1172
|
-
const display = credentialDisplayLocales.get(locale);
|
|
1173
|
-
const claims = issuerCredentialSubjectLocales.get(locale);
|
|
1174
|
-
return {
|
|
1175
|
-
...display && await oid4vciCredentialLocaleBrandingFrom({
|
|
1176
|
-
credentialDisplay: display
|
|
1177
|
-
}),
|
|
1178
|
-
...locale.length > 0 && {
|
|
1179
|
-
locale
|
|
1180
|
-
},
|
|
1181
|
-
claims
|
|
1182
|
-
};
|
|
1183
|
-
}));
|
|
1184
|
-
}, "oid4vciCombineDisplayLocalesFrom");
|
|
1185
|
-
var sdJwtGetCredentialBrandingFrom = /* @__PURE__ */ __name(async (args) => {
|
|
1186
|
-
const { credentialDisplay, claimsMetadata } = args;
|
|
1187
|
-
return sdJwtCombineDisplayLocalesFrom({
|
|
1188
|
-
...claimsMetadata && {
|
|
1189
|
-
claimsMetadata: await sdJwtCredentialClaimLocalesFrom({
|
|
1190
|
-
claimsMetadata
|
|
1191
|
-
})
|
|
1192
|
-
},
|
|
1193
|
-
...credentialDisplay && {
|
|
1194
|
-
credentialDisplayLocales: await sdJwtCredentialDisplayLocalesFrom({
|
|
1195
|
-
credentialDisplay
|
|
1196
|
-
})
|
|
1197
|
-
}
|
|
1198
|
-
});
|
|
1199
|
-
}, "sdJwtGetCredentialBrandingFrom");
|
|
1200
|
-
var sdJwtCredentialDisplayLocalesFrom = /* @__PURE__ */ __name(async (args) => {
|
|
1201
|
-
const { credentialDisplay } = args;
|
|
1202
|
-
return credentialDisplay.reduce((localeDisplays, display) => {
|
|
1203
|
-
const localeKey = display.lang || "";
|
|
1204
|
-
localeDisplays.set(localeKey, display);
|
|
1205
|
-
return localeDisplays;
|
|
1206
|
-
}, /* @__PURE__ */ new Map());
|
|
1207
|
-
}, "sdJwtCredentialDisplayLocalesFrom");
|
|
1208
|
-
var sdJwtCredentialClaimLocalesFrom = /* @__PURE__ */ __name(async (args) => {
|
|
1209
|
-
const { claimsMetadata } = args;
|
|
1210
|
-
const localeClaims = /* @__PURE__ */ new Map();
|
|
1211
|
-
claimsMetadata.forEach((claim) => {
|
|
1212
|
-
claim.display?.forEach((display) => {
|
|
1213
|
-
const { lang = "", label } = display;
|
|
1214
|
-
const key = claim.path.map((value) => String(value)).join(".");
|
|
1215
|
-
if (!localeClaims.has(lang)) {
|
|
1216
|
-
localeClaims.set(lang, []);
|
|
1217
|
-
}
|
|
1218
|
-
localeClaims.get(lang).push({
|
|
1219
|
-
key,
|
|
1220
|
-
name: label
|
|
1221
|
-
});
|
|
1222
|
-
});
|
|
1223
|
-
});
|
|
1224
|
-
return localeClaims;
|
|
1225
|
-
}, "sdJwtCredentialClaimLocalesFrom");
|
|
1226
|
-
var sdJwtCredentialLocaleBrandingFrom = /* @__PURE__ */ __name(async (args) => {
|
|
1227
|
-
const { credentialDisplay } = args;
|
|
1228
|
-
return {
|
|
1229
|
-
...credentialDisplay.name && {
|
|
1230
|
-
alias: credentialDisplay.name
|
|
1231
|
-
},
|
|
1232
|
-
...credentialDisplay.lang && {
|
|
1233
|
-
locale: credentialDisplay.lang
|
|
1234
|
-
},
|
|
1235
|
-
...credentialDisplay.rendering?.simple?.logo && {
|
|
1236
|
-
logo: {
|
|
1237
|
-
...credentialDisplay.rendering.simple.logo.uri && {
|
|
1238
|
-
uri: credentialDisplay.rendering.simple.logo.uri
|
|
1239
|
-
},
|
|
1240
|
-
...credentialDisplay.rendering.simple.logo.alt_text && {
|
|
1241
|
-
alt: credentialDisplay.rendering.simple.logo.alt_text
|
|
1242
|
-
}
|
|
1243
|
-
}
|
|
1244
|
-
},
|
|
1245
|
-
...credentialDisplay.description && {
|
|
1246
|
-
description: credentialDisplay.description
|
|
1247
|
-
},
|
|
1248
|
-
...credentialDisplay.rendering?.simple?.text_color && {
|
|
1249
|
-
text: {
|
|
1250
|
-
color: credentialDisplay.rendering.simple.text_color
|
|
1251
|
-
}
|
|
1252
|
-
},
|
|
1253
|
-
...credentialDisplay.rendering?.simple?.background_color && {
|
|
1254
|
-
background: {
|
|
1255
|
-
color: credentialDisplay.rendering.simple.background_color
|
|
1256
|
-
}
|
|
1257
|
-
}
|
|
1258
|
-
};
|
|
1259
|
-
}, "sdJwtCredentialLocaleBrandingFrom");
|
|
1260
|
-
var sdJwtCombineDisplayLocalesFrom = /* @__PURE__ */ __name(async (args) => {
|
|
1261
|
-
const { credentialDisplayLocales = /* @__PURE__ */ new Map(), claimsMetadata = /* @__PURE__ */ new Map() } = args;
|
|
1262
|
-
const locales = Array.from(/* @__PURE__ */ new Set([
|
|
1263
|
-
...claimsMetadata.keys(),
|
|
1264
|
-
...credentialDisplayLocales.keys()
|
|
1265
|
-
]));
|
|
1266
|
-
return Promise.all(locales.map(async (locale) => {
|
|
1267
|
-
const display = credentialDisplayLocales.get(locale);
|
|
1268
|
-
const claims = claimsMetadata.get(locale);
|
|
1269
|
-
return {
|
|
1270
|
-
...display && await sdJwtCredentialLocaleBrandingFrom({
|
|
1271
|
-
credentialDisplay: display
|
|
1272
|
-
}),
|
|
1273
|
-
...locale.length > 0 && {
|
|
1274
|
-
locale
|
|
1275
|
-
},
|
|
1276
|
-
claims
|
|
1277
|
-
};
|
|
1278
|
-
}));
|
|
1279
|
-
}, "sdJwtCombineDisplayLocalesFrom");
|
|
1280
|
-
var issuerLocaleBrandingFrom = /* @__PURE__ */ __name(async (args) => {
|
|
1281
|
-
const { issuerDisplay, dynamicRegistrationClientMetadata } = args;
|
|
1282
|
-
return {
|
|
1283
|
-
...dynamicRegistrationClientMetadata?.client_name && {
|
|
1284
|
-
alias: dynamicRegistrationClientMetadata.client_name
|
|
1285
|
-
},
|
|
1286
|
-
...issuerDisplay.name && {
|
|
1287
|
-
alias: issuerDisplay.name
|
|
1288
|
-
},
|
|
1289
|
-
...issuerDisplay.locale && {
|
|
1290
|
-
locale: issuerDisplay.locale
|
|
1291
|
-
},
|
|
1292
|
-
...(issuerDisplay.logo || dynamicRegistrationClientMetadata?.logo_uri) && {
|
|
1293
|
-
logo: {
|
|
1294
|
-
...dynamicRegistrationClientMetadata?.logo_uri && {
|
|
1295
|
-
uri: dynamicRegistrationClientMetadata?.logo_uri
|
|
1296
|
-
},
|
|
1297
|
-
...(issuerDisplay.logo?.url || issuerDisplay.logo?.uri) && {
|
|
1298
|
-
uri: issuerDisplay.logo?.url ?? issuerDisplay.logo?.uri
|
|
1299
|
-
},
|
|
1300
|
-
...issuerDisplay.logo?.alt_text && {
|
|
1301
|
-
alt: issuerDisplay.logo?.alt_text
|
|
1302
|
-
}
|
|
1303
|
-
}
|
|
1304
|
-
},
|
|
1305
|
-
...issuerDisplay.description && {
|
|
1306
|
-
description: issuerDisplay.description
|
|
1307
|
-
},
|
|
1308
|
-
...issuerDisplay.text_color && {
|
|
1309
|
-
text: {
|
|
1310
|
-
color: issuerDisplay.text_color
|
|
1311
|
-
}
|
|
1312
|
-
},
|
|
1313
|
-
...dynamicRegistrationClientMetadata?.client_uri && {
|
|
1314
|
-
clientUri: dynamicRegistrationClientMetadata.client_uri
|
|
1315
|
-
},
|
|
1316
|
-
...dynamicRegistrationClientMetadata?.tos_uri && {
|
|
1317
|
-
tosUri: dynamicRegistrationClientMetadata.tos_uri
|
|
1318
|
-
},
|
|
1319
|
-
...dynamicRegistrationClientMetadata?.policy_uri && {
|
|
1320
|
-
policyUri: dynamicRegistrationClientMetadata.policy_uri
|
|
1321
|
-
},
|
|
1322
|
-
...dynamicRegistrationClientMetadata?.contacts && {
|
|
1323
|
-
contacts: dynamicRegistrationClientMetadata.contacts
|
|
1324
|
-
}
|
|
1325
|
-
};
|
|
1326
|
-
}, "issuerLocaleBrandingFrom");
|
|
1327
|
-
|
|
1328
1072
|
// src/machines/firstPartyMachine.ts
|
|
1329
1073
|
var import_xstate2 = require("xstate");
|
|
1330
1074
|
var import_oid4vci_common2 = require("@sphereon/oid4vci-common");
|
|
@@ -1528,96 +1272,357 @@ var createFirstPartyActivationMachine = /* @__PURE__ */ __name((opts) => {
|
|
|
1528
1272
|
contact: opts.contact,
|
|
1529
1273
|
selectedCredentials: []
|
|
1530
1274
|
};
|
|
1531
|
-
return (0, import_xstate2.createMachine)({
|
|
1532
|
-
id: opts?.machineId ?? "FirstParty",
|
|
1533
|
-
predictableActionArguments: true,
|
|
1534
|
-
initial: FirstPartyMachineStateTypes.sendAuthorizationChallengeRequest,
|
|
1535
|
-
context: initialContext,
|
|
1536
|
-
states: firstPartyMachineStates,
|
|
1537
|
-
schema: {
|
|
1538
|
-
events: {},
|
|
1539
|
-
services: {}
|
|
1275
|
+
return (0, import_xstate2.createMachine)({
|
|
1276
|
+
id: opts?.machineId ?? "FirstParty",
|
|
1277
|
+
predictableActionArguments: true,
|
|
1278
|
+
initial: FirstPartyMachineStateTypes.sendAuthorizationChallengeRequest,
|
|
1279
|
+
context: initialContext,
|
|
1280
|
+
states: firstPartyMachineStates,
|
|
1281
|
+
schema: {
|
|
1282
|
+
events: {},
|
|
1283
|
+
services: {}
|
|
1284
|
+
}
|
|
1285
|
+
});
|
|
1286
|
+
}, "createFirstPartyActivationMachine");
|
|
1287
|
+
var FirstPartyMachine = class _FirstPartyMachine {
|
|
1288
|
+
static {
|
|
1289
|
+
__name(this, "FirstPartyMachine");
|
|
1290
|
+
}
|
|
1291
|
+
static _instance;
|
|
1292
|
+
static hasInstance() {
|
|
1293
|
+
return _FirstPartyMachine._instance !== void 0;
|
|
1294
|
+
}
|
|
1295
|
+
static get instance() {
|
|
1296
|
+
if (!_FirstPartyMachine._instance) {
|
|
1297
|
+
throw Error("Please initialize ESIMActivation machine first");
|
|
1298
|
+
}
|
|
1299
|
+
return _FirstPartyMachine._instance;
|
|
1300
|
+
}
|
|
1301
|
+
static clearInstance(opts) {
|
|
1302
|
+
const { stop } = opts;
|
|
1303
|
+
if (_FirstPartyMachine.hasInstance()) {
|
|
1304
|
+
if (stop) {
|
|
1305
|
+
_FirstPartyMachine.stopInstance();
|
|
1306
|
+
}
|
|
1307
|
+
}
|
|
1308
|
+
_FirstPartyMachine._instance = void 0;
|
|
1309
|
+
}
|
|
1310
|
+
static stopInstance() {
|
|
1311
|
+
if (!_FirstPartyMachine.hasInstance()) {
|
|
1312
|
+
return;
|
|
1313
|
+
}
|
|
1314
|
+
_FirstPartyMachine.instance.stop();
|
|
1315
|
+
_FirstPartyMachine._instance = void 0;
|
|
1316
|
+
}
|
|
1317
|
+
static newInstance(opts) {
|
|
1318
|
+
const { agentContext } = opts;
|
|
1319
|
+
const services = {
|
|
1320
|
+
[FirstPartyMachineServices.sendAuthorizationChallengeRequest]: sendAuthorizationChallengeRequest,
|
|
1321
|
+
[FirstPartyMachineServices.createConfig]: (args) => createConfig(args, agentContext),
|
|
1322
|
+
[FirstPartyMachineServices.getSiopRequest]: (args) => getSiopRequest(args, agentContext),
|
|
1323
|
+
[FirstPartyMachineServices.sendAuthorizationResponse]: (args) => sendAuthorizationResponse(args, agentContext)
|
|
1324
|
+
};
|
|
1325
|
+
const newInst = (0, import_xstate2.interpret)(createFirstPartyActivationMachine(opts).withConfig({
|
|
1326
|
+
services: {
|
|
1327
|
+
...services,
|
|
1328
|
+
...opts?.services
|
|
1329
|
+
},
|
|
1330
|
+
guards: {
|
|
1331
|
+
...opts?.guards
|
|
1332
|
+
}
|
|
1333
|
+
}));
|
|
1334
|
+
if (typeof opts?.subscription === "function") {
|
|
1335
|
+
newInst.onTransition(opts.subscription);
|
|
1336
|
+
}
|
|
1337
|
+
if (opts?.requireCustomNavigationHook !== true) {
|
|
1338
|
+
newInst.onTransition((snapshot) => {
|
|
1339
|
+
if (opts?.stateNavigationListener) {
|
|
1340
|
+
void opts.stateNavigationListener(newInst, snapshot);
|
|
1341
|
+
}
|
|
1342
|
+
});
|
|
1343
|
+
}
|
|
1344
|
+
return newInst;
|
|
1345
|
+
}
|
|
1346
|
+
static getInstance(opts) {
|
|
1347
|
+
if (!_FirstPartyMachine._instance) {
|
|
1348
|
+
if (opts?.requireExisting === true) {
|
|
1349
|
+
throw Error(`Existing FirstPartyMachine instance requested, but none was created at this point!`);
|
|
1350
|
+
}
|
|
1351
|
+
_FirstPartyMachine._instance = _FirstPartyMachine.newInstance(opts);
|
|
1352
|
+
}
|
|
1353
|
+
return _FirstPartyMachine._instance;
|
|
1354
|
+
}
|
|
1355
|
+
};
|
|
1356
|
+
|
|
1357
|
+
// src/mappers/OIDC4VCIBrandingMapper.ts
|
|
1358
|
+
var oid4vciGetCredentialBrandingFrom = /* @__PURE__ */ __name(async (args) => {
|
|
1359
|
+
const { credentialDisplay, issuerCredentialSubject } = args;
|
|
1360
|
+
return oid4vciCombineDisplayLocalesFrom({
|
|
1361
|
+
...issuerCredentialSubject && {
|
|
1362
|
+
issuerCredentialSubjectLocales: await oid4vciIssuerCredentialSubjectLocalesFrom({
|
|
1363
|
+
issuerCredentialSubject
|
|
1364
|
+
})
|
|
1365
|
+
},
|
|
1366
|
+
...credentialDisplay && {
|
|
1367
|
+
credentialDisplayLocales: await oid4vciCredentialDisplayLocalesFrom({
|
|
1368
|
+
credentialDisplay
|
|
1369
|
+
})
|
|
1370
|
+
}
|
|
1371
|
+
});
|
|
1372
|
+
}, "oid4vciGetCredentialBrandingFrom");
|
|
1373
|
+
var oid4vciCredentialDisplayLocalesFrom = /* @__PURE__ */ __name(async (args) => {
|
|
1374
|
+
const { credentialDisplay } = args;
|
|
1375
|
+
return credentialDisplay.reduce((localeDisplays, display) => {
|
|
1376
|
+
const localeKey = display.locale || "";
|
|
1377
|
+
localeDisplays.set(localeKey, display);
|
|
1378
|
+
return localeDisplays;
|
|
1379
|
+
}, /* @__PURE__ */ new Map());
|
|
1380
|
+
}, "oid4vciCredentialDisplayLocalesFrom");
|
|
1381
|
+
var oid4vciIssuerCredentialSubjectLocalesFrom = /* @__PURE__ */ __name(async (args) => {
|
|
1382
|
+
const { issuerCredentialSubject } = args;
|
|
1383
|
+
const localeClaims = /* @__PURE__ */ new Map();
|
|
1384
|
+
const processClaimObject = /* @__PURE__ */ __name((claim, parentKey = "") => {
|
|
1385
|
+
Object.entries(claim).forEach(([key, value]) => {
|
|
1386
|
+
if (key === "mandatory" || key === "value_type") {
|
|
1387
|
+
return;
|
|
1388
|
+
}
|
|
1389
|
+
if (key === "display" && Array.isArray(value)) {
|
|
1390
|
+
value.forEach(({ name, locale = "" }) => {
|
|
1391
|
+
if (!name) {
|
|
1392
|
+
return;
|
|
1393
|
+
}
|
|
1394
|
+
if (!localeClaims.has(locale)) {
|
|
1395
|
+
localeClaims.set(locale, []);
|
|
1396
|
+
}
|
|
1397
|
+
localeClaims.get(locale).push({
|
|
1398
|
+
key: parentKey,
|
|
1399
|
+
name
|
|
1400
|
+
});
|
|
1401
|
+
});
|
|
1402
|
+
} else if (typeof value === "object" && value !== null) {
|
|
1403
|
+
processClaimObject(value, parentKey ? `${parentKey}.${key}` : key);
|
|
1404
|
+
}
|
|
1405
|
+
});
|
|
1406
|
+
}, "processClaimObject");
|
|
1407
|
+
processClaimObject(issuerCredentialSubject);
|
|
1408
|
+
return localeClaims;
|
|
1409
|
+
}, "oid4vciIssuerCredentialSubjectLocalesFrom");
|
|
1410
|
+
var oid4vciCredentialLocaleBrandingFrom = /* @__PURE__ */ __name(async (args) => {
|
|
1411
|
+
const { credentialDisplay } = args;
|
|
1412
|
+
return {
|
|
1413
|
+
...credentialDisplay.name && {
|
|
1414
|
+
alias: credentialDisplay.name
|
|
1415
|
+
},
|
|
1416
|
+
...credentialDisplay.locale && {
|
|
1417
|
+
locale: credentialDisplay.locale
|
|
1418
|
+
},
|
|
1419
|
+
...credentialDisplay.logo && {
|
|
1420
|
+
logo: {
|
|
1421
|
+
...(credentialDisplay.logo.url || credentialDisplay.logo.uri) && {
|
|
1422
|
+
uri: credentialDisplay.logo?.url ?? credentialDisplay.logo.uri
|
|
1423
|
+
},
|
|
1424
|
+
...credentialDisplay.logo.alt_text && {
|
|
1425
|
+
alt: credentialDisplay.logo?.alt_text
|
|
1426
|
+
}
|
|
1427
|
+
}
|
|
1428
|
+
},
|
|
1429
|
+
...credentialDisplay.description && {
|
|
1430
|
+
description: credentialDisplay.description
|
|
1431
|
+
},
|
|
1432
|
+
...credentialDisplay.text_color && {
|
|
1433
|
+
text: {
|
|
1434
|
+
color: credentialDisplay.text_color
|
|
1435
|
+
}
|
|
1436
|
+
},
|
|
1437
|
+
...(credentialDisplay.background_image || credentialDisplay.background_color) && {
|
|
1438
|
+
background: {
|
|
1439
|
+
...credentialDisplay.background_image && {
|
|
1440
|
+
image: {
|
|
1441
|
+
...(credentialDisplay.background_image.url || credentialDisplay.background_image.uri) && {
|
|
1442
|
+
uri: credentialDisplay.background_image?.url ?? credentialDisplay.background_image.uri
|
|
1443
|
+
},
|
|
1444
|
+
...credentialDisplay.background_image.alt_text && {
|
|
1445
|
+
alt: credentialDisplay.background_image?.alt_text
|
|
1446
|
+
}
|
|
1447
|
+
}
|
|
1448
|
+
},
|
|
1449
|
+
...credentialDisplay.background_color && {
|
|
1450
|
+
color: credentialDisplay.background_color
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1454
|
+
};
|
|
1455
|
+
}, "oid4vciCredentialLocaleBrandingFrom");
|
|
1456
|
+
var oid4vciCombineDisplayLocalesFrom = /* @__PURE__ */ __name(async (args) => {
|
|
1457
|
+
const { credentialDisplayLocales = /* @__PURE__ */ new Map(), issuerCredentialSubjectLocales = /* @__PURE__ */ new Map() } = args;
|
|
1458
|
+
const locales = Array.from(/* @__PURE__ */ new Set([
|
|
1459
|
+
...issuerCredentialSubjectLocales.keys(),
|
|
1460
|
+
...credentialDisplayLocales.keys()
|
|
1461
|
+
]));
|
|
1462
|
+
return Promise.all(locales.map(async (locale) => {
|
|
1463
|
+
const display = credentialDisplayLocales.get(locale);
|
|
1464
|
+
const claims = issuerCredentialSubjectLocales.get(locale);
|
|
1465
|
+
return {
|
|
1466
|
+
...display && await oid4vciCredentialLocaleBrandingFrom({
|
|
1467
|
+
credentialDisplay: display
|
|
1468
|
+
}),
|
|
1469
|
+
...locale.length > 0 && {
|
|
1470
|
+
locale
|
|
1471
|
+
},
|
|
1472
|
+
claims
|
|
1473
|
+
};
|
|
1474
|
+
}));
|
|
1475
|
+
}, "oid4vciCombineDisplayLocalesFrom");
|
|
1476
|
+
var sdJwtGetCredentialBrandingFrom = /* @__PURE__ */ __name(async (args) => {
|
|
1477
|
+
const { credentialDisplay, claimsMetadata } = args;
|
|
1478
|
+
return sdJwtCombineDisplayLocalesFrom({
|
|
1479
|
+
...claimsMetadata && {
|
|
1480
|
+
claimsMetadata: await sdJwtCredentialClaimLocalesFrom({
|
|
1481
|
+
claimsMetadata
|
|
1482
|
+
})
|
|
1483
|
+
},
|
|
1484
|
+
...credentialDisplay && {
|
|
1485
|
+
credentialDisplayLocales: await sdJwtCredentialDisplayLocalesFrom({
|
|
1486
|
+
credentialDisplay
|
|
1487
|
+
})
|
|
1540
1488
|
}
|
|
1541
1489
|
});
|
|
1542
|
-
}, "
|
|
1543
|
-
var
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
if (stop) {
|
|
1561
|
-
_FirstPartyMachine.stopInstance();
|
|
1490
|
+
}, "sdJwtGetCredentialBrandingFrom");
|
|
1491
|
+
var sdJwtCredentialDisplayLocalesFrom = /* @__PURE__ */ __name(async (args) => {
|
|
1492
|
+
const { credentialDisplay } = args;
|
|
1493
|
+
return credentialDisplay.reduce((localeDisplays, display) => {
|
|
1494
|
+
const localeKey = display.lang || "";
|
|
1495
|
+
localeDisplays.set(localeKey, display);
|
|
1496
|
+
return localeDisplays;
|
|
1497
|
+
}, /* @__PURE__ */ new Map());
|
|
1498
|
+
}, "sdJwtCredentialDisplayLocalesFrom");
|
|
1499
|
+
var sdJwtCredentialClaimLocalesFrom = /* @__PURE__ */ __name(async (args) => {
|
|
1500
|
+
const { claimsMetadata } = args;
|
|
1501
|
+
const localeClaims = /* @__PURE__ */ new Map();
|
|
1502
|
+
claimsMetadata.forEach((claim) => {
|
|
1503
|
+
claim.display?.forEach((display) => {
|
|
1504
|
+
const { lang = "", label } = display;
|
|
1505
|
+
const key = claim.path.map((value) => String(value)).join(".");
|
|
1506
|
+
if (!localeClaims.has(lang)) {
|
|
1507
|
+
localeClaims.set(lang, []);
|
|
1562
1508
|
}
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
}
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1509
|
+
localeClaims.get(lang).push({
|
|
1510
|
+
key,
|
|
1511
|
+
name: label
|
|
1512
|
+
});
|
|
1513
|
+
});
|
|
1514
|
+
});
|
|
1515
|
+
return localeClaims;
|
|
1516
|
+
}, "sdJwtCredentialClaimLocalesFrom");
|
|
1517
|
+
var sdJwtCredentialLocaleBrandingFrom = /* @__PURE__ */ __name(async (args) => {
|
|
1518
|
+
const { credentialDisplay } = args;
|
|
1519
|
+
return {
|
|
1520
|
+
...credentialDisplay.name && {
|
|
1521
|
+
alias: credentialDisplay.name
|
|
1522
|
+
},
|
|
1523
|
+
...credentialDisplay.lang && {
|
|
1524
|
+
locale: credentialDisplay.lang
|
|
1525
|
+
},
|
|
1526
|
+
...credentialDisplay.rendering?.simple?.logo && {
|
|
1527
|
+
logo: {
|
|
1528
|
+
...credentialDisplay.rendering.simple.logo.uri && {
|
|
1529
|
+
uri: credentialDisplay.rendering.simple.logo.uri
|
|
1530
|
+
},
|
|
1531
|
+
...credentialDisplay.rendering.simple.logo.alt_text && {
|
|
1532
|
+
alt: credentialDisplay.rendering.simple.logo.alt_text
|
|
1533
|
+
}
|
|
1534
|
+
}
|
|
1535
|
+
},
|
|
1536
|
+
...credentialDisplay.description && {
|
|
1537
|
+
description: credentialDisplay.description
|
|
1538
|
+
},
|
|
1539
|
+
...credentialDisplay.rendering?.simple?.text_color && {
|
|
1540
|
+
text: {
|
|
1541
|
+
color: credentialDisplay.rendering.simple.text_color
|
|
1542
|
+
}
|
|
1543
|
+
},
|
|
1544
|
+
...credentialDisplay.rendering?.simple?.background_color && {
|
|
1545
|
+
background: {
|
|
1546
|
+
color: credentialDisplay.rendering.simple.background_color
|
|
1588
1547
|
}
|
|
1589
|
-
}));
|
|
1590
|
-
if (typeof opts?.subscription === "function") {
|
|
1591
|
-
newInst.onTransition(opts.subscription);
|
|
1592
1548
|
}
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1549
|
+
};
|
|
1550
|
+
}, "sdJwtCredentialLocaleBrandingFrom");
|
|
1551
|
+
var sdJwtCombineDisplayLocalesFrom = /* @__PURE__ */ __name(async (args) => {
|
|
1552
|
+
const { credentialDisplayLocales = /* @__PURE__ */ new Map(), claimsMetadata = /* @__PURE__ */ new Map() } = args;
|
|
1553
|
+
const locales = Array.from(/* @__PURE__ */ new Set([
|
|
1554
|
+
...claimsMetadata.keys(),
|
|
1555
|
+
...credentialDisplayLocales.keys()
|
|
1556
|
+
]));
|
|
1557
|
+
return Promise.all(locales.map(async (locale) => {
|
|
1558
|
+
const display = credentialDisplayLocales.get(locale);
|
|
1559
|
+
const claims = claimsMetadata.get(locale);
|
|
1560
|
+
return {
|
|
1561
|
+
...display && await sdJwtCredentialLocaleBrandingFrom({
|
|
1562
|
+
credentialDisplay: display
|
|
1563
|
+
}),
|
|
1564
|
+
...locale.length > 0 && {
|
|
1565
|
+
locale
|
|
1566
|
+
},
|
|
1567
|
+
claims
|
|
1568
|
+
};
|
|
1569
|
+
}));
|
|
1570
|
+
}, "sdJwtCombineDisplayLocalesFrom");
|
|
1571
|
+
var issuerLocaleBrandingFrom = /* @__PURE__ */ __name(async (args) => {
|
|
1572
|
+
const { issuerDisplay, dynamicRegistrationClientMetadata } = args;
|
|
1573
|
+
return {
|
|
1574
|
+
...dynamicRegistrationClientMetadata?.client_name && {
|
|
1575
|
+
alias: dynamicRegistrationClientMetadata.client_name
|
|
1576
|
+
},
|
|
1577
|
+
...issuerDisplay.name && {
|
|
1578
|
+
alias: issuerDisplay.name
|
|
1579
|
+
},
|
|
1580
|
+
...issuerDisplay.locale && {
|
|
1581
|
+
locale: issuerDisplay.locale
|
|
1582
|
+
},
|
|
1583
|
+
...(issuerDisplay.logo || dynamicRegistrationClientMetadata?.logo_uri) && {
|
|
1584
|
+
logo: {
|
|
1585
|
+
...dynamicRegistrationClientMetadata?.logo_uri && {
|
|
1586
|
+
uri: dynamicRegistrationClientMetadata?.logo_uri
|
|
1587
|
+
},
|
|
1588
|
+
...(issuerDisplay.logo?.url || issuerDisplay.logo?.uri) && {
|
|
1589
|
+
uri: issuerDisplay.logo?.url ?? issuerDisplay.logo?.uri
|
|
1590
|
+
},
|
|
1591
|
+
...issuerDisplay.logo?.alt_text && {
|
|
1592
|
+
alt: issuerDisplay.logo?.alt_text
|
|
1597
1593
|
}
|
|
1598
|
-
});
|
|
1599
|
-
}
|
|
1600
|
-
return newInst;
|
|
1601
|
-
}
|
|
1602
|
-
static getInstance(opts) {
|
|
1603
|
-
if (!_FirstPartyMachine._instance) {
|
|
1604
|
-
if (opts?.requireExisting === true) {
|
|
1605
|
-
throw Error(`Existing FirstPartyMachine instance requested, but none was created at this point!`);
|
|
1606
1594
|
}
|
|
1607
|
-
|
|
1595
|
+
},
|
|
1596
|
+
...issuerDisplay.description && {
|
|
1597
|
+
description: issuerDisplay.description
|
|
1598
|
+
},
|
|
1599
|
+
...issuerDisplay.text_color && {
|
|
1600
|
+
text: {
|
|
1601
|
+
color: issuerDisplay.text_color
|
|
1602
|
+
}
|
|
1603
|
+
},
|
|
1604
|
+
...dynamicRegistrationClientMetadata?.client_uri && {
|
|
1605
|
+
clientUri: dynamicRegistrationClientMetadata.client_uri
|
|
1606
|
+
},
|
|
1607
|
+
...dynamicRegistrationClientMetadata?.tos_uri && {
|
|
1608
|
+
tosUri: dynamicRegistrationClientMetadata.tos_uri
|
|
1609
|
+
},
|
|
1610
|
+
...dynamicRegistrationClientMetadata?.policy_uri && {
|
|
1611
|
+
policyUri: dynamicRegistrationClientMetadata.policy_uri
|
|
1612
|
+
},
|
|
1613
|
+
...dynamicRegistrationClientMetadata?.contacts && {
|
|
1614
|
+
contacts: dynamicRegistrationClientMetadata.contacts
|
|
1608
1615
|
}
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
};
|
|
1616
|
+
};
|
|
1617
|
+
}, "issuerLocaleBrandingFrom");
|
|
1612
1618
|
|
|
1613
1619
|
// src/services/OID4VCIHolderService.ts
|
|
1614
|
-
var import_ssi_sdk = require("@sphereon/ssi-sdk.core");
|
|
1615
1620
|
var getCredentialBranding = /* @__PURE__ */ __name(async (args) => {
|
|
1616
1621
|
const { credentialsSupported, context } = args;
|
|
1617
1622
|
const credentialBranding = {};
|
|
1618
1623
|
await Promise.all(Object.entries(credentialsSupported).map(async ([configId, credentialsConfigSupported]) => {
|
|
1619
1624
|
let sdJwtTypeMetadata;
|
|
1620
|
-
if (credentialsConfigSupported.format === "
|
|
1625
|
+
if (credentialsConfigSupported.format === "dc+sd-jwt") {
|
|
1621
1626
|
const vct = credentialsConfigSupported.vct;
|
|
1622
1627
|
if (vct.startsWith("http")) {
|
|
1623
1628
|
try {
|
|
@@ -1683,10 +1688,7 @@ var selectCredentialLocaleBranding = /* @__PURE__ */ __name(async (args) => {
|
|
|
1683
1688
|
}, "selectCredentialLocaleBranding");
|
|
1684
1689
|
var verifyCredentialToAccept = /* @__PURE__ */ __name(async (args) => {
|
|
1685
1690
|
const { mappedCredential, hasher, onVerifyEBSICredentialIssuer, schemaValidation, context } = args;
|
|
1686
|
-
const credential = mappedCredential.credentialToAccept.credentialResponse
|
|
1687
|
-
if (!credential) {
|
|
1688
|
-
return Promise.reject(Error("No credential found in credential response"));
|
|
1689
|
-
}
|
|
1691
|
+
const credential = extractCredentialFromResponse(mappedCredential.credentialToAccept.credentialResponse);
|
|
1690
1692
|
const wrappedVC = import_ssi_types.CredentialMapper.toWrappedVerifiableCredential(credential, {
|
|
1691
1693
|
hasher: hasher ?? import_ssi_sdk.defaultHasher
|
|
1692
1694
|
});
|
|
@@ -1738,11 +1740,7 @@ var verifyCredentialToAccept = /* @__PURE__ */ __name(async (args) => {
|
|
|
1738
1740
|
}, "verifyCredentialToAccept");
|
|
1739
1741
|
var mapCredentialToAccept = /* @__PURE__ */ __name(async (args) => {
|
|
1740
1742
|
const { credentialToAccept, hasher } = args;
|
|
1741
|
-
const
|
|
1742
|
-
const verifiableCredential = credentialResponse.credential;
|
|
1743
|
-
if (!verifiableCredential) {
|
|
1744
|
-
return Promise.reject(Error("No credential found in credential response"));
|
|
1745
|
-
}
|
|
1743
|
+
const verifiableCredential = extractCredentialFromResponse(credentialToAccept.credentialResponse);
|
|
1746
1744
|
const wrappedVerifiableCredential = import_ssi_types.CredentialMapper.toWrappedVerifiableCredential(verifiableCredential, {
|
|
1747
1745
|
hasher
|
|
1748
1746
|
});
|
|
@@ -1762,6 +1760,7 @@ var mapCredentialToAccept = /* @__PURE__ */ __name(async (args) => {
|
|
|
1762
1760
|
uniformVerifiableCredential = wrappedVerifiableCredential.credential;
|
|
1763
1761
|
}
|
|
1764
1762
|
const correlationId = typeof uniformVerifiableCredential.issuer === "string" ? uniformVerifiableCredential.issuer : import_ssi_types.CredentialMapper.isSdJwtDecodedCredential(uniformVerifiableCredential) ? uniformVerifiableCredential.decodedPayload.iss : uniformVerifiableCredential.issuer.id;
|
|
1763
|
+
const credentialResponse = credentialToAccept.credentialResponse;
|
|
1765
1764
|
return {
|
|
1766
1765
|
correlationId,
|
|
1767
1766
|
credentialToAccept,
|
|
@@ -1773,6 +1772,18 @@ var mapCredentialToAccept = /* @__PURE__ */ __name(async (args) => {
|
|
|
1773
1772
|
}
|
|
1774
1773
|
};
|
|
1775
1774
|
}, "mapCredentialToAccept");
|
|
1775
|
+
var extractCredentialFromResponse = /* @__PURE__ */ __name((credentialResponse) => {
|
|
1776
|
+
let credential;
|
|
1777
|
+
if ("credential" in credentialResponse) {
|
|
1778
|
+
credential = credentialResponse.credential;
|
|
1779
|
+
} else if ("credentials" in credentialResponse && credentialResponse.credentials && Array.isArray(credentialResponse.credentials) && credentialResponse.credentials.length > 0) {
|
|
1780
|
+
credential = credentialResponse.credentials[0].credential;
|
|
1781
|
+
}
|
|
1782
|
+
if (!credential) {
|
|
1783
|
+
throw new Error("No credential found in credential response");
|
|
1784
|
+
}
|
|
1785
|
+
return credential;
|
|
1786
|
+
}, "extractCredentialFromResponse");
|
|
1776
1787
|
var getIdentifierOpts = /* @__PURE__ */ __name(async (args) => {
|
|
1777
1788
|
const { issuanceOpt, context } = args;
|
|
1778
1789
|
const { identifier: identifierArg } = issuanceOpt;
|
|
@@ -1881,24 +1892,19 @@ var getCredentialConfigsSupportedBySingleTypeOrId = /* @__PURE__ */ __name(async
|
|
|
1881
1892
|
}
|
|
1882
1893
|
__name(createIdFromTypes, "createIdFromTypes");
|
|
1883
1894
|
if (configurationId) {
|
|
1884
|
-
const allSupported2 = client.getCredentialsSupported(
|
|
1895
|
+
const allSupported2 = client.getCredentialsSupported(format);
|
|
1885
1896
|
return Object.fromEntries(Object.entries(allSupported2).filter(([id, supported]) => id === configurationId || supported.id === configurationId || createIdFromTypes(supported) === configurationId));
|
|
1886
1897
|
}
|
|
1887
|
-
if (!
|
|
1888
|
-
return Promise.reject(Error("openID4VCIClient has no credentialOffer
|
|
1898
|
+
if (!client.credentialOffer) {
|
|
1899
|
+
return Promise.reject(Error("openID4VCIClient has no credentialOffer"));
|
|
1889
1900
|
}
|
|
1890
|
-
if (!
|
|
1891
|
-
|
|
1892
|
-
format = client.credentialOffer.credential_offer.credentials.filter((cred) => typeof cred !== "string").map((cred) => cred.format);
|
|
1893
|
-
if (format?.length === 0) {
|
|
1894
|
-
format = void 0;
|
|
1895
|
-
}
|
|
1896
|
-
}
|
|
1901
|
+
if (!types) {
|
|
1902
|
+
return Promise.reject(Error("openID4VCIClient has no types"));
|
|
1897
1903
|
}
|
|
1898
1904
|
const offerSupported = (0, import_oid4vci_common3.getSupportedCredentials)({
|
|
1899
|
-
types:
|
|
1905
|
+
types: [
|
|
1900
1906
|
types
|
|
1901
|
-
]
|
|
1907
|
+
],
|
|
1902
1908
|
format,
|
|
1903
1909
|
version: client.version(),
|
|
1904
1910
|
issuerMetadata: client.endpointMetadata.credentialIssuerMetadata
|
|
@@ -2073,7 +2079,8 @@ var getIssuanceCryptoSuite = /* @__PURE__ */ __name(async (opts) => {
|
|
|
2073
2079
|
case "jwt":
|
|
2074
2080
|
case "jwt_vc_json":
|
|
2075
2081
|
case "jwt_vc":
|
|
2076
|
-
case
|
|
2082
|
+
//case 'vc+sd-jwt': // TODO see SSISDK-52 concerning vc+sd-jwt
|
|
2083
|
+
case "dc+sd-jwt":
|
|
2077
2084
|
case "mso_mdoc": {
|
|
2078
2085
|
const supportedPreferences = jwtCryptographicSuitePreferences.filter((suite) => signing_algs_supported.includes(suite));
|
|
2079
2086
|
if (supportedPreferences.length > 0) {
|
|
@@ -2141,8 +2148,6 @@ var startFirstPartApplicationMachine = /* @__PURE__ */ __name(async (args, conte
|
|
|
2141
2148
|
}, "startFirstPartApplicationMachine");
|
|
2142
2149
|
|
|
2143
2150
|
// src/agent/OID4VCIHolder.ts
|
|
2144
|
-
var import_polyfill = require("cross-fetch/polyfill");
|
|
2145
|
-
var import_ssi_sdk3 = require("@sphereon/ssi-sdk.core");
|
|
2146
2151
|
var oid4vciHolderContextMethods = [
|
|
2147
2152
|
"cmGetContacts",
|
|
2148
2153
|
"cmGetContact",
|
|
@@ -2158,7 +2163,7 @@ var oid4vciHolderContextMethods = [
|
|
|
2158
2163
|
];
|
|
2159
2164
|
var logger = import_ssi_types2.Loggers.DEFAULT.get("sphereon:oid4vci:holder");
|
|
2160
2165
|
function signCallback(identifier, context, nonce) {
|
|
2161
|
-
return async (jwt, kid) => {
|
|
2166
|
+
return async (jwt, kid, noIssPayloadUpdate) => {
|
|
2162
2167
|
let resolution = await context.agent.identifierManagedGet(identifier);
|
|
2163
2168
|
const jwk = jwt.header.jwk ?? (resolution.method === "jwk" ? resolution.jwk : void 0);
|
|
2164
2169
|
if (!resolution.issuer && !jwt.payload.iss) {
|
|
@@ -2176,7 +2181,7 @@ function signCallback(identifier, context, nonce) {
|
|
|
2176
2181
|
return (await context.agent.jwtCreateJwsCompactSignature({
|
|
2177
2182
|
issuer: {
|
|
2178
2183
|
...resolution,
|
|
2179
|
-
noIssPayloadUpdate: false
|
|
2184
|
+
noIssPayloadUpdate: noIssPayloadUpdate ?? false
|
|
2180
2185
|
},
|
|
2181
2186
|
protectedHeader: header,
|
|
2182
2187
|
payload
|
|
@@ -2211,6 +2216,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2211
2216
|
oid4vciHolderStoreIssuerBranding: this.oid4vciHolderStoreIssuerBranding.bind(this)
|
|
2212
2217
|
};
|
|
2213
2218
|
vcFormatPreferences = [
|
|
2219
|
+
"dc+sd-jwt",
|
|
2214
2220
|
"vc+sd-jwt",
|
|
2215
2221
|
"mso_mdoc",
|
|
2216
2222
|
"jwt_vc_json",
|
|
@@ -2244,7 +2250,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2244
2250
|
onIdentifierCreated;
|
|
2245
2251
|
onVerifyEBSICredentialIssuer;
|
|
2246
2252
|
constructor(options) {
|
|
2247
|
-
const { onContactIdentityCreated, onCredentialStored, onIdentifierCreated, onVerifyEBSICredentialIssuer, vcFormatPreferences, jsonldCryptographicSuitePreferences, didMethodPreferences, jwtCryptographicSuitePreferences, defaultAuthorizationRequestOptions, hasher =
|
|
2253
|
+
const { onContactIdentityCreated, onCredentialStored, onIdentifierCreated, onVerifyEBSICredentialIssuer, vcFormatPreferences, jsonldCryptographicSuitePreferences, didMethodPreferences, jwtCryptographicSuitePreferences, defaultAuthorizationRequestOptions, hasher = import_ssi_sdk2.defaultHasher } = {
|
|
2248
2254
|
...options
|
|
2249
2255
|
};
|
|
2250
2256
|
this.hasher = hasher;
|
|
@@ -2362,7 +2368,6 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2362
2368
|
formats = Array.from(new Set(authFormats));
|
|
2363
2369
|
}
|
|
2364
2370
|
let oid4vciClient;
|
|
2365
|
-
let types = void 0;
|
|
2366
2371
|
let offer;
|
|
2367
2372
|
if (requestData.existingClientState) {
|
|
2368
2373
|
oid4vciClient = await import_oid4vci_client3.OpenID4VCIClient.fromState({
|
|
@@ -2398,17 +2403,18 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2398
2403
|
});
|
|
2399
2404
|
}
|
|
2400
2405
|
}
|
|
2406
|
+
let configurationIds = [];
|
|
2401
2407
|
if (offer) {
|
|
2402
|
-
|
|
2408
|
+
configurationIds = offer.original_credential_offer.credential_configuration_ids;
|
|
2403
2409
|
} else {
|
|
2404
|
-
|
|
2410
|
+
configurationIds = (0, import_utils2.asArray)(authorizationRequestOpts.authorizationDetails).filter((authDetails) => typeof authDetails !== "string").map((authReqOpts) => authReqOpts.credential_configuration_id).filter((id) => !!id);
|
|
2405
2411
|
}
|
|
2406
|
-
const serverMetadata = await oid4vciClient.retrieveServerMetadata();
|
|
2407
2412
|
const credentialsSupported = await getCredentialConfigsSupportedMerged({
|
|
2408
2413
|
client: oid4vciClient,
|
|
2409
2414
|
vcFormatPreferences: formats,
|
|
2410
|
-
|
|
2415
|
+
configurationIds
|
|
2411
2416
|
});
|
|
2417
|
+
const serverMetadata = await oid4vciClient.retrieveServerMetadata();
|
|
2412
2418
|
const credentialBranding = await getCredentialBranding({
|
|
2413
2419
|
credentialsSupported,
|
|
2414
2420
|
context
|
|
@@ -2625,26 +2631,26 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2625
2631
|
return Promise.reject(Error("Missing credential offers in context"));
|
|
2626
2632
|
}
|
|
2627
2633
|
let correlationId = credentialsToAccept[0].correlationId;
|
|
2628
|
-
let identifierType =
|
|
2634
|
+
let identifierType = import_ssi_sdk4.CorrelationIdentifierType.DID;
|
|
2629
2635
|
if (!correlationId.toLowerCase().startsWith("did:")) {
|
|
2630
|
-
identifierType =
|
|
2636
|
+
identifierType = import_ssi_sdk4.CorrelationIdentifierType.URL;
|
|
2631
2637
|
if (correlationId.startsWith("http")) {
|
|
2632
2638
|
correlationId = new URL(correlationId).hostname;
|
|
2633
2639
|
}
|
|
2634
2640
|
}
|
|
2635
2641
|
const identity = {
|
|
2636
2642
|
alias: credentialsToAccept[0].correlationId,
|
|
2637
|
-
origin:
|
|
2643
|
+
origin: import_ssi_sdk4.IdentityOrigin.EXTERNAL,
|
|
2638
2644
|
roles: [
|
|
2639
|
-
|
|
2645
|
+
import_ssi_types2.CredentialRole.ISSUER
|
|
2640
2646
|
],
|
|
2641
2647
|
identifier: {
|
|
2642
2648
|
type: identifierType,
|
|
2643
2649
|
correlationId
|
|
2644
2650
|
},
|
|
2645
|
-
...identifierType ===
|
|
2651
|
+
...identifierType === import_ssi_sdk4.CorrelationIdentifierType.URL && {
|
|
2646
2652
|
connection: {
|
|
2647
|
-
type:
|
|
2653
|
+
type: import_ssi_sdk4.ConnectionType.OPENID_CONNECT,
|
|
2648
2654
|
config: {
|
|
2649
2655
|
clientId: "138d7bf8-c930-4c6e-b928-97d3a4928b01",
|
|
2650
2656
|
clientSecret: "03b3955f-d020-4f2a-8a27-4e452d4e27a0",
|
|
@@ -2671,7 +2677,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2671
2677
|
}
|
|
2672
2678
|
async oid4vciHolderGetIssuerBranding(args, context) {
|
|
2673
2679
|
const { serverMetadata, contact } = args;
|
|
2674
|
-
const issuerCorrelationId = contact?.identities.filter((identity) => identity.roles.includes(
|
|
2680
|
+
const issuerCorrelationId = contact?.identities.filter((identity) => identity.roles.includes(import_ssi_types2.CredentialRole.ISSUER)).map((identity) => identity.identifier.correlationId)[0];
|
|
2675
2681
|
if (issuerCorrelationId) {
|
|
2676
2682
|
const branding = await context.agent.ibGetIssuerBranding({
|
|
2677
2683
|
filter: [
|
|
@@ -2701,7 +2707,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2701
2707
|
if (!contact) {
|
|
2702
2708
|
return Promise.reject(Error("Missing contact in context"));
|
|
2703
2709
|
}
|
|
2704
|
-
const issuerCorrelationId = contact?.identities.filter((identity) => identity.roles.includes(
|
|
2710
|
+
const issuerCorrelationId = contact?.identities.filter((identity) => identity.roles.includes(import_ssi_types2.CredentialRole.ISSUER)).map((identity) => identity.identifier.correlationId)[0];
|
|
2705
2711
|
const branding = await context.agent.ibGetIssuerBranding({
|
|
2706
2712
|
filter: [
|
|
2707
2713
|
{
|
|
@@ -2797,9 +2803,9 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2797
2803
|
if (Array.isArray(subjectIssuance?.notification_events_supported)) {
|
|
2798
2804
|
event = subjectIssuance.notification_events_supported.includes("credential_accepted_holder_signed") ? "credential_accepted_holder_signed" : "credential_deleted_holder_signed";
|
|
2799
2805
|
logger.log(`Subject issuance/signing will be used, with event`, event);
|
|
2800
|
-
const issuerVC = mappedCredentialToAccept.credentialToAccept.credentialResponse
|
|
2806
|
+
const issuerVC = extractCredentialFromResponse(mappedCredentialToAccept.credentialToAccept.credentialResponse);
|
|
2801
2807
|
const wrappedIssuerVC = import_ssi_types2.CredentialMapper.toWrappedVerifiableCredential(issuerVC, {
|
|
2802
|
-
hasher: this.hasher ??
|
|
2808
|
+
hasher: this.hasher ?? import_ssi_sdk2.defaultHasher
|
|
2803
2809
|
});
|
|
2804
2810
|
console.log(`Wrapped VC: ${wrappedIssuerVC.type}, ${wrappedIssuerVC.format}`);
|
|
2805
2811
|
let issuer;
|
|
@@ -2900,11 +2906,11 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2900
2906
|
const [subjectCorrelationType, subjectCorrelationId] = this.determineSubjectCorrelation(issuanceOpt.identifier, issuer);
|
|
2901
2907
|
const persistedCredential = await context.agent.crsAddCredential({
|
|
2902
2908
|
credential: {
|
|
2903
|
-
rawDocument: (0,
|
|
2909
|
+
rawDocument: (0, import_ssi_sdk3.ensureRawDocument)(persistCredential),
|
|
2904
2910
|
kmsKeyRef,
|
|
2905
2911
|
identifierMethod: method,
|
|
2906
|
-
credentialRole:
|
|
2907
|
-
issuerCorrelationType: issuer?.startsWith("did:") ?
|
|
2912
|
+
credentialRole: import_ssi_types2.CredentialRole.HOLDER,
|
|
2913
|
+
issuerCorrelationType: issuer?.startsWith("did:") ? import_ssi_sdk4.CredentialCorrelationType.DID : import_ssi_sdk4.CredentialCorrelationType.URL,
|
|
2908
2914
|
issuerCorrelationId: issuer,
|
|
2909
2915
|
subjectCorrelationType,
|
|
2910
2916
|
subjectCorrelationId
|
|
@@ -2972,12 +2978,12 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2972
2978
|
case "did":
|
|
2973
2979
|
if ((0, import_ssi_sdk_ext6.isManagedIdentifierResult)(identifier) && (0, import_ssi_sdk_ext6.isManagedIdentifierDidResult)(identifier)) {
|
|
2974
2980
|
return [
|
|
2975
|
-
|
|
2981
|
+
import_ssi_sdk4.CredentialCorrelationType.DID,
|
|
2976
2982
|
identifier.did
|
|
2977
2983
|
];
|
|
2978
2984
|
} else if ((0, import_ssi_sdk_ext6.isManagedIdentifierDidOpts)(identifier)) {
|
|
2979
2985
|
return [
|
|
2980
|
-
|
|
2986
|
+
import_ssi_sdk4.CredentialCorrelationType.DID,
|
|
2981
2987
|
typeof identifier.identifier === "string" ? identifier.identifier : identifier.identifier.did
|
|
2982
2988
|
];
|
|
2983
2989
|
}
|
|
@@ -2985,12 +2991,12 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2985
2991
|
case "kid":
|
|
2986
2992
|
if ((0, import_ssi_sdk_ext6.isManagedIdentifierResult)(identifier) && (0, import_ssi_sdk_ext6.isManagedIdentifierKidResult)(identifier)) {
|
|
2987
2993
|
return [
|
|
2988
|
-
|
|
2994
|
+
import_ssi_sdk4.CredentialCorrelationType.KID,
|
|
2989
2995
|
identifier.kid
|
|
2990
2996
|
];
|
|
2991
2997
|
} else if ((0, import_ssi_sdk_ext6.isManagedIdentifierDidOpts)(identifier)) {
|
|
2992
2998
|
return [
|
|
2993
|
-
|
|
2999
|
+
import_ssi_sdk4.CredentialCorrelationType.KID,
|
|
2994
3000
|
identifier.identifier
|
|
2995
3001
|
];
|
|
2996
3002
|
}
|
|
@@ -2998,19 +3004,19 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2998
3004
|
case "x5c":
|
|
2999
3005
|
if ((0, import_ssi_sdk_ext6.isManagedIdentifierResult)(identifier) && (0, import_ssi_sdk_ext6.isManagedIdentifierX5cResult)(identifier)) {
|
|
3000
3006
|
return [
|
|
3001
|
-
|
|
3007
|
+
import_ssi_sdk4.CredentialCorrelationType.X509_SAN,
|
|
3002
3008
|
identifier.x5c.join("\r\n")
|
|
3003
3009
|
];
|
|
3004
3010
|
} else if ((0, import_ssi_sdk_ext6.isManagedIdentifierX5cOpts)(identifier)) {
|
|
3005
3011
|
return [
|
|
3006
|
-
|
|
3012
|
+
import_ssi_sdk4.CredentialCorrelationType.X509_SAN,
|
|
3007
3013
|
identifier.identifier.join("\r\n")
|
|
3008
3014
|
];
|
|
3009
3015
|
}
|
|
3010
3016
|
break;
|
|
3011
3017
|
}
|
|
3012
3018
|
return [
|
|
3013
|
-
|
|
3019
|
+
import_ssi_sdk4.CredentialCorrelationType.URL,
|
|
3014
3020
|
issuer
|
|
3015
3021
|
];
|
|
3016
3022
|
}
|
|
@@ -3069,9 +3075,9 @@ var OID4VCICallbackStateListener = /* @__PURE__ */ __name((callbacks) => {
|
|
|
3069
3075
|
// src/link-handler/index.ts
|
|
3070
3076
|
var import_oid4vci_client4 = require("@sphereon/oid4vci-client");
|
|
3071
3077
|
var import_oid4vci_common5 = require("@sphereon/oid4vci-common");
|
|
3072
|
-
var
|
|
3073
|
-
var
|
|
3074
|
-
var OID4VCIHolderLinkHandler = class extends
|
|
3078
|
+
var import_ssi_sdk5 = require("@sphereon/ssi-sdk.core");
|
|
3079
|
+
var import_ssi_sdk6 = require("@sphereon/ssi-sdk.xstate-machine-persistence");
|
|
3080
|
+
var OID4VCIHolderLinkHandler = class extends import_ssi_sdk5.LinkHandlerAdapter {
|
|
3075
3081
|
static {
|
|
3076
3082
|
__name(this, "OID4VCIHolderLinkHandler");
|
|
3077
3083
|
}
|
|
@@ -3131,7 +3137,7 @@ var OID4VCIHolderLinkHandler = class extends import_ssi_sdk4.LinkHandlerAdapter
|
|
|
3131
3137
|
const interpreter = oid4vciMachine.interpreter;
|
|
3132
3138
|
if (!opts?.machineState && this.context.agent.availableMethods().includes("machineStatesFindActive")) {
|
|
3133
3139
|
const stateType = hasCode ? "existing" : "new";
|
|
3134
|
-
await (0,
|
|
3140
|
+
await (0, import_ssi_sdk6.interpreterStartOrResume)({
|
|
3135
3141
|
stateType,
|
|
3136
3142
|
interpreter,
|
|
3137
3143
|
context: this.context,
|