@sphereon/ssi-sdk.oid4vci-holder 0.34.1-next.3 → 0.34.1-next.40

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.js CHANGED
@@ -75,18 +75,18 @@ import i18n from "i18n-js";
75
75
  import memoize from "lodash.memoize";
76
76
 
77
77
  // src/types/IOID4VCIHolder.ts
78
- var OID4VCIHolderEvent = /* @__PURE__ */ function(OID4VCIHolderEvent2) {
78
+ var OID4VCIHolderEvent = /* @__PURE__ */ (function(OID4VCIHolderEvent2) {
79
79
  OID4VCIHolderEvent2["CONTACT_IDENTITY_CREATED"] = "contact_identity_created";
80
80
  OID4VCIHolderEvent2["CREDENTIAL_STORED"] = "credential_stored";
81
81
  OID4VCIHolderEvent2["IDENTIFIER_CREATED"] = "identifier_created";
82
82
  return OID4VCIHolderEvent2;
83
- }({});
84
- var SupportedLanguage = /* @__PURE__ */ function(SupportedLanguage2) {
83
+ })({});
84
+ var SupportedLanguage = /* @__PURE__ */ (function(SupportedLanguage2) {
85
85
  SupportedLanguage2["ENGLISH"] = "en";
86
86
  SupportedLanguage2["DUTCH"] = "nl";
87
87
  return SupportedLanguage2;
88
- }({});
89
- var OID4VCIMachineStates = /* @__PURE__ */ function(OID4VCIMachineStates2) {
88
+ })({});
89
+ var OID4VCIMachineStates = /* @__PURE__ */ (function(OID4VCIMachineStates2) {
90
90
  OID4VCIMachineStates2["start"] = "start";
91
91
  OID4VCIMachineStates2["createCredentialsToSelectFrom"] = "createCredentialsToSelectFrom";
92
92
  OID4VCIMachineStates2["getContact"] = "getContact";
@@ -117,18 +117,18 @@ var OID4VCIMachineStates = /* @__PURE__ */ function(OID4VCIMachineStates2) {
117
117
  OID4VCIMachineStates2["error"] = "error";
118
118
  OID4VCIMachineStates2["done"] = "done";
119
119
  return OID4VCIMachineStates2;
120
- }({});
121
- var OID4VCIMachineAddContactStates = /* @__PURE__ */ function(OID4VCIMachineAddContactStates2) {
120
+ })({});
121
+ var OID4VCIMachineAddContactStates = /* @__PURE__ */ (function(OID4VCIMachineAddContactStates2) {
122
122
  OID4VCIMachineAddContactStates2["idle"] = "idle";
123
123
  OID4VCIMachineAddContactStates2["next"] = "next";
124
124
  return OID4VCIMachineAddContactStates2;
125
- }({});
126
- var OID4VCIMachineVerifyPinStates = /* @__PURE__ */ function(OID4VCIMachineVerifyPinStates2) {
125
+ })({});
126
+ var OID4VCIMachineVerifyPinStates = /* @__PURE__ */ (function(OID4VCIMachineVerifyPinStates2) {
127
127
  OID4VCIMachineVerifyPinStates2["idle"] = "idle";
128
128
  OID4VCIMachineVerifyPinStates2["next"] = "next";
129
129
  return OID4VCIMachineVerifyPinStates2;
130
- }({});
131
- var OID4VCIMachineEvents = /* @__PURE__ */ function(OID4VCIMachineEvents2) {
130
+ })({});
131
+ var OID4VCIMachineEvents = /* @__PURE__ */ (function(OID4VCIMachineEvents2) {
132
132
  OID4VCIMachineEvents2["NEXT"] = "NEXT";
133
133
  OID4VCIMachineEvents2["PREVIOUS"] = "PREVIOUS";
134
134
  OID4VCIMachineEvents2["DECLINE"] = "DECLINE";
@@ -141,8 +141,8 @@ var OID4VCIMachineEvents = /* @__PURE__ */ function(OID4VCIMachineEvents2) {
141
141
  OID4VCIMachineEvents2["INVOKED_AUTHORIZATION_CODE_REQUEST"] = "INVOKED_AUTHORIZATION_CODE_REQUEST";
142
142
  OID4VCIMachineEvents2["PROVIDE_AUTHORIZATION_CODE_RESPONSE"] = "PROVIDE_AUTHORIZATION_CODE_RESPONSE";
143
143
  return OID4VCIMachineEvents2;
144
- }({});
145
- var OID4VCIMachineGuards = /* @__PURE__ */ function(OID4VCIMachineGuards2) {
144
+ })({});
145
+ var OID4VCIMachineGuards = /* @__PURE__ */ (function(OID4VCIMachineGuards2) {
146
146
  OID4VCIMachineGuards2["hasContactGuard"] = "oid4vciHasContactGuard";
147
147
  OID4VCIMachineGuards2["hasNoContactGuard"] = "oid4vciHasNoContactGuard";
148
148
  OID4VCIMachineGuards2["credentialsToSelectRequiredGuard"] = "oid4vciCredentialsToSelectRequiredGuard";
@@ -158,8 +158,8 @@ var OID4VCIMachineGuards = /* @__PURE__ */ function(OID4VCIMachineGuards2) {
158
158
  OID4VCIMachineGuards2["contactHasLowTrustGuard"] = "oid4vciContactHasLowTrustGuard";
159
159
  OID4VCIMachineGuards2["isFirstPartyApplication"] = "oid4vciIsFirstPartyApplication";
160
160
  return OID4VCIMachineGuards2;
161
- }({});
162
- var OID4VCIMachineServices = /* @__PURE__ */ function(OID4VCIMachineServices2) {
161
+ })({});
162
+ var OID4VCIMachineServices = /* @__PURE__ */ (function(OID4VCIMachineServices2) {
163
163
  OID4VCIMachineServices2["start"] = "start";
164
164
  OID4VCIMachineServices2["getContact"] = "getContact";
165
165
  OID4VCIMachineServices2["getFederationTrust"] = "getFederationTrust";
@@ -174,17 +174,17 @@ var OID4VCIMachineServices = /* @__PURE__ */ function(OID4VCIMachineServices2) {
174
174
  OID4VCIMachineServices2["storeCredentials"] = "storeCredentials";
175
175
  OID4VCIMachineServices2["startFirstPartApplicationFlow"] = "startFirstPartApplicationFlow";
176
176
  return OID4VCIMachineServices2;
177
- }({});
178
- var RequestType = /* @__PURE__ */ function(RequestType2) {
177
+ })({});
178
+ var RequestType = /* @__PURE__ */ (function(RequestType2) {
179
179
  RequestType2["OPENID_INITIATE_ISSUANCE"] = "openid-initiate-issuance";
180
180
  RequestType2["OPENID_CREDENTIAL_OFFER"] = "openid-credential-offer";
181
181
  RequestType2["URL"] = "URL";
182
182
  return RequestType2;
183
- }({});
184
- var IdentifierAliasEnum = /* @__PURE__ */ function(IdentifierAliasEnum2) {
183
+ })({});
184
+ var IdentifierAliasEnum = /* @__PURE__ */ (function(IdentifierAliasEnum2) {
185
185
  IdentifierAliasEnum2["PRIMARY"] = "primary";
186
186
  return IdentifierAliasEnum2;
187
- }({});
187
+ })({});
188
188
 
189
189
  // src/localization/Localization.ts
190
190
  var Localization = class Localization2 {
@@ -226,7 +226,7 @@ var Localization = class Localization2 {
226
226
  var translate = Localization.translate;
227
227
 
228
228
  // src/types/FirstPartyMachine.ts
229
- var FirstPartyMachineStateTypes = /* @__PURE__ */ function(FirstPartyMachineStateTypes2) {
229
+ var FirstPartyMachineStateTypes = /* @__PURE__ */ (function(FirstPartyMachineStateTypes2) {
230
230
  FirstPartyMachineStateTypes2["sendAuthorizationChallengeRequest"] = "sendAuthorizationChallengeRequest";
231
231
  FirstPartyMachineStateTypes2["sendAuthorizationResponse"] = "sendAuthorizationResponse";
232
232
  FirstPartyMachineStateTypes2["selectCredentials"] = "selectCredentials";
@@ -237,21 +237,21 @@ var FirstPartyMachineStateTypes = /* @__PURE__ */ function(FirstPartyMachineStat
237
237
  FirstPartyMachineStateTypes2["aborted"] = "aborted";
238
238
  FirstPartyMachineStateTypes2["declined"] = "declined";
239
239
  return FirstPartyMachineStateTypes2;
240
- }({});
241
- var FirstPartyMachineServices = /* @__PURE__ */ function(FirstPartyMachineServices2) {
240
+ })({});
241
+ var FirstPartyMachineServices = /* @__PURE__ */ (function(FirstPartyMachineServices2) {
242
242
  FirstPartyMachineServices2["sendAuthorizationChallengeRequest"] = "sendAuthorizationChallengeRequest";
243
243
  FirstPartyMachineServices2["sendAuthorizationResponse"] = "sendAuthorizationResponse";
244
244
  FirstPartyMachineServices2["createConfig"] = "createConfig";
245
245
  FirstPartyMachineServices2["getSiopRequest"] = "getSiopRequest";
246
246
  return FirstPartyMachineServices2;
247
- }({});
248
- var FirstPartyMachineEvents = /* @__PURE__ */ function(FirstPartyMachineEvents2) {
247
+ })({});
248
+ var FirstPartyMachineEvents = /* @__PURE__ */ (function(FirstPartyMachineEvents2) {
249
249
  FirstPartyMachineEvents2["NEXT"] = "NEXT";
250
250
  FirstPartyMachineEvents2["PREVIOUS"] = "PREVIOUS";
251
251
  FirstPartyMachineEvents2["DECLINE"] = "DECLINE";
252
252
  FirstPartyMachineEvents2["SET_SELECTED_CREDENTIALS"] = "SET_SELECTED_CREDENTIALS";
253
253
  return FirstPartyMachineEvents2;
254
- }({});
254
+ })({});
255
255
 
256
256
  // src/machines/oid4vciMachine.ts
257
257
  var oid4vciHasNoContactGuard = /* @__PURE__ */ __name((_ctx, _event) => {
@@ -2658,9 +2658,19 @@ var OID4VCIHolder = class _OID4VCIHolder {
2658
2658
  }
2659
2659
  let counter = 0;
2660
2660
  for (const credentialId of selectedCredentials) {
2661
- const localeBranding = credentialBranding?.[credentialId];
2661
+ const configId = credentialId;
2662
+ const types = credentialsToAccept.find((ac) => ac.correlationId === configId || ac.credentialToAccept.id === configId || ac.types.includes(configId))?.types?.filter((type) => type != "VerifiableCredential") ?? [];
2663
+ const localeBranding = credentialBranding?.[configId] ?? [];
2664
+ if (localeBranding.length === 0) {
2665
+ for (const type of types) {
2666
+ const branding = credentialBranding?.[type] ?? [];
2667
+ if (branding.length > 0) {
2668
+ localeBranding.push(...branding);
2669
+ }
2670
+ }
2671
+ }
2662
2672
  if (localeBranding && localeBranding.length > 0) {
2663
- const credential = credentialsToAccept.find((credAccept) => credAccept.credentialToAccept.id === credentialId || JSON.stringify(credAccept.types) === credentialId || credentialsToAccept[counter]);
2673
+ const credential = credentialsToAccept.find((credAccept) => credAccept.credentialToAccept.id === credentialId || JSON.stringify(credAccept.types) === credentialId || JSON.stringify(credAccept.types.filter((cred) => cred !== "VerifiableCredential")) === JSON.stringify(types) || credentialsToAccept[counter]);
2664
2674
  counter++;
2665
2675
  await context.agent.ibAddCredentialBranding({
2666
2676
  vcHash: computeEntryHash(credential.rawVerifiableCredential),