@sphereon/ssi-sdk.oid4vci-holder 0.34.1-feature.FIDES.1.274 → 0.34.1-feature.IDK.11.49
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 +419 -425
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -10
- package/dist/index.d.ts +7 -10
- package/dist/index.js +513 -519
- package/dist/index.js.map +1 -1
- package/package.json +24 -25
- package/src/agent/OID4VCIHolder.ts +34 -35
- 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 +45 -46
- package/src/types/FirstPartyMachine.ts +5 -6
- package/src/types/IOID4VCIHolder.ts +2 -4
package/dist/index.cjs
CHANGED
|
@@ -100,7 +100,6 @@ __export(index_exports, {
|
|
|
100
100
|
RequestType: () => RequestType,
|
|
101
101
|
SupportedLanguage: () => SupportedLanguage,
|
|
102
102
|
createConfig: () => createConfig,
|
|
103
|
-
extractCredentialFromResponse: () => extractCredentialFromResponse,
|
|
104
103
|
getBasicIssuerLocaleBranding: () => getBasicIssuerLocaleBranding,
|
|
105
104
|
getCredentialBranding: () => getCredentialBranding,
|
|
106
105
|
getCredentialConfigsBasedOnFormatPref: () => getCredentialConfigsBasedOnFormatPref,
|
|
@@ -140,12 +139,9 @@ var import_oid4vci_common4 = require("@sphereon/oid4vci-common");
|
|
|
140
139
|
var import_ssi_sdk_ext5 = require("@sphereon/ssi-sdk-ext.did-utils");
|
|
141
140
|
var import_ssi_sdk_ext6 = require("@sphereon/ssi-sdk-ext.identifier-resolution");
|
|
142
141
|
var import_ssi_sdk_ext7 = require("@sphereon/ssi-sdk-ext.key-utils");
|
|
143
|
-
var import_ssi_sdk2 = require("@sphereon/ssi-sdk.
|
|
144
|
-
var import_ssi_sdk3 = require("@sphereon/ssi-sdk.data-store-types");
|
|
145
|
-
var import_ssi_sdk4 = require("@sphereon/ssi-sdk.data-store-types");
|
|
142
|
+
var import_ssi_sdk2 = require("@sphereon/ssi-sdk.data-store");
|
|
146
143
|
var import_ssi_types2 = require("@sphereon/ssi-types");
|
|
147
144
|
var import_utils2 = require("@veramo/utils");
|
|
148
|
-
var import_cross_fetch = __toESM(require("cross-fetch"), 1);
|
|
149
145
|
var import_did_jwt = require("did-jwt");
|
|
150
146
|
var import_uuid2 = require("uuid");
|
|
151
147
|
|
|
@@ -232,7 +228,6 @@ var OID4VCIMachineGuards = /* @__PURE__ */ (function(OID4VCIMachineGuards2) {
|
|
|
232
228
|
OID4VCIMachineGuards2["requirePinGuard"] = "oid4vciRequirePinGuard";
|
|
233
229
|
OID4VCIMachineGuards2["requireAuthorizationGuard"] = "oid4vciRequireAuthorizationGuard";
|
|
234
230
|
OID4VCIMachineGuards2["noAuthorizationGuard"] = "oid4vciNoAuthorizationGuard";
|
|
235
|
-
OID4VCIMachineGuards2["hasNonceEndpointGuard"] = "oid4vciHasNonceEndpointGuard ";
|
|
236
231
|
OID4VCIMachineGuards2["hasAuthorizationResponse"] = "oid4vciHasAuthorizationResponse";
|
|
237
232
|
OID4VCIMachineGuards2["hasNoContactIdentityGuard"] = "oid4vciHasNoContactIdentityGuard";
|
|
238
233
|
OID4VCIMachineGuards2["verificationCodeGuard"] = "oid4vciVerificationCodeGuard";
|
|
@@ -1065,295 +1060,9 @@ var import_ssi_sdk_ext = require("@sphereon/ssi-sdk-ext.did-resolver-jwk");
|
|
|
1065
1060
|
var import_ssi_sdk_ext2 = require("@sphereon/ssi-sdk-ext.did-utils");
|
|
1066
1061
|
var import_ssi_sdk_ext3 = require("@sphereon/ssi-sdk-ext.identifier-resolution");
|
|
1067
1062
|
var import_ssi_sdk_ext4 = require("@sphereon/ssi-sdk-ext.key-utils");
|
|
1068
|
-
var import_ssi_sdk = require("@sphereon/ssi-sdk.core");
|
|
1069
1063
|
var import_ssi_types = require("@sphereon/ssi-types");
|
|
1070
1064
|
var import_utils = require("@veramo/utils");
|
|
1071
1065
|
|
|
1072
|
-
// src/machines/firstPartyMachine.ts
|
|
1073
|
-
var import_xstate2 = require("xstate");
|
|
1074
|
-
var import_oid4vci_common2 = require("@sphereon/oid4vci-common");
|
|
1075
|
-
|
|
1076
|
-
// src/services/FirstPartyMachineServices.ts
|
|
1077
|
-
var import_oid4vci_client = require("@sphereon/oid4vci-client");
|
|
1078
|
-
var import_uuid = require("uuid");
|
|
1079
|
-
var sendAuthorizationChallengeRequest = /* @__PURE__ */ __name(async (args) => {
|
|
1080
|
-
const { openID4VCIClientState, authSession, presentationDuringIssuanceSession } = args;
|
|
1081
|
-
const oid4vciClient = await import_oid4vci_client.OpenID4VCIClient.fromState({
|
|
1082
|
-
state: openID4VCIClientState
|
|
1083
|
-
});
|
|
1084
|
-
return oid4vciClient.acquireAuthorizationChallengeCode({
|
|
1085
|
-
clientId: oid4vciClient.clientId ?? (0, import_uuid.v4)(),
|
|
1086
|
-
...authSession && {
|
|
1087
|
-
authSession
|
|
1088
|
-
},
|
|
1089
|
-
...!authSession && openID4VCIClientState.credentialOffer?.preAuthorizedCode && {
|
|
1090
|
-
issuerState: openID4VCIClientState.credentialOffer?.preAuthorizedCode
|
|
1091
|
-
},
|
|
1092
|
-
...!authSession && openID4VCIClientState.credentialOffer?.issuerState && {
|
|
1093
|
-
issuerState: openID4VCIClientState.credentialOffer?.issuerState
|
|
1094
|
-
},
|
|
1095
|
-
...presentationDuringIssuanceSession && {
|
|
1096
|
-
presentationDuringIssuanceSession
|
|
1097
|
-
}
|
|
1098
|
-
});
|
|
1099
|
-
}, "sendAuthorizationChallengeRequest");
|
|
1100
|
-
var createConfig = /* @__PURE__ */ __name(async (args, context) => {
|
|
1101
|
-
const { presentationUri } = args;
|
|
1102
|
-
if (!presentationUri) {
|
|
1103
|
-
return Promise.reject(Error("Missing presentation uri in context"));
|
|
1104
|
-
}
|
|
1105
|
-
return context.agent.siopCreateConfig({
|
|
1106
|
-
url: presentationUri
|
|
1107
|
-
});
|
|
1108
|
-
}, "createConfig");
|
|
1109
|
-
var getSiopRequest = /* @__PURE__ */ __name(async (args, context) => {
|
|
1110
|
-
const { didAuthConfig, presentationUri } = args;
|
|
1111
|
-
if (presentationUri === void 0) {
|
|
1112
|
-
return Promise.reject(Error("Missing presentation uri in context"));
|
|
1113
|
-
}
|
|
1114
|
-
if (didAuthConfig === void 0) {
|
|
1115
|
-
return Promise.reject(Error("Missing did auth config in context"));
|
|
1116
|
-
}
|
|
1117
|
-
return context.agent.siopGetSiopRequest({
|
|
1118
|
-
didAuthConfig,
|
|
1119
|
-
url: presentationUri
|
|
1120
|
-
});
|
|
1121
|
-
}, "getSiopRequest");
|
|
1122
|
-
var sendAuthorizationResponse = /* @__PURE__ */ __name(async (args, context) => {
|
|
1123
|
-
const { didAuthConfig, authorizationRequestData, selectedCredentials } = args;
|
|
1124
|
-
const responseData = await context.agent.siopSendResponse({
|
|
1125
|
-
authorizationRequestData,
|
|
1126
|
-
selectedCredentials,
|
|
1127
|
-
didAuthConfig,
|
|
1128
|
-
isFirstParty: true
|
|
1129
|
-
});
|
|
1130
|
-
return responseData.body.presentation_during_issuance_session;
|
|
1131
|
-
}, "sendAuthorizationResponse");
|
|
1132
|
-
|
|
1133
|
-
// src/machines/firstPartyMachine.ts
|
|
1134
|
-
var firstPartyMachineStates = {
|
|
1135
|
-
[FirstPartyMachineStateTypes.sendAuthorizationChallengeRequest]: {
|
|
1136
|
-
id: FirstPartyMachineStateTypes.sendAuthorizationChallengeRequest,
|
|
1137
|
-
invoke: {
|
|
1138
|
-
src: FirstPartyMachineServices.sendAuthorizationChallengeRequest,
|
|
1139
|
-
onDone: {
|
|
1140
|
-
target: FirstPartyMachineStateTypes.done,
|
|
1141
|
-
actions: (0, import_xstate2.assign)({
|
|
1142
|
-
authorizationCodeResponse: /* @__PURE__ */ __name((_ctx, _event) => _event.data, "authorizationCodeResponse")
|
|
1143
|
-
})
|
|
1144
|
-
},
|
|
1145
|
-
onError: [
|
|
1146
|
-
{
|
|
1147
|
-
target: FirstPartyMachineStateTypes.createConfig,
|
|
1148
|
-
cond: /* @__PURE__ */ __name((_ctx, _event) => _event.data.error === import_oid4vci_common2.AuthorizationChallengeError.insufficient_authorization, "cond"),
|
|
1149
|
-
actions: (0, import_xstate2.assign)({
|
|
1150
|
-
authSession: /* @__PURE__ */ __name((_ctx, _event) => _event.data.auth_session, "authSession"),
|
|
1151
|
-
presentationUri: /* @__PURE__ */ __name((_ctx, _event) => _event.data.presentation, "presentationUri")
|
|
1152
|
-
})
|
|
1153
|
-
},
|
|
1154
|
-
{
|
|
1155
|
-
target: FirstPartyMachineStateTypes.error,
|
|
1156
|
-
actions: (0, import_xstate2.assign)({
|
|
1157
|
-
error: /* @__PURE__ */ __name((_ctx, _event) => ({
|
|
1158
|
-
title: translate("oid4vci_machine_send_authorization_challenge_request_error_title"),
|
|
1159
|
-
message: _event.data.message,
|
|
1160
|
-
stack: _event.data.stack
|
|
1161
|
-
}), "error")
|
|
1162
|
-
})
|
|
1163
|
-
}
|
|
1164
|
-
]
|
|
1165
|
-
}
|
|
1166
|
-
},
|
|
1167
|
-
[FirstPartyMachineStateTypes.createConfig]: {
|
|
1168
|
-
id: FirstPartyMachineStateTypes.createConfig,
|
|
1169
|
-
invoke: {
|
|
1170
|
-
src: FirstPartyMachineServices.createConfig,
|
|
1171
|
-
onDone: {
|
|
1172
|
-
target: FirstPartyMachineStateTypes.getSiopRequest,
|
|
1173
|
-
actions: (0, import_xstate2.assign)({
|
|
1174
|
-
didAuthConfig: /* @__PURE__ */ __name((_ctx, _event) => _event.data, "didAuthConfig")
|
|
1175
|
-
})
|
|
1176
|
-
},
|
|
1177
|
-
onError: {
|
|
1178
|
-
target: FirstPartyMachineStateTypes.error,
|
|
1179
|
-
actions: (0, import_xstate2.assign)({
|
|
1180
|
-
error: /* @__PURE__ */ __name((_ctx, _event) => ({
|
|
1181
|
-
title: translate("oid4vci_machine_create_config_error_title"),
|
|
1182
|
-
message: _event.data.message,
|
|
1183
|
-
stack: _event.data.stack
|
|
1184
|
-
}), "error")
|
|
1185
|
-
})
|
|
1186
|
-
}
|
|
1187
|
-
}
|
|
1188
|
-
},
|
|
1189
|
-
[FirstPartyMachineStateTypes.getSiopRequest]: {
|
|
1190
|
-
id: FirstPartyMachineStateTypes.getSiopRequest,
|
|
1191
|
-
invoke: {
|
|
1192
|
-
src: FirstPartyMachineServices.getSiopRequest,
|
|
1193
|
-
onDone: {
|
|
1194
|
-
target: FirstPartyMachineStateTypes.selectCredentials,
|
|
1195
|
-
actions: (0, import_xstate2.assign)({
|
|
1196
|
-
authorizationRequestData: /* @__PURE__ */ __name((_ctx, _event) => _event.data, "authorizationRequestData")
|
|
1197
|
-
})
|
|
1198
|
-
},
|
|
1199
|
-
onError: {
|
|
1200
|
-
target: FirstPartyMachineStateTypes.error,
|
|
1201
|
-
actions: (0, import_xstate2.assign)({
|
|
1202
|
-
error: /* @__PURE__ */ __name((_ctx, _event) => ({
|
|
1203
|
-
title: translate("siopV2_machine_get_request_error_title"),
|
|
1204
|
-
message: _event.data.message,
|
|
1205
|
-
stack: _event.data.stack
|
|
1206
|
-
}), "error")
|
|
1207
|
-
})
|
|
1208
|
-
}
|
|
1209
|
-
}
|
|
1210
|
-
},
|
|
1211
|
-
[FirstPartyMachineStateTypes.selectCredentials]: {
|
|
1212
|
-
id: FirstPartyMachineStateTypes.selectCredentials,
|
|
1213
|
-
on: {
|
|
1214
|
-
[FirstPartyMachineEvents.SET_SELECTED_CREDENTIALS]: {
|
|
1215
|
-
actions: (0, import_xstate2.assign)({
|
|
1216
|
-
selectedCredentials: /* @__PURE__ */ __name((_ctx, _event) => _event.data, "selectedCredentials")
|
|
1217
|
-
})
|
|
1218
|
-
},
|
|
1219
|
-
[FirstPartyMachineEvents.NEXT]: {
|
|
1220
|
-
target: FirstPartyMachineStateTypes.sendAuthorizationResponse
|
|
1221
|
-
},
|
|
1222
|
-
[FirstPartyMachineEvents.DECLINE]: {
|
|
1223
|
-
target: FirstPartyMachineStateTypes.declined
|
|
1224
|
-
},
|
|
1225
|
-
[FirstPartyMachineEvents.PREVIOUS]: {
|
|
1226
|
-
target: FirstPartyMachineStateTypes.aborted
|
|
1227
|
-
}
|
|
1228
|
-
}
|
|
1229
|
-
},
|
|
1230
|
-
[FirstPartyMachineStateTypes.sendAuthorizationResponse]: {
|
|
1231
|
-
id: FirstPartyMachineStateTypes.sendAuthorizationResponse,
|
|
1232
|
-
invoke: {
|
|
1233
|
-
src: FirstPartyMachineServices.sendAuthorizationResponse,
|
|
1234
|
-
onDone: {
|
|
1235
|
-
target: FirstPartyMachineStateTypes.sendAuthorizationChallengeRequest,
|
|
1236
|
-
actions: (0, import_xstate2.assign)({
|
|
1237
|
-
presentationDuringIssuanceSession: /* @__PURE__ */ __name((_ctx, _event) => _event.data, "presentationDuringIssuanceSession")
|
|
1238
|
-
})
|
|
1239
|
-
},
|
|
1240
|
-
onError: {
|
|
1241
|
-
target: FirstPartyMachineStateTypes.error,
|
|
1242
|
-
actions: (0, import_xstate2.assign)({
|
|
1243
|
-
error: /* @__PURE__ */ __name((_ctx, _event) => ({
|
|
1244
|
-
title: translate("oid4vci_machine_get_request_error_title"),
|
|
1245
|
-
message: _event.data.message,
|
|
1246
|
-
stack: _event.data.stack
|
|
1247
|
-
}), "error")
|
|
1248
|
-
})
|
|
1249
|
-
}
|
|
1250
|
-
}
|
|
1251
|
-
},
|
|
1252
|
-
[FirstPartyMachineStateTypes.aborted]: {
|
|
1253
|
-
id: FirstPartyMachineStateTypes.aborted,
|
|
1254
|
-
type: "final"
|
|
1255
|
-
},
|
|
1256
|
-
[FirstPartyMachineStateTypes.declined]: {
|
|
1257
|
-
id: FirstPartyMachineStateTypes.declined,
|
|
1258
|
-
type: "final"
|
|
1259
|
-
},
|
|
1260
|
-
[FirstPartyMachineStateTypes.error]: {
|
|
1261
|
-
id: FirstPartyMachineStateTypes.error,
|
|
1262
|
-
type: "final"
|
|
1263
|
-
},
|
|
1264
|
-
[FirstPartyMachineStateTypes.done]: {
|
|
1265
|
-
id: FirstPartyMachineStateTypes.done,
|
|
1266
|
-
type: "final"
|
|
1267
|
-
}
|
|
1268
|
-
};
|
|
1269
|
-
var createFirstPartyActivationMachine = /* @__PURE__ */ __name((opts) => {
|
|
1270
|
-
const initialContext = {
|
|
1271
|
-
openID4VCIClientState: opts.openID4VCIClientState,
|
|
1272
|
-
contact: opts.contact,
|
|
1273
|
-
selectedCredentials: []
|
|
1274
|
-
};
|
|
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
1066
|
// src/mappers/OIDC4VCIBrandingMapper.ts
|
|
1358
1067
|
var oid4vciGetCredentialBrandingFrom = /* @__PURE__ */ __name(async (args) => {
|
|
1359
1068
|
const { credentialDisplay, issuerCredentialSubject } = args;
|
|
@@ -1532,97 +1241,383 @@ var sdJwtCredentialLocaleBrandingFrom = /* @__PURE__ */ __name(async (args) => {
|
|
|
1532
1241
|
alt: credentialDisplay.rendering.simple.logo.alt_text
|
|
1533
1242
|
}
|
|
1534
1243
|
}
|
|
1535
|
-
},
|
|
1536
|
-
...credentialDisplay.description && {
|
|
1537
|
-
description: credentialDisplay.description
|
|
1538
|
-
},
|
|
1539
|
-
...credentialDisplay.rendering?.simple?.text_color && {
|
|
1540
|
-
text: {
|
|
1541
|
-
color: credentialDisplay.rendering.simple.text_color
|
|
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
|
+
// src/machines/firstPartyMachine.ts
|
|
1329
|
+
var import_xstate2 = require("xstate");
|
|
1330
|
+
var import_oid4vci_common2 = require("@sphereon/oid4vci-common");
|
|
1331
|
+
|
|
1332
|
+
// src/services/FirstPartyMachineServices.ts
|
|
1333
|
+
var import_oid4vci_client = require("@sphereon/oid4vci-client");
|
|
1334
|
+
var import_uuid = require("uuid");
|
|
1335
|
+
var sendAuthorizationChallengeRequest = /* @__PURE__ */ __name(async (args) => {
|
|
1336
|
+
const { openID4VCIClientState, authSession, presentationDuringIssuanceSession } = args;
|
|
1337
|
+
const oid4vciClient = await import_oid4vci_client.OpenID4VCIClient.fromState({
|
|
1338
|
+
state: openID4VCIClientState
|
|
1339
|
+
});
|
|
1340
|
+
return oid4vciClient.acquireAuthorizationChallengeCode({
|
|
1341
|
+
clientId: oid4vciClient.clientId ?? (0, import_uuid.v4)(),
|
|
1342
|
+
...authSession && {
|
|
1343
|
+
authSession
|
|
1344
|
+
},
|
|
1345
|
+
...!authSession && openID4VCIClientState.credentialOffer?.preAuthorizedCode && {
|
|
1346
|
+
issuerState: openID4VCIClientState.credentialOffer?.preAuthorizedCode
|
|
1347
|
+
},
|
|
1348
|
+
...!authSession && openID4VCIClientState.credentialOffer?.issuerState && {
|
|
1349
|
+
issuerState: openID4VCIClientState.credentialOffer?.issuerState
|
|
1350
|
+
},
|
|
1351
|
+
...presentationDuringIssuanceSession && {
|
|
1352
|
+
presentationDuringIssuanceSession
|
|
1353
|
+
}
|
|
1354
|
+
});
|
|
1355
|
+
}, "sendAuthorizationChallengeRequest");
|
|
1356
|
+
var createConfig = /* @__PURE__ */ __name(async (args, context) => {
|
|
1357
|
+
const { presentationUri } = args;
|
|
1358
|
+
if (!presentationUri) {
|
|
1359
|
+
return Promise.reject(Error("Missing presentation uri in context"));
|
|
1360
|
+
}
|
|
1361
|
+
return context.agent.siopCreateConfig({
|
|
1362
|
+
url: presentationUri
|
|
1363
|
+
});
|
|
1364
|
+
}, "createConfig");
|
|
1365
|
+
var getSiopRequest = /* @__PURE__ */ __name(async (args, context) => {
|
|
1366
|
+
const { didAuthConfig, presentationUri } = args;
|
|
1367
|
+
if (presentationUri === void 0) {
|
|
1368
|
+
return Promise.reject(Error("Missing presentation uri in context"));
|
|
1369
|
+
}
|
|
1370
|
+
if (didAuthConfig === void 0) {
|
|
1371
|
+
return Promise.reject(Error("Missing did auth config in context"));
|
|
1372
|
+
}
|
|
1373
|
+
return context.agent.siopGetSiopRequest({
|
|
1374
|
+
didAuthConfig,
|
|
1375
|
+
url: presentationUri
|
|
1376
|
+
});
|
|
1377
|
+
}, "getSiopRequest");
|
|
1378
|
+
var sendAuthorizationResponse = /* @__PURE__ */ __name(async (args, context) => {
|
|
1379
|
+
const { didAuthConfig, authorizationRequestData, selectedCredentials } = args;
|
|
1380
|
+
const responseData = await context.agent.siopSendResponse({
|
|
1381
|
+
authorizationRequestData,
|
|
1382
|
+
selectedCredentials,
|
|
1383
|
+
didAuthConfig,
|
|
1384
|
+
isFirstParty: true
|
|
1385
|
+
});
|
|
1386
|
+
return responseData.body.presentation_during_issuance_session;
|
|
1387
|
+
}, "sendAuthorizationResponse");
|
|
1388
|
+
|
|
1389
|
+
// src/machines/firstPartyMachine.ts
|
|
1390
|
+
var firstPartyMachineStates = {
|
|
1391
|
+
[FirstPartyMachineStateTypes.sendAuthorizationChallengeRequest]: {
|
|
1392
|
+
id: FirstPartyMachineStateTypes.sendAuthorizationChallengeRequest,
|
|
1393
|
+
invoke: {
|
|
1394
|
+
src: FirstPartyMachineServices.sendAuthorizationChallengeRequest,
|
|
1395
|
+
onDone: {
|
|
1396
|
+
target: FirstPartyMachineStateTypes.done,
|
|
1397
|
+
actions: (0, import_xstate2.assign)({
|
|
1398
|
+
authorizationCodeResponse: /* @__PURE__ */ __name((_ctx, _event) => _event.data, "authorizationCodeResponse")
|
|
1399
|
+
})
|
|
1400
|
+
},
|
|
1401
|
+
onError: [
|
|
1402
|
+
{
|
|
1403
|
+
target: FirstPartyMachineStateTypes.createConfig,
|
|
1404
|
+
cond: /* @__PURE__ */ __name((_ctx, _event) => _event.data.error === import_oid4vci_common2.AuthorizationChallengeError.insufficient_authorization, "cond"),
|
|
1405
|
+
actions: (0, import_xstate2.assign)({
|
|
1406
|
+
authSession: /* @__PURE__ */ __name((_ctx, _event) => _event.data.auth_session, "authSession"),
|
|
1407
|
+
presentationUri: /* @__PURE__ */ __name((_ctx, _event) => _event.data.presentation, "presentationUri")
|
|
1408
|
+
})
|
|
1409
|
+
},
|
|
1410
|
+
{
|
|
1411
|
+
target: FirstPartyMachineStateTypes.error,
|
|
1412
|
+
actions: (0, import_xstate2.assign)({
|
|
1413
|
+
error: /* @__PURE__ */ __name((_ctx, _event) => ({
|
|
1414
|
+
title: translate("oid4vci_machine_send_authorization_challenge_request_error_title"),
|
|
1415
|
+
message: _event.data.message,
|
|
1416
|
+
stack: _event.data.stack
|
|
1417
|
+
}), "error")
|
|
1418
|
+
})
|
|
1419
|
+
}
|
|
1420
|
+
]
|
|
1421
|
+
}
|
|
1422
|
+
},
|
|
1423
|
+
[FirstPartyMachineStateTypes.createConfig]: {
|
|
1424
|
+
id: FirstPartyMachineStateTypes.createConfig,
|
|
1425
|
+
invoke: {
|
|
1426
|
+
src: FirstPartyMachineServices.createConfig,
|
|
1427
|
+
onDone: {
|
|
1428
|
+
target: FirstPartyMachineStateTypes.getSiopRequest,
|
|
1429
|
+
actions: (0, import_xstate2.assign)({
|
|
1430
|
+
didAuthConfig: /* @__PURE__ */ __name((_ctx, _event) => _event.data, "didAuthConfig")
|
|
1431
|
+
})
|
|
1432
|
+
},
|
|
1433
|
+
onError: {
|
|
1434
|
+
target: FirstPartyMachineStateTypes.error,
|
|
1435
|
+
actions: (0, import_xstate2.assign)({
|
|
1436
|
+
error: /* @__PURE__ */ __name((_ctx, _event) => ({
|
|
1437
|
+
title: translate("oid4vci_machine_create_config_error_title"),
|
|
1438
|
+
message: _event.data.message,
|
|
1439
|
+
stack: _event.data.stack
|
|
1440
|
+
}), "error")
|
|
1441
|
+
})
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
1444
|
+
},
|
|
1445
|
+
[FirstPartyMachineStateTypes.getSiopRequest]: {
|
|
1446
|
+
id: FirstPartyMachineStateTypes.getSiopRequest,
|
|
1447
|
+
invoke: {
|
|
1448
|
+
src: FirstPartyMachineServices.getSiopRequest,
|
|
1449
|
+
onDone: {
|
|
1450
|
+
target: FirstPartyMachineStateTypes.selectCredentials,
|
|
1451
|
+
actions: (0, import_xstate2.assign)({
|
|
1452
|
+
authorizationRequestData: /* @__PURE__ */ __name((_ctx, _event) => _event.data, "authorizationRequestData")
|
|
1453
|
+
})
|
|
1454
|
+
},
|
|
1455
|
+
onError: {
|
|
1456
|
+
target: FirstPartyMachineStateTypes.error,
|
|
1457
|
+
actions: (0, import_xstate2.assign)({
|
|
1458
|
+
error: /* @__PURE__ */ __name((_ctx, _event) => ({
|
|
1459
|
+
title: translate("siopV2_machine_get_request_error_title"),
|
|
1460
|
+
message: _event.data.message,
|
|
1461
|
+
stack: _event.data.stack
|
|
1462
|
+
}), "error")
|
|
1463
|
+
})
|
|
1542
1464
|
}
|
|
1543
|
-
}
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1465
|
+
}
|
|
1466
|
+
},
|
|
1467
|
+
[FirstPartyMachineStateTypes.selectCredentials]: {
|
|
1468
|
+
id: FirstPartyMachineStateTypes.selectCredentials,
|
|
1469
|
+
on: {
|
|
1470
|
+
[FirstPartyMachineEvents.SET_SELECTED_CREDENTIALS]: {
|
|
1471
|
+
actions: (0, import_xstate2.assign)({
|
|
1472
|
+
selectedCredentials: /* @__PURE__ */ __name((_ctx, _event) => _event.data, "selectedCredentials")
|
|
1473
|
+
})
|
|
1474
|
+
},
|
|
1475
|
+
[FirstPartyMachineEvents.NEXT]: {
|
|
1476
|
+
target: FirstPartyMachineStateTypes.sendAuthorizationResponse
|
|
1477
|
+
},
|
|
1478
|
+
[FirstPartyMachineEvents.DECLINE]: {
|
|
1479
|
+
target: FirstPartyMachineStateTypes.declined
|
|
1480
|
+
},
|
|
1481
|
+
[FirstPartyMachineEvents.PREVIOUS]: {
|
|
1482
|
+
target: FirstPartyMachineStateTypes.aborted
|
|
1547
1483
|
}
|
|
1548
1484
|
}
|
|
1549
|
-
}
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
const claims = claimsMetadata.get(locale);
|
|
1560
|
-
return {
|
|
1561
|
-
...display && await sdJwtCredentialLocaleBrandingFrom({
|
|
1562
|
-
credentialDisplay: display
|
|
1563
|
-
}),
|
|
1564
|
-
...locale.length > 0 && {
|
|
1565
|
-
locale
|
|
1485
|
+
},
|
|
1486
|
+
[FirstPartyMachineStateTypes.sendAuthorizationResponse]: {
|
|
1487
|
+
id: FirstPartyMachineStateTypes.sendAuthorizationResponse,
|
|
1488
|
+
invoke: {
|
|
1489
|
+
src: FirstPartyMachineServices.sendAuthorizationResponse,
|
|
1490
|
+
onDone: {
|
|
1491
|
+
target: FirstPartyMachineStateTypes.sendAuthorizationChallengeRequest,
|
|
1492
|
+
actions: (0, import_xstate2.assign)({
|
|
1493
|
+
presentationDuringIssuanceSession: /* @__PURE__ */ __name((_ctx, _event) => _event.data, "presentationDuringIssuanceSession")
|
|
1494
|
+
})
|
|
1566
1495
|
},
|
|
1567
|
-
|
|
1496
|
+
onError: {
|
|
1497
|
+
target: FirstPartyMachineStateTypes.error,
|
|
1498
|
+
actions: (0, import_xstate2.assign)({
|
|
1499
|
+
error: /* @__PURE__ */ __name((_ctx, _event) => ({
|
|
1500
|
+
title: translate("oid4vci_machine_get_request_error_title"),
|
|
1501
|
+
message: _event.data.message,
|
|
1502
|
+
stack: _event.data.stack
|
|
1503
|
+
}), "error")
|
|
1504
|
+
})
|
|
1505
|
+
}
|
|
1506
|
+
}
|
|
1507
|
+
},
|
|
1508
|
+
[FirstPartyMachineStateTypes.aborted]: {
|
|
1509
|
+
id: FirstPartyMachineStateTypes.aborted,
|
|
1510
|
+
type: "final"
|
|
1511
|
+
},
|
|
1512
|
+
[FirstPartyMachineStateTypes.declined]: {
|
|
1513
|
+
id: FirstPartyMachineStateTypes.declined,
|
|
1514
|
+
type: "final"
|
|
1515
|
+
},
|
|
1516
|
+
[FirstPartyMachineStateTypes.error]: {
|
|
1517
|
+
id: FirstPartyMachineStateTypes.error,
|
|
1518
|
+
type: "final"
|
|
1519
|
+
},
|
|
1520
|
+
[FirstPartyMachineStateTypes.done]: {
|
|
1521
|
+
id: FirstPartyMachineStateTypes.done,
|
|
1522
|
+
type: "final"
|
|
1523
|
+
}
|
|
1524
|
+
};
|
|
1525
|
+
var createFirstPartyActivationMachine = /* @__PURE__ */ __name((opts) => {
|
|
1526
|
+
const initialContext = {
|
|
1527
|
+
openID4VCIClientState: opts.openID4VCIClientState,
|
|
1528
|
+
contact: opts.contact,
|
|
1529
|
+
selectedCredentials: []
|
|
1530
|
+
};
|
|
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: {}
|
|
1540
|
+
}
|
|
1541
|
+
});
|
|
1542
|
+
}, "createFirstPartyActivationMachine");
|
|
1543
|
+
var FirstPartyMachine = class _FirstPartyMachine {
|
|
1544
|
+
static {
|
|
1545
|
+
__name(this, "FirstPartyMachine");
|
|
1546
|
+
}
|
|
1547
|
+
static _instance;
|
|
1548
|
+
static hasInstance() {
|
|
1549
|
+
return _FirstPartyMachine._instance !== void 0;
|
|
1550
|
+
}
|
|
1551
|
+
static get instance() {
|
|
1552
|
+
if (!_FirstPartyMachine._instance) {
|
|
1553
|
+
throw Error("Please initialize ESIMActivation machine first");
|
|
1554
|
+
}
|
|
1555
|
+
return _FirstPartyMachine._instance;
|
|
1556
|
+
}
|
|
1557
|
+
static clearInstance(opts) {
|
|
1558
|
+
const { stop } = opts;
|
|
1559
|
+
if (_FirstPartyMachine.hasInstance()) {
|
|
1560
|
+
if (stop) {
|
|
1561
|
+
_FirstPartyMachine.stopInstance();
|
|
1562
|
+
}
|
|
1563
|
+
}
|
|
1564
|
+
_FirstPartyMachine._instance = void 0;
|
|
1565
|
+
}
|
|
1566
|
+
static stopInstance() {
|
|
1567
|
+
if (!_FirstPartyMachine.hasInstance()) {
|
|
1568
|
+
return;
|
|
1569
|
+
}
|
|
1570
|
+
_FirstPartyMachine.instance.stop();
|
|
1571
|
+
_FirstPartyMachine._instance = void 0;
|
|
1572
|
+
}
|
|
1573
|
+
static newInstance(opts) {
|
|
1574
|
+
const { agentContext } = opts;
|
|
1575
|
+
const services = {
|
|
1576
|
+
[FirstPartyMachineServices.sendAuthorizationChallengeRequest]: sendAuthorizationChallengeRequest,
|
|
1577
|
+
[FirstPartyMachineServices.createConfig]: (args) => createConfig(args, agentContext),
|
|
1578
|
+
[FirstPartyMachineServices.getSiopRequest]: (args) => getSiopRequest(args, agentContext),
|
|
1579
|
+
[FirstPartyMachineServices.sendAuthorizationResponse]: (args) => sendAuthorizationResponse(args, agentContext)
|
|
1568
1580
|
};
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
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
|
|
1593
|
-
}
|
|
1581
|
+
const newInst = (0, import_xstate2.interpret)(createFirstPartyActivationMachine(opts).withConfig({
|
|
1582
|
+
services: {
|
|
1583
|
+
...services,
|
|
1584
|
+
...opts?.services
|
|
1585
|
+
},
|
|
1586
|
+
guards: {
|
|
1587
|
+
...opts?.guards
|
|
1594
1588
|
}
|
|
1595
|
-
}
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
}
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1589
|
+
}));
|
|
1590
|
+
if (typeof opts?.subscription === "function") {
|
|
1591
|
+
newInst.onTransition(opts.subscription);
|
|
1592
|
+
}
|
|
1593
|
+
if (opts?.requireCustomNavigationHook !== true) {
|
|
1594
|
+
newInst.onTransition((snapshot) => {
|
|
1595
|
+
if (opts?.stateNavigationListener) {
|
|
1596
|
+
void opts.stateNavigationListener(newInst, snapshot);
|
|
1597
|
+
}
|
|
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!`);
|
|
1602
1606
|
}
|
|
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
|
|
1607
|
+
_FirstPartyMachine._instance = _FirstPartyMachine.newInstance(opts);
|
|
1615
1608
|
}
|
|
1616
|
-
|
|
1617
|
-
}
|
|
1609
|
+
return _FirstPartyMachine._instance;
|
|
1610
|
+
}
|
|
1611
|
+
};
|
|
1618
1612
|
|
|
1619
1613
|
// src/services/OID4VCIHolderService.ts
|
|
1614
|
+
var import_ssi_sdk = require("@sphereon/ssi-sdk.core");
|
|
1620
1615
|
var getCredentialBranding = /* @__PURE__ */ __name(async (args) => {
|
|
1621
1616
|
const { credentialsSupported, context } = args;
|
|
1622
1617
|
const credentialBranding = {};
|
|
1623
1618
|
await Promise.all(Object.entries(credentialsSupported).map(async ([configId, credentialsConfigSupported]) => {
|
|
1624
1619
|
let sdJwtTypeMetadata;
|
|
1625
|
-
if (credentialsConfigSupported.format === "
|
|
1620
|
+
if (credentialsConfigSupported.format === "vc+sd-jwt") {
|
|
1626
1621
|
const vct = credentialsConfigSupported.vct;
|
|
1627
1622
|
if (vct.startsWith("http")) {
|
|
1628
1623
|
try {
|
|
@@ -1688,7 +1683,10 @@ var selectCredentialLocaleBranding = /* @__PURE__ */ __name(async (args) => {
|
|
|
1688
1683
|
}, "selectCredentialLocaleBranding");
|
|
1689
1684
|
var verifyCredentialToAccept = /* @__PURE__ */ __name(async (args) => {
|
|
1690
1685
|
const { mappedCredential, hasher, onVerifyEBSICredentialIssuer, schemaValidation, context } = args;
|
|
1691
|
-
const credential =
|
|
1686
|
+
const credential = mappedCredential.credentialToAccept.credentialResponse.credential;
|
|
1687
|
+
if (!credential) {
|
|
1688
|
+
return Promise.reject(Error("No credential found in credential response"));
|
|
1689
|
+
}
|
|
1692
1690
|
const wrappedVC = import_ssi_types.CredentialMapper.toWrappedVerifiableCredential(credential, {
|
|
1693
1691
|
hasher: hasher ?? import_ssi_sdk.defaultHasher
|
|
1694
1692
|
});
|
|
@@ -1740,7 +1738,11 @@ var verifyCredentialToAccept = /* @__PURE__ */ __name(async (args) => {
|
|
|
1740
1738
|
}, "verifyCredentialToAccept");
|
|
1741
1739
|
var mapCredentialToAccept = /* @__PURE__ */ __name(async (args) => {
|
|
1742
1740
|
const { credentialToAccept, hasher } = args;
|
|
1743
|
-
const
|
|
1741
|
+
const credentialResponse = credentialToAccept.credentialResponse;
|
|
1742
|
+
const verifiableCredential = credentialResponse.credential;
|
|
1743
|
+
if (!verifiableCredential) {
|
|
1744
|
+
return Promise.reject(Error("No credential found in credential response"));
|
|
1745
|
+
}
|
|
1744
1746
|
const wrappedVerifiableCredential = import_ssi_types.CredentialMapper.toWrappedVerifiableCredential(verifiableCredential, {
|
|
1745
1747
|
hasher
|
|
1746
1748
|
});
|
|
@@ -1760,7 +1762,6 @@ var mapCredentialToAccept = /* @__PURE__ */ __name(async (args) => {
|
|
|
1760
1762
|
uniformVerifiableCredential = wrappedVerifiableCredential.credential;
|
|
1761
1763
|
}
|
|
1762
1764
|
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;
|
|
1764
1765
|
return {
|
|
1765
1766
|
correlationId,
|
|
1766
1767
|
credentialToAccept,
|
|
@@ -1772,18 +1773,6 @@ var mapCredentialToAccept = /* @__PURE__ */ __name(async (args) => {
|
|
|
1772
1773
|
}
|
|
1773
1774
|
};
|
|
1774
1775
|
}, "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");
|
|
1787
1776
|
var getIdentifierOpts = /* @__PURE__ */ __name(async (args) => {
|
|
1788
1777
|
const { issuanceOpt, context } = args;
|
|
1789
1778
|
const { identifier: identifierArg } = issuanceOpt;
|
|
@@ -1892,19 +1881,24 @@ var getCredentialConfigsSupportedBySingleTypeOrId = /* @__PURE__ */ __name(async
|
|
|
1892
1881
|
}
|
|
1893
1882
|
__name(createIdFromTypes, "createIdFromTypes");
|
|
1894
1883
|
if (configurationId) {
|
|
1895
|
-
const allSupported2 = client.getCredentialsSupported(
|
|
1884
|
+
const allSupported2 = client.getCredentialsSupported(false);
|
|
1896
1885
|
return Object.fromEntries(Object.entries(allSupported2).filter(([id, supported]) => id === configurationId || supported.id === configurationId || createIdFromTypes(supported) === configurationId));
|
|
1897
1886
|
}
|
|
1898
|
-
if (!client.credentialOffer) {
|
|
1899
|
-
return Promise.reject(Error("openID4VCIClient has no credentialOffer"));
|
|
1887
|
+
if (!types && !client.credentialOffer) {
|
|
1888
|
+
return Promise.reject(Error("openID4VCIClient has no credentialOffer and no types where provided"));
|
|
1900
1889
|
}
|
|
1901
|
-
if (!
|
|
1902
|
-
|
|
1890
|
+
if (!Array.isArray(format) && client.credentialOffer) {
|
|
1891
|
+
if (client.version() > import_oid4vci_common3.OpenId4VCIVersion.VER_1_0_09 && typeof client.credentialOffer.credential_offer === "object" && "credentials" in client.credentialOffer.credential_offer) {
|
|
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
|
+
}
|
|
1903
1897
|
}
|
|
1904
1898
|
const offerSupported = (0, import_oid4vci_common3.getSupportedCredentials)({
|
|
1905
|
-
types: [
|
|
1899
|
+
types: types ? [
|
|
1906
1900
|
types
|
|
1907
|
-
],
|
|
1901
|
+
] : client.getCredentialOfferTypes(),
|
|
1908
1902
|
format,
|
|
1909
1903
|
version: client.version(),
|
|
1910
1904
|
issuerMetadata: client.endpointMetadata.credentialIssuerMetadata
|
|
@@ -2079,8 +2073,7 @@ var getIssuanceCryptoSuite = /* @__PURE__ */ __name(async (opts) => {
|
|
|
2079
2073
|
case "jwt":
|
|
2080
2074
|
case "jwt_vc_json":
|
|
2081
2075
|
case "jwt_vc":
|
|
2082
|
-
|
|
2083
|
-
case "dc+sd-jwt":
|
|
2076
|
+
case "vc+sd-jwt":
|
|
2084
2077
|
case "mso_mdoc": {
|
|
2085
2078
|
const supportedPreferences = jwtCryptographicSuitePreferences.filter((suite) => signing_algs_supported.includes(suite));
|
|
2086
2079
|
if (supportedPreferences.length > 0) {
|
|
@@ -2148,6 +2141,8 @@ var startFirstPartApplicationMachine = /* @__PURE__ */ __name(async (args, conte
|
|
|
2148
2141
|
}, "startFirstPartApplicationMachine");
|
|
2149
2142
|
|
|
2150
2143
|
// src/agent/OID4VCIHolder.ts
|
|
2144
|
+
var import_polyfill = require("cross-fetch/polyfill");
|
|
2145
|
+
var import_ssi_sdk3 = require("@sphereon/ssi-sdk.core");
|
|
2151
2146
|
var oid4vciHolderContextMethods = [
|
|
2152
2147
|
"cmGetContacts",
|
|
2153
2148
|
"cmGetContact",
|
|
@@ -2163,7 +2158,7 @@ var oid4vciHolderContextMethods = [
|
|
|
2163
2158
|
];
|
|
2164
2159
|
var logger = import_ssi_types2.Loggers.DEFAULT.get("sphereon:oid4vci:holder");
|
|
2165
2160
|
function signCallback(identifier, context, nonce) {
|
|
2166
|
-
return async (jwt, kid
|
|
2161
|
+
return async (jwt, kid) => {
|
|
2167
2162
|
let resolution = await context.agent.identifierManagedGet(identifier);
|
|
2168
2163
|
const jwk = jwt.header.jwk ?? (resolution.method === "jwk" ? resolution.jwk : void 0);
|
|
2169
2164
|
if (!resolution.issuer && !jwt.payload.iss) {
|
|
@@ -2181,7 +2176,7 @@ function signCallback(identifier, context, nonce) {
|
|
|
2181
2176
|
return (await context.agent.jwtCreateJwsCompactSignature({
|
|
2182
2177
|
issuer: {
|
|
2183
2178
|
...resolution,
|
|
2184
|
-
noIssPayloadUpdate:
|
|
2179
|
+
noIssPayloadUpdate: false
|
|
2185
2180
|
},
|
|
2186
2181
|
protectedHeader: header,
|
|
2187
2182
|
payload
|
|
@@ -2216,7 +2211,6 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2216
2211
|
oid4vciHolderStoreIssuerBranding: this.oid4vciHolderStoreIssuerBranding.bind(this)
|
|
2217
2212
|
};
|
|
2218
2213
|
vcFormatPreferences = [
|
|
2219
|
-
"dc+sd-jwt",
|
|
2220
2214
|
"vc+sd-jwt",
|
|
2221
2215
|
"mso_mdoc",
|
|
2222
2216
|
"jwt_vc_json",
|
|
@@ -2250,7 +2244,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2250
2244
|
onIdentifierCreated;
|
|
2251
2245
|
onVerifyEBSICredentialIssuer;
|
|
2252
2246
|
constructor(options) {
|
|
2253
|
-
const { onContactIdentityCreated, onCredentialStored, onIdentifierCreated, onVerifyEBSICredentialIssuer, vcFormatPreferences, jsonldCryptographicSuitePreferences, didMethodPreferences, jwtCryptographicSuitePreferences, defaultAuthorizationRequestOptions, hasher =
|
|
2247
|
+
const { onContactIdentityCreated, onCredentialStored, onIdentifierCreated, onVerifyEBSICredentialIssuer, vcFormatPreferences, jsonldCryptographicSuitePreferences, didMethodPreferences, jwtCryptographicSuitePreferences, defaultAuthorizationRequestOptions, hasher = import_ssi_sdk3.defaultHasher } = {
|
|
2254
2248
|
...options
|
|
2255
2249
|
};
|
|
2256
2250
|
this.hasher = hasher;
|
|
@@ -2368,6 +2362,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2368
2362
|
formats = Array.from(new Set(authFormats));
|
|
2369
2363
|
}
|
|
2370
2364
|
let oid4vciClient;
|
|
2365
|
+
let types = void 0;
|
|
2371
2366
|
let offer;
|
|
2372
2367
|
if (requestData.existingClientState) {
|
|
2373
2368
|
oid4vciClient = await import_oid4vci_client3.OpenID4VCIClient.fromState({
|
|
@@ -2403,18 +2398,17 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2403
2398
|
});
|
|
2404
2399
|
}
|
|
2405
2400
|
}
|
|
2406
|
-
let configurationIds = [];
|
|
2407
2401
|
if (offer) {
|
|
2408
|
-
|
|
2402
|
+
types = (0, import_oid4vci_common4.getTypesFromCredentialOffer)(offer.original_credential_offer);
|
|
2409
2403
|
} else {
|
|
2410
|
-
|
|
2404
|
+
types = (0, import_utils2.asArray)(authorizationRequestOpts.authorizationDetails).map((authReqOpts) => (0, import_oid4vci_common4.getTypesFromAuthorizationDetails)(authReqOpts) ?? []).filter((inner) => inner.length > 0);
|
|
2411
2405
|
}
|
|
2406
|
+
const serverMetadata = await oid4vciClient.retrieveServerMetadata();
|
|
2412
2407
|
const credentialsSupported = await getCredentialConfigsSupportedMerged({
|
|
2413
2408
|
client: oid4vciClient,
|
|
2414
2409
|
vcFormatPreferences: formats,
|
|
2415
|
-
|
|
2410
|
+
types
|
|
2416
2411
|
});
|
|
2417
|
-
const serverMetadata = await oid4vciClient.retrieveServerMetadata();
|
|
2418
2412
|
const credentialBranding = await getCredentialBranding({
|
|
2419
2413
|
credentialsSupported,
|
|
2420
2414
|
context
|
|
@@ -2631,26 +2625,26 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2631
2625
|
return Promise.reject(Error("Missing credential offers in context"));
|
|
2632
2626
|
}
|
|
2633
2627
|
let correlationId = credentialsToAccept[0].correlationId;
|
|
2634
|
-
let identifierType =
|
|
2628
|
+
let identifierType = import_ssi_sdk2.CorrelationIdentifierType.DID;
|
|
2635
2629
|
if (!correlationId.toLowerCase().startsWith("did:")) {
|
|
2636
|
-
identifierType =
|
|
2630
|
+
identifierType = import_ssi_sdk2.CorrelationIdentifierType.URL;
|
|
2637
2631
|
if (correlationId.startsWith("http")) {
|
|
2638
2632
|
correlationId = new URL(correlationId).hostname;
|
|
2639
2633
|
}
|
|
2640
2634
|
}
|
|
2641
2635
|
const identity = {
|
|
2642
2636
|
alias: credentialsToAccept[0].correlationId,
|
|
2643
|
-
origin:
|
|
2637
|
+
origin: import_ssi_sdk2.IdentityOrigin.EXTERNAL,
|
|
2644
2638
|
roles: [
|
|
2645
|
-
|
|
2639
|
+
import_ssi_sdk2.CredentialRole.ISSUER
|
|
2646
2640
|
],
|
|
2647
2641
|
identifier: {
|
|
2648
2642
|
type: identifierType,
|
|
2649
2643
|
correlationId
|
|
2650
2644
|
},
|
|
2651
|
-
...identifierType ===
|
|
2645
|
+
...identifierType === import_ssi_sdk2.CorrelationIdentifierType.URL && {
|
|
2652
2646
|
connection: {
|
|
2653
|
-
type:
|
|
2647
|
+
type: import_ssi_sdk2.ConnectionType.OPENID_CONNECT,
|
|
2654
2648
|
config: {
|
|
2655
2649
|
clientId: "138d7bf8-c930-4c6e-b928-97d3a4928b01",
|
|
2656
2650
|
clientSecret: "03b3955f-d020-4f2a-8a27-4e452d4e27a0",
|
|
@@ -2677,7 +2671,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2677
2671
|
}
|
|
2678
2672
|
async oid4vciHolderGetIssuerBranding(args, context) {
|
|
2679
2673
|
const { serverMetadata, contact } = args;
|
|
2680
|
-
const issuerCorrelationId = contact?.identities.filter((identity) => identity.roles.includes(
|
|
2674
|
+
const issuerCorrelationId = contact?.identities.filter((identity) => identity.roles.includes(import_ssi_sdk2.CredentialRole.ISSUER)).map((identity) => identity.identifier.correlationId)[0];
|
|
2681
2675
|
if (issuerCorrelationId) {
|
|
2682
2676
|
const branding = await context.agent.ibGetIssuerBranding({
|
|
2683
2677
|
filter: [
|
|
@@ -2707,7 +2701,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2707
2701
|
if (!contact) {
|
|
2708
2702
|
return Promise.reject(Error("Missing contact in context"));
|
|
2709
2703
|
}
|
|
2710
|
-
const issuerCorrelationId = contact?.identities.filter((identity) => identity.roles.includes(
|
|
2704
|
+
const issuerCorrelationId = contact?.identities.filter((identity) => identity.roles.includes(import_ssi_sdk2.CredentialRole.ISSUER)).map((identity) => identity.identifier.correlationId)[0];
|
|
2711
2705
|
const branding = await context.agent.ibGetIssuerBranding({
|
|
2712
2706
|
filter: [
|
|
2713
2707
|
{
|
|
@@ -2803,9 +2797,9 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2803
2797
|
if (Array.isArray(subjectIssuance?.notification_events_supported)) {
|
|
2804
2798
|
event = subjectIssuance.notification_events_supported.includes("credential_accepted_holder_signed") ? "credential_accepted_holder_signed" : "credential_deleted_holder_signed";
|
|
2805
2799
|
logger.log(`Subject issuance/signing will be used, with event`, event);
|
|
2806
|
-
const issuerVC =
|
|
2800
|
+
const issuerVC = mappedCredentialToAccept.credentialToAccept.credentialResponse.credential;
|
|
2807
2801
|
const wrappedIssuerVC = import_ssi_types2.CredentialMapper.toWrappedVerifiableCredential(issuerVC, {
|
|
2808
|
-
hasher: this.hasher ??
|
|
2802
|
+
hasher: this.hasher ?? import_ssi_sdk3.defaultHasher
|
|
2809
2803
|
});
|
|
2810
2804
|
console.log(`Wrapped VC: ${wrappedIssuerVC.type}, ${wrappedIssuerVC.format}`);
|
|
2811
2805
|
let issuer;
|
|
@@ -2906,11 +2900,11 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2906
2900
|
const [subjectCorrelationType, subjectCorrelationId] = this.determineSubjectCorrelation(issuanceOpt.identifier, issuer);
|
|
2907
2901
|
const persistedCredential = await context.agent.crsAddCredential({
|
|
2908
2902
|
credential: {
|
|
2909
|
-
rawDocument: (0,
|
|
2903
|
+
rawDocument: (0, import_ssi_sdk2.ensureRawDocument)(persistCredential),
|
|
2910
2904
|
kmsKeyRef,
|
|
2911
2905
|
identifierMethod: method,
|
|
2912
|
-
credentialRole:
|
|
2913
|
-
issuerCorrelationType: issuer?.startsWith("did:") ?
|
|
2906
|
+
credentialRole: import_ssi_sdk2.CredentialRole.HOLDER,
|
|
2907
|
+
issuerCorrelationType: issuer?.startsWith("did:") ? import_ssi_sdk2.CredentialCorrelationType.DID : import_ssi_sdk2.CredentialCorrelationType.URL,
|
|
2914
2908
|
issuerCorrelationId: issuer,
|
|
2915
2909
|
subjectCorrelationType,
|
|
2916
2910
|
subjectCorrelationId
|
|
@@ -2978,12 +2972,12 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2978
2972
|
case "did":
|
|
2979
2973
|
if ((0, import_ssi_sdk_ext6.isManagedIdentifierResult)(identifier) && (0, import_ssi_sdk_ext6.isManagedIdentifierDidResult)(identifier)) {
|
|
2980
2974
|
return [
|
|
2981
|
-
|
|
2975
|
+
import_ssi_sdk2.CredentialCorrelationType.DID,
|
|
2982
2976
|
identifier.did
|
|
2983
2977
|
];
|
|
2984
2978
|
} else if ((0, import_ssi_sdk_ext6.isManagedIdentifierDidOpts)(identifier)) {
|
|
2985
2979
|
return [
|
|
2986
|
-
|
|
2980
|
+
import_ssi_sdk2.CredentialCorrelationType.DID,
|
|
2987
2981
|
typeof identifier.identifier === "string" ? identifier.identifier : identifier.identifier.did
|
|
2988
2982
|
];
|
|
2989
2983
|
}
|
|
@@ -2991,12 +2985,12 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2991
2985
|
case "kid":
|
|
2992
2986
|
if ((0, import_ssi_sdk_ext6.isManagedIdentifierResult)(identifier) && (0, import_ssi_sdk_ext6.isManagedIdentifierKidResult)(identifier)) {
|
|
2993
2987
|
return [
|
|
2994
|
-
|
|
2988
|
+
import_ssi_sdk2.CredentialCorrelationType.KID,
|
|
2995
2989
|
identifier.kid
|
|
2996
2990
|
];
|
|
2997
2991
|
} else if ((0, import_ssi_sdk_ext6.isManagedIdentifierDidOpts)(identifier)) {
|
|
2998
2992
|
return [
|
|
2999
|
-
|
|
2993
|
+
import_ssi_sdk2.CredentialCorrelationType.KID,
|
|
3000
2994
|
identifier.identifier
|
|
3001
2995
|
];
|
|
3002
2996
|
}
|
|
@@ -3004,19 +2998,19 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
3004
2998
|
case "x5c":
|
|
3005
2999
|
if ((0, import_ssi_sdk_ext6.isManagedIdentifierResult)(identifier) && (0, import_ssi_sdk_ext6.isManagedIdentifierX5cResult)(identifier)) {
|
|
3006
3000
|
return [
|
|
3007
|
-
|
|
3001
|
+
import_ssi_sdk2.CredentialCorrelationType.X509_SAN,
|
|
3008
3002
|
identifier.x5c.join("\r\n")
|
|
3009
3003
|
];
|
|
3010
3004
|
} else if ((0, import_ssi_sdk_ext6.isManagedIdentifierX5cOpts)(identifier)) {
|
|
3011
3005
|
return [
|
|
3012
|
-
|
|
3006
|
+
import_ssi_sdk2.CredentialCorrelationType.X509_SAN,
|
|
3013
3007
|
identifier.identifier.join("\r\n")
|
|
3014
3008
|
];
|
|
3015
3009
|
}
|
|
3016
3010
|
break;
|
|
3017
3011
|
}
|
|
3018
3012
|
return [
|
|
3019
|
-
|
|
3013
|
+
import_ssi_sdk2.CredentialCorrelationType.URL,
|
|
3020
3014
|
issuer
|
|
3021
3015
|
];
|
|
3022
3016
|
}
|
|
@@ -3075,9 +3069,9 @@ var OID4VCICallbackStateListener = /* @__PURE__ */ __name((callbacks) => {
|
|
|
3075
3069
|
// src/link-handler/index.ts
|
|
3076
3070
|
var import_oid4vci_client4 = require("@sphereon/oid4vci-client");
|
|
3077
3071
|
var import_oid4vci_common5 = require("@sphereon/oid4vci-common");
|
|
3078
|
-
var
|
|
3079
|
-
var
|
|
3080
|
-
var OID4VCIHolderLinkHandler = class extends
|
|
3072
|
+
var import_ssi_sdk4 = require("@sphereon/ssi-sdk.core");
|
|
3073
|
+
var import_ssi_sdk5 = require("@sphereon/ssi-sdk.xstate-machine-persistence");
|
|
3074
|
+
var OID4VCIHolderLinkHandler = class extends import_ssi_sdk4.LinkHandlerAdapter {
|
|
3081
3075
|
static {
|
|
3082
3076
|
__name(this, "OID4VCIHolderLinkHandler");
|
|
3083
3077
|
}
|
|
@@ -3137,7 +3131,7 @@ var OID4VCIHolderLinkHandler = class extends import_ssi_sdk5.LinkHandlerAdapter
|
|
|
3137
3131
|
const interpreter = oid4vciMachine.interpreter;
|
|
3138
3132
|
if (!opts?.machineState && this.context.agent.availableMethods().includes("machineStatesFindActive")) {
|
|
3139
3133
|
const stateType = hasCode ? "existing" : "new";
|
|
3140
|
-
await (0,
|
|
3134
|
+
await (0, import_ssi_sdk5.interpreterStartOrResume)({
|
|
3141
3135
|
stateType,
|
|
3142
3136
|
interpreter,
|
|
3143
3137
|
context: this.context,
|