@sphereon/ssi-sdk.oid4vci-holder 0.34.1-feature.SSISDK.50.98 → 0.34.1-feature.SSISDK.50.type.refactor.148
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 +44 -40
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +46 -42
- package/dist/index.js.map +1 -1
- package/package.json +24 -24
- package/src/agent/OID4VCIHolder.ts +10 -3
- package/src/services/OID4VCIHolderService.ts +10 -23
- package/src/types/FirstPartyMachine.ts +5 -5
package/dist/index.js
CHANGED
|
@@ -56,7 +56,7 @@ var require_nl = __commonJS({
|
|
|
56
56
|
|
|
57
57
|
// src/agent/OID4VCIHolder.ts
|
|
58
58
|
import { CredentialOfferClient, MetadataClient, OpenID4VCIClient as OpenID4VCIClient2 } from "@sphereon/oid4vci-client";
|
|
59
|
-
import { DefaultURISchemes, getTypesFromAuthorizationDetails,
|
|
59
|
+
import { DefaultURISchemes, getTypesFromAuthorizationDetails, getTypesFromCredentialSupported as getTypesFromCredentialSupported2, getTypesFromObject as getTypesFromObject2 } from "@sphereon/oid4vci-common";
|
|
60
60
|
import { SupportedDidMethodEnum as SupportedDidMethodEnum2 } from "@sphereon/ssi-sdk-ext.did-utils";
|
|
61
61
|
import { isManagedIdentifierDidOpts, isManagedIdentifierDidResult as isManagedIdentifierDidResult2, isManagedIdentifierJwkResult, isManagedIdentifierKidResult, isManagedIdentifierResult as isManagedIdentifierResult2, isManagedIdentifierX5cOpts, isManagedIdentifierX5cResult } from "@sphereon/ssi-sdk-ext.identifier-resolution";
|
|
62
62
|
import { signatureAlgorithmFromKey } from "@sphereon/ssi-sdk-ext.key-utils";
|
|
@@ -76,18 +76,18 @@ import i18n from "i18n-js";
|
|
|
76
76
|
import memoize from "lodash.memoize";
|
|
77
77
|
|
|
78
78
|
// src/types/IOID4VCIHolder.ts
|
|
79
|
-
var OID4VCIHolderEvent = /* @__PURE__ */ function(OID4VCIHolderEvent2) {
|
|
79
|
+
var OID4VCIHolderEvent = /* @__PURE__ */ (function(OID4VCIHolderEvent2) {
|
|
80
80
|
OID4VCIHolderEvent2["CONTACT_IDENTITY_CREATED"] = "contact_identity_created";
|
|
81
81
|
OID4VCIHolderEvent2["CREDENTIAL_STORED"] = "credential_stored";
|
|
82
82
|
OID4VCIHolderEvent2["IDENTIFIER_CREATED"] = "identifier_created";
|
|
83
83
|
return OID4VCIHolderEvent2;
|
|
84
|
-
}({});
|
|
85
|
-
var SupportedLanguage = /* @__PURE__ */ function(SupportedLanguage2) {
|
|
84
|
+
})({});
|
|
85
|
+
var SupportedLanguage = /* @__PURE__ */ (function(SupportedLanguage2) {
|
|
86
86
|
SupportedLanguage2["ENGLISH"] = "en";
|
|
87
87
|
SupportedLanguage2["DUTCH"] = "nl";
|
|
88
88
|
return SupportedLanguage2;
|
|
89
|
-
}({});
|
|
90
|
-
var OID4VCIMachineStates = /* @__PURE__ */ function(OID4VCIMachineStates2) {
|
|
89
|
+
})({});
|
|
90
|
+
var OID4VCIMachineStates = /* @__PURE__ */ (function(OID4VCIMachineStates2) {
|
|
91
91
|
OID4VCIMachineStates2["start"] = "start";
|
|
92
92
|
OID4VCIMachineStates2["createCredentialsToSelectFrom"] = "createCredentialsToSelectFrom";
|
|
93
93
|
OID4VCIMachineStates2["getContact"] = "getContact";
|
|
@@ -118,18 +118,18 @@ var OID4VCIMachineStates = /* @__PURE__ */ function(OID4VCIMachineStates2) {
|
|
|
118
118
|
OID4VCIMachineStates2["error"] = "error";
|
|
119
119
|
OID4VCIMachineStates2["done"] = "done";
|
|
120
120
|
return OID4VCIMachineStates2;
|
|
121
|
-
}({});
|
|
122
|
-
var OID4VCIMachineAddContactStates = /* @__PURE__ */ function(OID4VCIMachineAddContactStates2) {
|
|
121
|
+
})({});
|
|
122
|
+
var OID4VCIMachineAddContactStates = /* @__PURE__ */ (function(OID4VCIMachineAddContactStates2) {
|
|
123
123
|
OID4VCIMachineAddContactStates2["idle"] = "idle";
|
|
124
124
|
OID4VCIMachineAddContactStates2["next"] = "next";
|
|
125
125
|
return OID4VCIMachineAddContactStates2;
|
|
126
|
-
}({});
|
|
127
|
-
var OID4VCIMachineVerifyPinStates = /* @__PURE__ */ function(OID4VCIMachineVerifyPinStates2) {
|
|
126
|
+
})({});
|
|
127
|
+
var OID4VCIMachineVerifyPinStates = /* @__PURE__ */ (function(OID4VCIMachineVerifyPinStates2) {
|
|
128
128
|
OID4VCIMachineVerifyPinStates2["idle"] = "idle";
|
|
129
129
|
OID4VCIMachineVerifyPinStates2["next"] = "next";
|
|
130
130
|
return OID4VCIMachineVerifyPinStates2;
|
|
131
|
-
}({});
|
|
132
|
-
var OID4VCIMachineEvents = /* @__PURE__ */ function(OID4VCIMachineEvents2) {
|
|
131
|
+
})({});
|
|
132
|
+
var OID4VCIMachineEvents = /* @__PURE__ */ (function(OID4VCIMachineEvents2) {
|
|
133
133
|
OID4VCIMachineEvents2["NEXT"] = "NEXT";
|
|
134
134
|
OID4VCIMachineEvents2["PREVIOUS"] = "PREVIOUS";
|
|
135
135
|
OID4VCIMachineEvents2["DECLINE"] = "DECLINE";
|
|
@@ -142,8 +142,8 @@ var OID4VCIMachineEvents = /* @__PURE__ */ function(OID4VCIMachineEvents2) {
|
|
|
142
142
|
OID4VCIMachineEvents2["INVOKED_AUTHORIZATION_CODE_REQUEST"] = "INVOKED_AUTHORIZATION_CODE_REQUEST";
|
|
143
143
|
OID4VCIMachineEvents2["PROVIDE_AUTHORIZATION_CODE_RESPONSE"] = "PROVIDE_AUTHORIZATION_CODE_RESPONSE";
|
|
144
144
|
return OID4VCIMachineEvents2;
|
|
145
|
-
}({});
|
|
146
|
-
var OID4VCIMachineGuards = /* @__PURE__ */ function(OID4VCIMachineGuards2) {
|
|
145
|
+
})({});
|
|
146
|
+
var OID4VCIMachineGuards = /* @__PURE__ */ (function(OID4VCIMachineGuards2) {
|
|
147
147
|
OID4VCIMachineGuards2["hasContactGuard"] = "oid4vciHasContactGuard";
|
|
148
148
|
OID4VCIMachineGuards2["hasNoContactGuard"] = "oid4vciHasNoContactGuard";
|
|
149
149
|
OID4VCIMachineGuards2["credentialsToSelectRequiredGuard"] = "oid4vciCredentialsToSelectRequiredGuard";
|
|
@@ -160,8 +160,8 @@ var OID4VCIMachineGuards = /* @__PURE__ */ function(OID4VCIMachineGuards2) {
|
|
|
160
160
|
OID4VCIMachineGuards2["contactHasLowTrustGuard"] = "oid4vciContactHasLowTrustGuard";
|
|
161
161
|
OID4VCIMachineGuards2["isFirstPartyApplication"] = "oid4vciIsFirstPartyApplication";
|
|
162
162
|
return OID4VCIMachineGuards2;
|
|
163
|
-
}({});
|
|
164
|
-
var OID4VCIMachineServices = /* @__PURE__ */ function(OID4VCIMachineServices2) {
|
|
163
|
+
})({});
|
|
164
|
+
var OID4VCIMachineServices = /* @__PURE__ */ (function(OID4VCIMachineServices2) {
|
|
165
165
|
OID4VCIMachineServices2["start"] = "start";
|
|
166
166
|
OID4VCIMachineServices2["getContact"] = "getContact";
|
|
167
167
|
OID4VCIMachineServices2["getFederationTrust"] = "getFederationTrust";
|
|
@@ -176,17 +176,17 @@ var OID4VCIMachineServices = /* @__PURE__ */ function(OID4VCIMachineServices2) {
|
|
|
176
176
|
OID4VCIMachineServices2["storeCredentials"] = "storeCredentials";
|
|
177
177
|
OID4VCIMachineServices2["startFirstPartApplicationFlow"] = "startFirstPartApplicationFlow";
|
|
178
178
|
return OID4VCIMachineServices2;
|
|
179
|
-
}({});
|
|
180
|
-
var RequestType = /* @__PURE__ */ function(RequestType2) {
|
|
179
|
+
})({});
|
|
180
|
+
var RequestType = /* @__PURE__ */ (function(RequestType2) {
|
|
181
181
|
RequestType2["OPENID_INITIATE_ISSUANCE"] = "openid-initiate-issuance";
|
|
182
182
|
RequestType2["OPENID_CREDENTIAL_OFFER"] = "openid-credential-offer";
|
|
183
183
|
RequestType2["URL"] = "URL";
|
|
184
184
|
return RequestType2;
|
|
185
|
-
}({});
|
|
186
|
-
var IdentifierAliasEnum = /* @__PURE__ */ function(IdentifierAliasEnum2) {
|
|
185
|
+
})({});
|
|
186
|
+
var IdentifierAliasEnum = /* @__PURE__ */ (function(IdentifierAliasEnum2) {
|
|
187
187
|
IdentifierAliasEnum2["PRIMARY"] = "primary";
|
|
188
188
|
return IdentifierAliasEnum2;
|
|
189
|
-
}({});
|
|
189
|
+
})({});
|
|
190
190
|
|
|
191
191
|
// src/localization/Localization.ts
|
|
192
192
|
var Localization = class Localization2 {
|
|
@@ -228,7 +228,7 @@ var Localization = class Localization2 {
|
|
|
228
228
|
var translate = Localization.translate;
|
|
229
229
|
|
|
230
230
|
// src/types/FirstPartyMachine.ts
|
|
231
|
-
var FirstPartyMachineStateTypes = /* @__PURE__ */ function(FirstPartyMachineStateTypes2) {
|
|
231
|
+
var FirstPartyMachineStateTypes = /* @__PURE__ */ (function(FirstPartyMachineStateTypes2) {
|
|
232
232
|
FirstPartyMachineStateTypes2["sendAuthorizationChallengeRequest"] = "sendAuthorizationChallengeRequest";
|
|
233
233
|
FirstPartyMachineStateTypes2["sendAuthorizationResponse"] = "sendAuthorizationResponse";
|
|
234
234
|
FirstPartyMachineStateTypes2["selectCredentials"] = "selectCredentials";
|
|
@@ -239,21 +239,21 @@ var FirstPartyMachineStateTypes = /* @__PURE__ */ function(FirstPartyMachineStat
|
|
|
239
239
|
FirstPartyMachineStateTypes2["aborted"] = "aborted";
|
|
240
240
|
FirstPartyMachineStateTypes2["declined"] = "declined";
|
|
241
241
|
return FirstPartyMachineStateTypes2;
|
|
242
|
-
}({});
|
|
243
|
-
var FirstPartyMachineServices = /* @__PURE__ */ function(FirstPartyMachineServices2) {
|
|
242
|
+
})({});
|
|
243
|
+
var FirstPartyMachineServices = /* @__PURE__ */ (function(FirstPartyMachineServices2) {
|
|
244
244
|
FirstPartyMachineServices2["sendAuthorizationChallengeRequest"] = "sendAuthorizationChallengeRequest";
|
|
245
245
|
FirstPartyMachineServices2["sendAuthorizationResponse"] = "sendAuthorizationResponse";
|
|
246
246
|
FirstPartyMachineServices2["createConfig"] = "createConfig";
|
|
247
247
|
FirstPartyMachineServices2["getSiopRequest"] = "getSiopRequest";
|
|
248
248
|
return FirstPartyMachineServices2;
|
|
249
|
-
}({});
|
|
250
|
-
var FirstPartyMachineEvents = /* @__PURE__ */ function(FirstPartyMachineEvents2) {
|
|
249
|
+
})({});
|
|
250
|
+
var FirstPartyMachineEvents = /* @__PURE__ */ (function(FirstPartyMachineEvents2) {
|
|
251
251
|
FirstPartyMachineEvents2["NEXT"] = "NEXT";
|
|
252
252
|
FirstPartyMachineEvents2["PREVIOUS"] = "PREVIOUS";
|
|
253
253
|
FirstPartyMachineEvents2["DECLINE"] = "DECLINE";
|
|
254
254
|
FirstPartyMachineEvents2["SET_SELECTED_CREDENTIALS"] = "SET_SELECTED_CREDENTIALS";
|
|
255
255
|
return FirstPartyMachineEvents2;
|
|
256
|
-
}({});
|
|
256
|
+
})({});
|
|
257
257
|
|
|
258
258
|
// src/machines/oid4vciMachine.ts
|
|
259
259
|
var oid4vciHasNoContactGuard = /* @__PURE__ */ __name((_ctx, _event) => {
|
|
@@ -978,7 +978,7 @@ var OID4VCIMachine = class {
|
|
|
978
978
|
|
|
979
979
|
// src/services/OID4VCIHolderService.ts
|
|
980
980
|
import { LOG } from "@sphereon/oid4vci-client";
|
|
981
|
-
import { getSupportedCredentials, getTypesFromCredentialSupported, getTypesFromObject
|
|
981
|
+
import { getSupportedCredentials, getTypesFromCredentialSupported, getTypesFromObject } from "@sphereon/oid4vci-common";
|
|
982
982
|
import { KeyUse } from "@sphereon/ssi-sdk-ext.did-resolver-jwk";
|
|
983
983
|
import { getOrCreatePrimaryIdentifier, SupportedDidMethodEnum } from "@sphereon/ssi-sdk-ext.did-utils";
|
|
984
984
|
import { isIIdentifier, isManagedIdentifierDidResult, isManagedIdentifierResult, managedIdentifierToJwk } from "@sphereon/ssi-sdk-ext.identifier-resolution";
|
|
@@ -1810,24 +1810,22 @@ var getCredentialConfigsSupportedBySingleTypeOrId = /* @__PURE__ */ __name(async
|
|
|
1810
1810
|
}
|
|
1811
1811
|
__name(createIdFromTypes, "createIdFromTypes");
|
|
1812
1812
|
if (configurationId) {
|
|
1813
|
-
|
|
1813
|
+
if (!format) {
|
|
1814
|
+
return Promise.reject(Error("format parameter missing from input"));
|
|
1815
|
+
}
|
|
1816
|
+
const allSupported2 = client.getCredentialsSupported(format);
|
|
1814
1817
|
return Object.fromEntries(Object.entries(allSupported2).filter(([id, supported]) => id === configurationId || supported.id === configurationId || createIdFromTypes(supported) === configurationId));
|
|
1815
1818
|
}
|
|
1816
|
-
if (!
|
|
1817
|
-
return Promise.reject(Error("openID4VCIClient has no credentialOffer
|
|
1819
|
+
if (!client.credentialOffer) {
|
|
1820
|
+
return Promise.reject(Error("openID4VCIClient has no credentialOffer"));
|
|
1818
1821
|
}
|
|
1819
|
-
if (!
|
|
1820
|
-
|
|
1821
|
-
format = client.credentialOffer.credential_offer.credentials.filter((cred) => typeof cred !== "string").map((cred) => cred.format);
|
|
1822
|
-
if (format?.length === 0) {
|
|
1823
|
-
format = void 0;
|
|
1824
|
-
}
|
|
1825
|
-
}
|
|
1822
|
+
if (!types) {
|
|
1823
|
+
return Promise.reject(Error("openID4VCIClient has no types"));
|
|
1826
1824
|
}
|
|
1827
1825
|
const offerSupported = getSupportedCredentials({
|
|
1828
|
-
types:
|
|
1826
|
+
types: [
|
|
1829
1827
|
types
|
|
1830
|
-
]
|
|
1828
|
+
],
|
|
1831
1829
|
format,
|
|
1832
1830
|
version: client.version(),
|
|
1833
1831
|
issuerMetadata: client.endpointMetadata.credentialIssuerMetadata
|
|
@@ -2002,7 +2000,7 @@ var getIssuanceCryptoSuite = /* @__PURE__ */ __name(async (opts) => {
|
|
|
2002
2000
|
case "jwt":
|
|
2003
2001
|
case "jwt_vc_json":
|
|
2004
2002
|
case "jwt_vc":
|
|
2005
|
-
case
|
|
2003
|
+
//case 'vc+sd-jwt': // TODO see SSISDK-52 concerning vc+sd-jwt
|
|
2006
2004
|
case "dc+sd-jwt":
|
|
2007
2005
|
case "mso_mdoc": {
|
|
2008
2006
|
const supportedPreferences = jwtCryptographicSuitePreferences.filter((suite) => signing_algs_supported.includes(suite));
|
|
@@ -2329,7 +2327,13 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2329
2327
|
}
|
|
2330
2328
|
}
|
|
2331
2329
|
if (offer) {
|
|
2332
|
-
|
|
2330
|
+
const credentialsSupported2 = offer.original_credential_offer.credential_configuration_ids.flatMap((configId) => {
|
|
2331
|
+
const config = oid4vciClient.endpointMetadata.credentialIssuerMetadata?.credential_configurations_supported[configId];
|
|
2332
|
+
return config ? [
|
|
2333
|
+
config
|
|
2334
|
+
] : [];
|
|
2335
|
+
});
|
|
2336
|
+
types = credentialsSupported2.map((credentialSupported) => getTypesFromCredentialSupported2(credentialSupported));
|
|
2333
2337
|
} else {
|
|
2334
2338
|
types = asArray2(authorizationRequestOpts.authorizationDetails).map((authReqOpts) => getTypesFromAuthorizationDetails(authReqOpts) ?? []).filter((inner) => inner.length > 0);
|
|
2335
2339
|
}
|