@sphereon/ssi-sdk.oid4vci-holder 0.34.1-feat.SSISDK.35.63 → 0.34.1-feature.DIIPv4.29
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 +54 -77
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -6
- package/dist/index.d.ts +3 -6
- package/dist/index.js +33 -56
- package/dist/index.js.map +1 -1
- package/package.json +24 -25
- package/src/agent/OID4VCIHolder.ts +21 -35
- package/src/services/OID4VCIHolderService.ts +5 -27
- package/src/types/FirstPartyMachine.ts +0 -2
- package/src/types/IOID4VCIHolder.ts +1 -3
package/dist/index.cjs
CHANGED
|
@@ -139,8 +139,7 @@ var import_oid4vci_common4 = require("@sphereon/oid4vci-common");
|
|
|
139
139
|
var import_ssi_sdk_ext5 = require("@sphereon/ssi-sdk-ext.did-utils");
|
|
140
140
|
var import_ssi_sdk_ext6 = require("@sphereon/ssi-sdk-ext.identifier-resolution");
|
|
141
141
|
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_sdk3 = require("@sphereon/ssi-sdk.data-store");
|
|
142
|
+
var import_ssi_sdk2 = require("@sphereon/ssi-sdk.data-store");
|
|
144
143
|
var import_ssi_types2 = require("@sphereon/ssi-types");
|
|
145
144
|
var import_utils2 = require("@veramo/utils");
|
|
146
145
|
var import_did_jwt = require("did-jwt");
|
|
@@ -155,18 +154,18 @@ var import_i18n_js = __toESM(require("i18n-js"), 1);
|
|
|
155
154
|
var import_lodash = __toESM(require("lodash.memoize"), 1);
|
|
156
155
|
|
|
157
156
|
// src/types/IOID4VCIHolder.ts
|
|
158
|
-
var OID4VCIHolderEvent = /* @__PURE__ */
|
|
157
|
+
var OID4VCIHolderEvent = /* @__PURE__ */ function(OID4VCIHolderEvent2) {
|
|
159
158
|
OID4VCIHolderEvent2["CONTACT_IDENTITY_CREATED"] = "contact_identity_created";
|
|
160
159
|
OID4VCIHolderEvent2["CREDENTIAL_STORED"] = "credential_stored";
|
|
161
160
|
OID4VCIHolderEvent2["IDENTIFIER_CREATED"] = "identifier_created";
|
|
162
161
|
return OID4VCIHolderEvent2;
|
|
163
|
-
}
|
|
164
|
-
var SupportedLanguage = /* @__PURE__ */
|
|
162
|
+
}({});
|
|
163
|
+
var SupportedLanguage = /* @__PURE__ */ function(SupportedLanguage2) {
|
|
165
164
|
SupportedLanguage2["ENGLISH"] = "en";
|
|
166
165
|
SupportedLanguage2["DUTCH"] = "nl";
|
|
167
166
|
return SupportedLanguage2;
|
|
168
|
-
}
|
|
169
|
-
var OID4VCIMachineStates = /* @__PURE__ */
|
|
167
|
+
}({});
|
|
168
|
+
var OID4VCIMachineStates = /* @__PURE__ */ function(OID4VCIMachineStates2) {
|
|
170
169
|
OID4VCIMachineStates2["start"] = "start";
|
|
171
170
|
OID4VCIMachineStates2["createCredentialsToSelectFrom"] = "createCredentialsToSelectFrom";
|
|
172
171
|
OID4VCIMachineStates2["getContact"] = "getContact";
|
|
@@ -197,18 +196,18 @@ var OID4VCIMachineStates = /* @__PURE__ */ (function(OID4VCIMachineStates2) {
|
|
|
197
196
|
OID4VCIMachineStates2["error"] = "error";
|
|
198
197
|
OID4VCIMachineStates2["done"] = "done";
|
|
199
198
|
return OID4VCIMachineStates2;
|
|
200
|
-
}
|
|
201
|
-
var OID4VCIMachineAddContactStates = /* @__PURE__ */
|
|
199
|
+
}({});
|
|
200
|
+
var OID4VCIMachineAddContactStates = /* @__PURE__ */ function(OID4VCIMachineAddContactStates2) {
|
|
202
201
|
OID4VCIMachineAddContactStates2["idle"] = "idle";
|
|
203
202
|
OID4VCIMachineAddContactStates2["next"] = "next";
|
|
204
203
|
return OID4VCIMachineAddContactStates2;
|
|
205
|
-
}
|
|
206
|
-
var OID4VCIMachineVerifyPinStates = /* @__PURE__ */
|
|
204
|
+
}({});
|
|
205
|
+
var OID4VCIMachineVerifyPinStates = /* @__PURE__ */ function(OID4VCIMachineVerifyPinStates2) {
|
|
207
206
|
OID4VCIMachineVerifyPinStates2["idle"] = "idle";
|
|
208
207
|
OID4VCIMachineVerifyPinStates2["next"] = "next";
|
|
209
208
|
return OID4VCIMachineVerifyPinStates2;
|
|
210
|
-
}
|
|
211
|
-
var OID4VCIMachineEvents = /* @__PURE__ */
|
|
209
|
+
}({});
|
|
210
|
+
var OID4VCIMachineEvents = /* @__PURE__ */ function(OID4VCIMachineEvents2) {
|
|
212
211
|
OID4VCIMachineEvents2["NEXT"] = "NEXT";
|
|
213
212
|
OID4VCIMachineEvents2["PREVIOUS"] = "PREVIOUS";
|
|
214
213
|
OID4VCIMachineEvents2["DECLINE"] = "DECLINE";
|
|
@@ -221,15 +220,14 @@ var OID4VCIMachineEvents = /* @__PURE__ */ (function(OID4VCIMachineEvents2) {
|
|
|
221
220
|
OID4VCIMachineEvents2["INVOKED_AUTHORIZATION_CODE_REQUEST"] = "INVOKED_AUTHORIZATION_CODE_REQUEST";
|
|
222
221
|
OID4VCIMachineEvents2["PROVIDE_AUTHORIZATION_CODE_RESPONSE"] = "PROVIDE_AUTHORIZATION_CODE_RESPONSE";
|
|
223
222
|
return OID4VCIMachineEvents2;
|
|
224
|
-
}
|
|
225
|
-
var OID4VCIMachineGuards = /* @__PURE__ */
|
|
223
|
+
}({});
|
|
224
|
+
var OID4VCIMachineGuards = /* @__PURE__ */ function(OID4VCIMachineGuards2) {
|
|
226
225
|
OID4VCIMachineGuards2["hasContactGuard"] = "oid4vciHasContactGuard";
|
|
227
226
|
OID4VCIMachineGuards2["hasNoContactGuard"] = "oid4vciHasNoContactGuard";
|
|
228
227
|
OID4VCIMachineGuards2["credentialsToSelectRequiredGuard"] = "oid4vciCredentialsToSelectRequiredGuard";
|
|
229
228
|
OID4VCIMachineGuards2["requirePinGuard"] = "oid4vciRequirePinGuard";
|
|
230
229
|
OID4VCIMachineGuards2["requireAuthorizationGuard"] = "oid4vciRequireAuthorizationGuard";
|
|
231
230
|
OID4VCIMachineGuards2["noAuthorizationGuard"] = "oid4vciNoAuthorizationGuard";
|
|
232
|
-
OID4VCIMachineGuards2["hasNonceEndpointGuard"] = "oid4vciHasNonceEndpointGuard ";
|
|
233
231
|
OID4VCIMachineGuards2["hasAuthorizationResponse"] = "oid4vciHasAuthorizationResponse";
|
|
234
232
|
OID4VCIMachineGuards2["hasNoContactIdentityGuard"] = "oid4vciHasNoContactIdentityGuard";
|
|
235
233
|
OID4VCIMachineGuards2["verificationCodeGuard"] = "oid4vciVerificationCodeGuard";
|
|
@@ -239,8 +237,8 @@ var OID4VCIMachineGuards = /* @__PURE__ */ (function(OID4VCIMachineGuards2) {
|
|
|
239
237
|
OID4VCIMachineGuards2["contactHasLowTrustGuard"] = "oid4vciContactHasLowTrustGuard";
|
|
240
238
|
OID4VCIMachineGuards2["isFirstPartyApplication"] = "oid4vciIsFirstPartyApplication";
|
|
241
239
|
return OID4VCIMachineGuards2;
|
|
242
|
-
}
|
|
243
|
-
var OID4VCIMachineServices = /* @__PURE__ */
|
|
240
|
+
}({});
|
|
241
|
+
var OID4VCIMachineServices = /* @__PURE__ */ function(OID4VCIMachineServices2) {
|
|
244
242
|
OID4VCIMachineServices2["start"] = "start";
|
|
245
243
|
OID4VCIMachineServices2["getContact"] = "getContact";
|
|
246
244
|
OID4VCIMachineServices2["getFederationTrust"] = "getFederationTrust";
|
|
@@ -255,17 +253,17 @@ var OID4VCIMachineServices = /* @__PURE__ */ (function(OID4VCIMachineServices2)
|
|
|
255
253
|
OID4VCIMachineServices2["storeCredentials"] = "storeCredentials";
|
|
256
254
|
OID4VCIMachineServices2["startFirstPartApplicationFlow"] = "startFirstPartApplicationFlow";
|
|
257
255
|
return OID4VCIMachineServices2;
|
|
258
|
-
}
|
|
259
|
-
var RequestType = /* @__PURE__ */
|
|
256
|
+
}({});
|
|
257
|
+
var RequestType = /* @__PURE__ */ function(RequestType2) {
|
|
260
258
|
RequestType2["OPENID_INITIATE_ISSUANCE"] = "openid-initiate-issuance";
|
|
261
259
|
RequestType2["OPENID_CREDENTIAL_OFFER"] = "openid-credential-offer";
|
|
262
260
|
RequestType2["URL"] = "URL";
|
|
263
261
|
return RequestType2;
|
|
264
|
-
}
|
|
265
|
-
var IdentifierAliasEnum = /* @__PURE__ */
|
|
262
|
+
}({});
|
|
263
|
+
var IdentifierAliasEnum = /* @__PURE__ */ function(IdentifierAliasEnum2) {
|
|
266
264
|
IdentifierAliasEnum2["PRIMARY"] = "primary";
|
|
267
265
|
return IdentifierAliasEnum2;
|
|
268
|
-
}
|
|
266
|
+
}({});
|
|
269
267
|
|
|
270
268
|
// src/localization/Localization.ts
|
|
271
269
|
var Localization = class Localization2 {
|
|
@@ -307,7 +305,7 @@ var Localization = class Localization2 {
|
|
|
307
305
|
var translate = Localization.translate;
|
|
308
306
|
|
|
309
307
|
// src/types/FirstPartyMachine.ts
|
|
310
|
-
var FirstPartyMachineStateTypes = /* @__PURE__ */
|
|
308
|
+
var FirstPartyMachineStateTypes = /* @__PURE__ */ function(FirstPartyMachineStateTypes2) {
|
|
311
309
|
FirstPartyMachineStateTypes2["sendAuthorizationChallengeRequest"] = "sendAuthorizationChallengeRequest";
|
|
312
310
|
FirstPartyMachineStateTypes2["sendAuthorizationResponse"] = "sendAuthorizationResponse";
|
|
313
311
|
FirstPartyMachineStateTypes2["selectCredentials"] = "selectCredentials";
|
|
@@ -318,21 +316,21 @@ var FirstPartyMachineStateTypes = /* @__PURE__ */ (function(FirstPartyMachineSta
|
|
|
318
316
|
FirstPartyMachineStateTypes2["aborted"] = "aborted";
|
|
319
317
|
FirstPartyMachineStateTypes2["declined"] = "declined";
|
|
320
318
|
return FirstPartyMachineStateTypes2;
|
|
321
|
-
}
|
|
322
|
-
var FirstPartyMachineServices = /* @__PURE__ */
|
|
319
|
+
}({});
|
|
320
|
+
var FirstPartyMachineServices = /* @__PURE__ */ function(FirstPartyMachineServices2) {
|
|
323
321
|
FirstPartyMachineServices2["sendAuthorizationChallengeRequest"] = "sendAuthorizationChallengeRequest";
|
|
324
322
|
FirstPartyMachineServices2["sendAuthorizationResponse"] = "sendAuthorizationResponse";
|
|
325
323
|
FirstPartyMachineServices2["createConfig"] = "createConfig";
|
|
326
324
|
FirstPartyMachineServices2["getSiopRequest"] = "getSiopRequest";
|
|
327
325
|
return FirstPartyMachineServices2;
|
|
328
|
-
}
|
|
329
|
-
var FirstPartyMachineEvents = /* @__PURE__ */
|
|
326
|
+
}({});
|
|
327
|
+
var FirstPartyMachineEvents = /* @__PURE__ */ function(FirstPartyMachineEvents2) {
|
|
330
328
|
FirstPartyMachineEvents2["NEXT"] = "NEXT";
|
|
331
329
|
FirstPartyMachineEvents2["PREVIOUS"] = "PREVIOUS";
|
|
332
330
|
FirstPartyMachineEvents2["DECLINE"] = "DECLINE";
|
|
333
331
|
FirstPartyMachineEvents2["SET_SELECTED_CREDENTIALS"] = "SET_SELECTED_CREDENTIALS";
|
|
334
332
|
return FirstPartyMachineEvents2;
|
|
335
|
-
}
|
|
333
|
+
}({});
|
|
336
334
|
|
|
337
335
|
// src/machines/oid4vciMachine.ts
|
|
338
336
|
var oid4vciHasNoContactGuard = /* @__PURE__ */ __name((_ctx, _event) => {
|
|
@@ -1619,7 +1617,7 @@ var getCredentialBranding = /* @__PURE__ */ __name(async (args) => {
|
|
|
1619
1617
|
const credentialBranding = {};
|
|
1620
1618
|
await Promise.all(Object.entries(credentialsSupported).map(async ([configId, credentialsConfigSupported]) => {
|
|
1621
1619
|
let sdJwtTypeMetadata;
|
|
1622
|
-
if (credentialsConfigSupported.format === "
|
|
1620
|
+
if (credentialsConfigSupported.format === "vc+sd-jwt") {
|
|
1623
1621
|
const vct = credentialsConfigSupported.vct;
|
|
1624
1622
|
if (vct.startsWith("http")) {
|
|
1625
1623
|
try {
|
|
@@ -1685,13 +1683,7 @@ var selectCredentialLocaleBranding = /* @__PURE__ */ __name(async (args) => {
|
|
|
1685
1683
|
}, "selectCredentialLocaleBranding");
|
|
1686
1684
|
var verifyCredentialToAccept = /* @__PURE__ */ __name(async (args) => {
|
|
1687
1685
|
const { mappedCredential, hasher, onVerifyEBSICredentialIssuer, schemaValidation, context } = args;
|
|
1688
|
-
const
|
|
1689
|
-
let credential;
|
|
1690
|
-
if ("credential" in credentialResponse) {
|
|
1691
|
-
credential = credentialResponse.credential;
|
|
1692
|
-
} else if ("credentials" in credentialResponse && credentialResponse.credentials && Array.isArray(credentialResponse.credentials) && credentialResponse.credentials.length > 0) {
|
|
1693
|
-
credential = credentialResponse.credentials[0].credential;
|
|
1694
|
-
}
|
|
1686
|
+
const credential = mappedCredential.credentialToAccept.credentialResponse.credential;
|
|
1695
1687
|
if (!credential) {
|
|
1696
1688
|
return Promise.reject(Error("No credential found in credential response"));
|
|
1697
1689
|
}
|
|
@@ -1747,12 +1739,7 @@ var verifyCredentialToAccept = /* @__PURE__ */ __name(async (args) => {
|
|
|
1747
1739
|
var mapCredentialToAccept = /* @__PURE__ */ __name(async (args) => {
|
|
1748
1740
|
const { credentialToAccept, hasher } = args;
|
|
1749
1741
|
const credentialResponse = credentialToAccept.credentialResponse;
|
|
1750
|
-
|
|
1751
|
-
if ("credential" in credentialResponse) {
|
|
1752
|
-
verifiableCredential = credentialResponse.credential;
|
|
1753
|
-
} else if ("credentials" in credentialResponse && credentialResponse.credentials && Array.isArray(credentialResponse.credentials) && credentialResponse.credentials.length > 0) {
|
|
1754
|
-
verifiableCredential = credentialResponse.credentials[0].credential;
|
|
1755
|
-
}
|
|
1742
|
+
const verifiableCredential = credentialResponse.credential;
|
|
1756
1743
|
if (!verifiableCredential) {
|
|
1757
1744
|
return Promise.reject(Error("No credential found in credential response"));
|
|
1758
1745
|
}
|
|
@@ -2087,7 +2074,6 @@ var getIssuanceCryptoSuite = /* @__PURE__ */ __name(async (opts) => {
|
|
|
2087
2074
|
case "jwt_vc_json":
|
|
2088
2075
|
case "jwt_vc":
|
|
2089
2076
|
case "vc+sd-jwt":
|
|
2090
|
-
case "dc+sd-jwt":
|
|
2091
2077
|
case "mso_mdoc": {
|
|
2092
2078
|
const supportedPreferences = jwtCryptographicSuitePreferences.filter((suite) => signing_algs_supported.includes(suite));
|
|
2093
2079
|
if (supportedPreferences.length > 0) {
|
|
@@ -2156,6 +2142,7 @@ var startFirstPartApplicationMachine = /* @__PURE__ */ __name(async (args, conte
|
|
|
2156
2142
|
|
|
2157
2143
|
// src/agent/OID4VCIHolder.ts
|
|
2158
2144
|
var import_polyfill = require("cross-fetch/polyfill");
|
|
2145
|
+
var import_ssi_sdk3 = require("@sphereon/ssi-sdk.core");
|
|
2159
2146
|
var oid4vciHolderContextMethods = [
|
|
2160
2147
|
"cmGetContacts",
|
|
2161
2148
|
"cmGetContact",
|
|
@@ -2171,7 +2158,7 @@ var oid4vciHolderContextMethods = [
|
|
|
2171
2158
|
];
|
|
2172
2159
|
var logger = import_ssi_types2.Loggers.DEFAULT.get("sphereon:oid4vci:holder");
|
|
2173
2160
|
function signCallback(identifier, context, nonce) {
|
|
2174
|
-
return async (jwt, kid
|
|
2161
|
+
return async (jwt, kid) => {
|
|
2175
2162
|
let resolution = await context.agent.identifierManagedGet(identifier);
|
|
2176
2163
|
const jwk = jwt.header.jwk ?? (resolution.method === "jwk" ? resolution.jwk : void 0);
|
|
2177
2164
|
if (!resolution.issuer && !jwt.payload.iss) {
|
|
@@ -2189,7 +2176,7 @@ function signCallback(identifier, context, nonce) {
|
|
|
2189
2176
|
return (await context.agent.jwtCreateJwsCompactSignature({
|
|
2190
2177
|
issuer: {
|
|
2191
2178
|
...resolution,
|
|
2192
|
-
noIssPayloadUpdate:
|
|
2179
|
+
noIssPayloadUpdate: false
|
|
2193
2180
|
},
|
|
2194
2181
|
protectedHeader: header,
|
|
2195
2182
|
payload
|
|
@@ -2224,7 +2211,6 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2224
2211
|
oid4vciHolderStoreIssuerBranding: this.oid4vciHolderStoreIssuerBranding.bind(this)
|
|
2225
2212
|
};
|
|
2226
2213
|
vcFormatPreferences = [
|
|
2227
|
-
"dc+sd-jwt",
|
|
2228
2214
|
"vc+sd-jwt",
|
|
2229
2215
|
"mso_mdoc",
|
|
2230
2216
|
"jwt_vc_json",
|
|
@@ -2258,7 +2244,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2258
2244
|
onIdentifierCreated;
|
|
2259
2245
|
onVerifyEBSICredentialIssuer;
|
|
2260
2246
|
constructor(options) {
|
|
2261
|
-
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 } = {
|
|
2262
2248
|
...options
|
|
2263
2249
|
};
|
|
2264
2250
|
this.hasher = hasher;
|
|
@@ -2639,26 +2625,26 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2639
2625
|
return Promise.reject(Error("Missing credential offers in context"));
|
|
2640
2626
|
}
|
|
2641
2627
|
let correlationId = credentialsToAccept[0].correlationId;
|
|
2642
|
-
let identifierType =
|
|
2628
|
+
let identifierType = import_ssi_sdk2.CorrelationIdentifierType.DID;
|
|
2643
2629
|
if (!correlationId.toLowerCase().startsWith("did:")) {
|
|
2644
|
-
identifierType =
|
|
2630
|
+
identifierType = import_ssi_sdk2.CorrelationIdentifierType.URL;
|
|
2645
2631
|
if (correlationId.startsWith("http")) {
|
|
2646
2632
|
correlationId = new URL(correlationId).hostname;
|
|
2647
2633
|
}
|
|
2648
2634
|
}
|
|
2649
2635
|
const identity = {
|
|
2650
2636
|
alias: credentialsToAccept[0].correlationId,
|
|
2651
|
-
origin:
|
|
2637
|
+
origin: import_ssi_sdk2.IdentityOrigin.EXTERNAL,
|
|
2652
2638
|
roles: [
|
|
2653
|
-
|
|
2639
|
+
import_ssi_sdk2.CredentialRole.ISSUER
|
|
2654
2640
|
],
|
|
2655
2641
|
identifier: {
|
|
2656
2642
|
type: identifierType,
|
|
2657
2643
|
correlationId
|
|
2658
2644
|
},
|
|
2659
|
-
...identifierType ===
|
|
2645
|
+
...identifierType === import_ssi_sdk2.CorrelationIdentifierType.URL && {
|
|
2660
2646
|
connection: {
|
|
2661
|
-
type:
|
|
2647
|
+
type: import_ssi_sdk2.ConnectionType.OPENID_CONNECT,
|
|
2662
2648
|
config: {
|
|
2663
2649
|
clientId: "138d7bf8-c930-4c6e-b928-97d3a4928b01",
|
|
2664
2650
|
clientSecret: "03b3955f-d020-4f2a-8a27-4e452d4e27a0",
|
|
@@ -2685,7 +2671,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2685
2671
|
}
|
|
2686
2672
|
async oid4vciHolderGetIssuerBranding(args, context) {
|
|
2687
2673
|
const { serverMetadata, contact } = args;
|
|
2688
|
-
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];
|
|
2689
2675
|
if (issuerCorrelationId) {
|
|
2690
2676
|
const branding = await context.agent.ibGetIssuerBranding({
|
|
2691
2677
|
filter: [
|
|
@@ -2715,7 +2701,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2715
2701
|
if (!contact) {
|
|
2716
2702
|
return Promise.reject(Error("Missing contact in context"));
|
|
2717
2703
|
}
|
|
2718
|
-
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];
|
|
2719
2705
|
const branding = await context.agent.ibGetIssuerBranding({
|
|
2720
2706
|
filter: [
|
|
2721
2707
|
{
|
|
@@ -2811,18 +2797,9 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2811
2797
|
if (Array.isArray(subjectIssuance?.notification_events_supported)) {
|
|
2812
2798
|
event = subjectIssuance.notification_events_supported.includes("credential_accepted_holder_signed") ? "credential_accepted_holder_signed" : "credential_deleted_holder_signed";
|
|
2813
2799
|
logger.log(`Subject issuance/signing will be used, with event`, event);
|
|
2814
|
-
const
|
|
2815
|
-
let issuerVC;
|
|
2816
|
-
if ("credential" in credentialResponse) {
|
|
2817
|
-
issuerVC = credentialResponse.credential;
|
|
2818
|
-
} else if ("credentials" in credentialResponse && credentialResponse.credentials && Array.isArray(credentialResponse.credentials) && credentialResponse.credentials.length > 0) {
|
|
2819
|
-
issuerVC = credentialResponse.credentials[0].credential;
|
|
2820
|
-
}
|
|
2821
|
-
if (!issuerVC) {
|
|
2822
|
-
return Promise.reject(Error("No credential found in credential response"));
|
|
2823
|
-
}
|
|
2800
|
+
const issuerVC = mappedCredentialToAccept.credentialToAccept.credentialResponse.credential;
|
|
2824
2801
|
const wrappedIssuerVC = import_ssi_types2.CredentialMapper.toWrappedVerifiableCredential(issuerVC, {
|
|
2825
|
-
hasher: this.hasher ??
|
|
2802
|
+
hasher: this.hasher ?? import_ssi_sdk3.defaultHasher
|
|
2826
2803
|
});
|
|
2827
2804
|
console.log(`Wrapped VC: ${wrappedIssuerVC.type}, ${wrappedIssuerVC.format}`);
|
|
2828
2805
|
let issuer;
|
|
@@ -2923,11 +2900,11 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2923
2900
|
const [subjectCorrelationType, subjectCorrelationId] = this.determineSubjectCorrelation(issuanceOpt.identifier, issuer);
|
|
2924
2901
|
const persistedCredential = await context.agent.crsAddCredential({
|
|
2925
2902
|
credential: {
|
|
2926
|
-
rawDocument: (0,
|
|
2903
|
+
rawDocument: (0, import_ssi_sdk2.ensureRawDocument)(persistCredential),
|
|
2927
2904
|
kmsKeyRef,
|
|
2928
2905
|
identifierMethod: method,
|
|
2929
|
-
credentialRole:
|
|
2930
|
-
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,
|
|
2931
2908
|
issuerCorrelationId: issuer,
|
|
2932
2909
|
subjectCorrelationType,
|
|
2933
2910
|
subjectCorrelationId
|
|
@@ -2995,12 +2972,12 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2995
2972
|
case "did":
|
|
2996
2973
|
if ((0, import_ssi_sdk_ext6.isManagedIdentifierResult)(identifier) && (0, import_ssi_sdk_ext6.isManagedIdentifierDidResult)(identifier)) {
|
|
2997
2974
|
return [
|
|
2998
|
-
|
|
2975
|
+
import_ssi_sdk2.CredentialCorrelationType.DID,
|
|
2999
2976
|
identifier.did
|
|
3000
2977
|
];
|
|
3001
2978
|
} else if ((0, import_ssi_sdk_ext6.isManagedIdentifierDidOpts)(identifier)) {
|
|
3002
2979
|
return [
|
|
3003
|
-
|
|
2980
|
+
import_ssi_sdk2.CredentialCorrelationType.DID,
|
|
3004
2981
|
typeof identifier.identifier === "string" ? identifier.identifier : identifier.identifier.did
|
|
3005
2982
|
];
|
|
3006
2983
|
}
|
|
@@ -3008,12 +2985,12 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
3008
2985
|
case "kid":
|
|
3009
2986
|
if ((0, import_ssi_sdk_ext6.isManagedIdentifierResult)(identifier) && (0, import_ssi_sdk_ext6.isManagedIdentifierKidResult)(identifier)) {
|
|
3010
2987
|
return [
|
|
3011
|
-
|
|
2988
|
+
import_ssi_sdk2.CredentialCorrelationType.KID,
|
|
3012
2989
|
identifier.kid
|
|
3013
2990
|
];
|
|
3014
2991
|
} else if ((0, import_ssi_sdk_ext6.isManagedIdentifierDidOpts)(identifier)) {
|
|
3015
2992
|
return [
|
|
3016
|
-
|
|
2993
|
+
import_ssi_sdk2.CredentialCorrelationType.KID,
|
|
3017
2994
|
identifier.identifier
|
|
3018
2995
|
];
|
|
3019
2996
|
}
|
|
@@ -3021,19 +2998,19 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
3021
2998
|
case "x5c":
|
|
3022
2999
|
if ((0, import_ssi_sdk_ext6.isManagedIdentifierResult)(identifier) && (0, import_ssi_sdk_ext6.isManagedIdentifierX5cResult)(identifier)) {
|
|
3023
3000
|
return [
|
|
3024
|
-
|
|
3001
|
+
import_ssi_sdk2.CredentialCorrelationType.X509_SAN,
|
|
3025
3002
|
identifier.x5c.join("\r\n")
|
|
3026
3003
|
];
|
|
3027
3004
|
} else if ((0, import_ssi_sdk_ext6.isManagedIdentifierX5cOpts)(identifier)) {
|
|
3028
3005
|
return [
|
|
3029
|
-
|
|
3006
|
+
import_ssi_sdk2.CredentialCorrelationType.X509_SAN,
|
|
3030
3007
|
identifier.identifier.join("\r\n")
|
|
3031
3008
|
];
|
|
3032
3009
|
}
|
|
3033
3010
|
break;
|
|
3034
3011
|
}
|
|
3035
3012
|
return [
|
|
3036
|
-
|
|
3013
|
+
import_ssi_sdk2.CredentialCorrelationType.URL,
|
|
3037
3014
|
issuer
|
|
3038
3015
|
];
|
|
3039
3016
|
}
|