@sphereon/ssi-sdk.oid4vci-holder 0.34.1-feature.SSISDK.78.306 → 0.34.1-feature.SSISDK.82.and.SSISDK.70.345
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 +24 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -12
- package/dist/index.d.ts +18 -12
- package/dist/index.js +25 -11
- package/dist/index.js.map +1 -1
- package/package.json +24 -24
- package/src/agent/OID4VCIHolder.ts +24 -15
- package/src/link-handler/index.ts +5 -2
- package/src/machines/oid4vciMachine.ts +1 -0
- package/src/services/OID4VCIHolderService.ts +1 -1
- package/src/types/IOID4VCIHolder.ts +16 -11
package/dist/index.cjs
CHANGED
|
@@ -413,6 +413,7 @@ var createOID4VCIMachine = /* @__PURE__ */ __name((opts) => {
|
|
|
413
413
|
// TODO WAL-671 we need to store the data from OpenIdProvider here in the context and make sure we can restart the machine with it and init the OpenIdProvider
|
|
414
414
|
accessTokenOpts: opts?.accessTokenOpts,
|
|
415
415
|
requestData: opts?.requestData,
|
|
416
|
+
walletType: opts?.walletType ?? "NATURAL_PERSON",
|
|
416
417
|
trustAnchors: opts?.trustAnchors ?? [],
|
|
417
418
|
issuanceOpt: opts?.issuanceOpt,
|
|
418
419
|
didMethodPreferences: opts?.didMethodPreferences,
|
|
@@ -1920,7 +1921,7 @@ var getCredentialConfigsSupportedBySingleTypeOrId = /* @__PURE__ */ __name(async
|
|
|
1920
1921
|
}
|
|
1921
1922
|
__name(createIdFromTypes, "createIdFromTypes");
|
|
1922
1923
|
if (configurationId) {
|
|
1923
|
-
const allSupported2 = client.getCredentialsSupported(format);
|
|
1924
|
+
const allSupported2 = client.getCredentialsSupported(void 0, format);
|
|
1924
1925
|
return Object.fromEntries(Object.entries(allSupported2).filter(([id, supported]) => id === configurationId || supported.id === configurationId || createIdFromTypes(supported) === configurationId));
|
|
1925
1926
|
}
|
|
1926
1927
|
if (!client.credentialOffer) {
|
|
@@ -2385,7 +2386,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2385
2386
|
...this.defaultAuthorizationRequestOpts,
|
|
2386
2387
|
...args.authorizationRequestOpts
|
|
2387
2388
|
};
|
|
2388
|
-
authorizationRequestOpts.authorizationDetails = authorizationRequestOpts?.authorizationDetails ? (0, import_utils2.asArray)(authorizationRequestOpts.authorizationDetails)
|
|
2389
|
+
authorizationRequestOpts.authorizationDetails = authorizationRequestOpts?.authorizationDetails ? (0, import_utils2.asArray)(authorizationRequestOpts.authorizationDetails) : void 0;
|
|
2389
2390
|
if (!authorizationRequestOpts.redirectUri) {
|
|
2390
2391
|
authorizationRequestOpts.redirectUri = _OID4VCIHolder.DEFAULT_MOBILE_REDIRECT_URI;
|
|
2391
2392
|
}
|
|
@@ -2400,7 +2401,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2400
2401
|
let oid4vciClient;
|
|
2401
2402
|
let offer;
|
|
2402
2403
|
if (requestData.existingClientState) {
|
|
2403
|
-
oid4vciClient = await import_oid4vci_client3.
|
|
2404
|
+
oid4vciClient = await import_oid4vci_client3.OpenID4VCIClientV1_0_15.fromState({
|
|
2404
2405
|
state: requestData.existingClientState
|
|
2405
2406
|
});
|
|
2406
2407
|
offer = oid4vciClient.credentialOffer;
|
|
@@ -2417,7 +2418,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2417
2418
|
}
|
|
2418
2419
|
if (!offer) {
|
|
2419
2420
|
logger.log(`Issuer url received (no credential offer): ${uri}`);
|
|
2420
|
-
oid4vciClient = await import_oid4vci_client3.
|
|
2421
|
+
oid4vciClient = await import_oid4vci_client3.OpenID4VCIClientV1_0_15.fromCredentialIssuer({
|
|
2421
2422
|
credentialIssuer: uri,
|
|
2422
2423
|
authorizationRequest: authorizationRequestOpts,
|
|
2423
2424
|
clientId: authorizationRequestOpts.clientId,
|
|
@@ -2425,7 +2426,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2425
2426
|
});
|
|
2426
2427
|
} else {
|
|
2427
2428
|
logger.log(`Credential offer received: ${uri}`);
|
|
2428
|
-
oid4vciClient = await import_oid4vci_client3.
|
|
2429
|
+
oid4vciClient = await import_oid4vci_client3.OpenID4VCIClientV1_0_15.fromURI({
|
|
2429
2430
|
uri,
|
|
2430
2431
|
authorizationRequest: authorizationRequestOpts,
|
|
2431
2432
|
clientId: authorizationRequestOpts.clientId,
|
|
@@ -2437,7 +2438,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2437
2438
|
if (offer) {
|
|
2438
2439
|
configurationIds = offer.original_credential_offer.credential_configuration_ids;
|
|
2439
2440
|
} else {
|
|
2440
|
-
configurationIds = (0, import_utils2.asArray)(authorizationRequestOpts.authorizationDetails).
|
|
2441
|
+
configurationIds = (0, import_utils2.asArray)(authorizationRequestOpts.authorizationDetails).map((authReqOpts) => authReqOpts.credential_configuration_id).filter((id) => !!id);
|
|
2441
2442
|
}
|
|
2442
2443
|
const credentialsSupported = await getCredentialConfigsSupportedMerged({
|
|
2443
2444
|
client: oid4vciClient,
|
|
@@ -2553,12 +2554,12 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2553
2554
|
return party;
|
|
2554
2555
|
}
|
|
2555
2556
|
async oid4vciHolderGetCredentials(args, context) {
|
|
2556
|
-
const { verificationCode, openID4VCIClientState, didMethodPreferences
|
|
2557
|
+
const { verificationCode, openID4VCIClientState, didMethodPreferences, issuanceOpt, accessTokenOpts, walletType } = args;
|
|
2557
2558
|
logger.debug(`Getting credentials`, issuanceOpt, accessTokenOpts);
|
|
2558
2559
|
if (!openID4VCIClientState) {
|
|
2559
2560
|
return Promise.reject(Error("Missing openID4VCI client state in context"));
|
|
2560
2561
|
}
|
|
2561
|
-
const client = await import_oid4vci_client3.
|
|
2562
|
+
const client = await import_oid4vci_client3.OpenID4VCIClientV1_0_15.fromState({
|
|
2562
2563
|
state: openID4VCIClientState
|
|
2563
2564
|
});
|
|
2564
2565
|
const credentialsSupported = await getCredentialConfigsSupportedMerged({
|
|
@@ -2572,7 +2573,7 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2572
2573
|
credentialsSupported,
|
|
2573
2574
|
serverMetadata,
|
|
2574
2575
|
context,
|
|
2575
|
-
didMethodPreferences:
|
|
2576
|
+
didMethodPreferences: this.selectDidMethodPreferences(didMethodPreferences, walletType),
|
|
2576
2577
|
jwtCryptographicSuitePreferences: this.jwtCryptographicSuitePreferences,
|
|
2577
2578
|
jsonldCryptographicSuitePreferences: this.jsonldCryptographicSuitePreferences,
|
|
2578
2579
|
...issuanceOpt && {
|
|
@@ -2589,6 +2590,16 @@ var OID4VCIHolder = class _OID4VCIHolder {
|
|
|
2589
2590
|
logger.log(`Credentials received`, allCredentials);
|
|
2590
2591
|
return allCredentials;
|
|
2591
2592
|
}
|
|
2593
|
+
selectDidMethodPreferences(didMethodPreferences, walletType) {
|
|
2594
|
+
const supportedDidMethodEnums = Array.isArray(didMethodPreferences) && didMethodPreferences.length > 0 ? didMethodPreferences : this.didMethodPreferences;
|
|
2595
|
+
if (walletType === "ORGANIZATIONAL") {
|
|
2596
|
+
return [
|
|
2597
|
+
import_ssi_sdk_ext5.SupportedDidMethodEnum.DID_WEB,
|
|
2598
|
+
...supportedDidMethodEnums
|
|
2599
|
+
];
|
|
2600
|
+
}
|
|
2601
|
+
return supportedDidMethodEnums;
|
|
2602
|
+
}
|
|
2592
2603
|
async oid4vciHolderGetCredential(args, context) {
|
|
2593
2604
|
const { issuanceOpt, pin, client, accessTokenOpts } = args;
|
|
2594
2605
|
logger.info(`Getting credential`, issuanceOpt);
|
|
@@ -3140,6 +3151,7 @@ var OID4VCIHolderLinkHandler = class extends import_ssi_sdk4.LinkHandlerAdapter
|
|
|
3140
3151
|
stateNavigationListener;
|
|
3141
3152
|
firstPartyStateNavigationListener;
|
|
3142
3153
|
noStateMachinePersistence;
|
|
3154
|
+
walletType;
|
|
3143
3155
|
authorizationRequestOpts;
|
|
3144
3156
|
clientOpts;
|
|
3145
3157
|
trustAnchors;
|
|
@@ -3151,6 +3163,7 @@ var OID4VCIHolderLinkHandler = class extends import_ssi_sdk4.LinkHandlerAdapter
|
|
|
3151
3163
|
this.authorizationRequestOpts = args.authorizationRequestOpts;
|
|
3152
3164
|
this.clientOpts = args.clientOpts;
|
|
3153
3165
|
this.context = args.context;
|
|
3166
|
+
this.walletType = args.walletType ?? "NATURAL_PERSON";
|
|
3154
3167
|
this.noStateMachinePersistence = args.noStateMachinePersistence === true;
|
|
3155
3168
|
this.stateNavigationListener = args.stateNavigationListener;
|
|
3156
3169
|
this.firstPartyStateNavigationListener = args.firstPartyStateNavigationListener;
|
|
@@ -3187,7 +3200,8 @@ var OID4VCIHolderLinkHandler = class extends import_ssi_sdk4.LinkHandlerAdapter
|
|
|
3187
3200
|
clientOpts
|
|
3188
3201
|
},
|
|
3189
3202
|
stateNavigationListener: this.stateNavigationListener,
|
|
3190
|
-
firstPartyStateNavigationListener: this.firstPartyStateNavigationListener
|
|
3203
|
+
firstPartyStateNavigationListener: this.firstPartyStateNavigationListener,
|
|
3204
|
+
walletType: this.walletType
|
|
3191
3205
|
});
|
|
3192
3206
|
const interpreter = oid4vciMachine.interpreter;
|
|
3193
3207
|
if (!opts?.machineState && this.context.agent.availableMethods().includes("machineStatesFindActive")) {
|