gdc-sdk-node-ts 2.7.4 → 2.7.6
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.
|
@@ -20,6 +20,8 @@ export type NodeProfessionalIdentityVpInput = Readonly<{
|
|
|
20
20
|
sameAs?: string | readonly string[];
|
|
21
21
|
telephone?: string;
|
|
22
22
|
credentialMaterial?: string;
|
|
23
|
+
/** Server-authorized credentials appended after the professional identity VC. */
|
|
24
|
+
additionalCredentials?: ReadonlyArray<object>;
|
|
23
25
|
}>;
|
|
24
26
|
export type NodeCommunicationWalletInitialization = {
|
|
25
27
|
/**
|
|
@@ -4,7 +4,7 @@ import { CryptographyService } from 'gdc-common-utils-ts/CryptographyService';
|
|
|
4
4
|
import { Content } from 'gdc-common-utils-ts/utils/content';
|
|
5
5
|
import { createJwtSigner } from 'gdc-common-utils-ts/utils/jwt-signer';
|
|
6
6
|
import { buildJwtCompact, prepareJwtForSignature } from 'gdc-common-utils-ts/utils/jwt';
|
|
7
|
-
import { buildProfessionalIdentityVpPayload } from 'gdc-common-utils-ts/utils/professional-smart';
|
|
7
|
+
import { buildProfessionalIdentityVpPayload, getProfessionalIdentityVC, } from 'gdc-common-utils-ts/utils/professional-smart';
|
|
8
8
|
import { NodeCryptoHelper } from './node-crypto-helper.js';
|
|
9
9
|
const DEFAULT_POLICY = {
|
|
10
10
|
defaults: {
|
|
@@ -359,6 +359,19 @@ export class NodeManagedWallet {
|
|
|
359
359
|
...(input.sameAs ? { sameAs: input.sameAs } : {}),
|
|
360
360
|
...(input.telephone ? { telephone: input.telephone } : {}),
|
|
361
361
|
...(input.credentialMaterial ? { credentialMaterial: input.credentialMaterial } : {}),
|
|
362
|
+
...(input.additionalCredentials?.length ? {
|
|
363
|
+
verifiableCredential: [
|
|
364
|
+
getProfessionalIdentityVC({
|
|
365
|
+
actorDid: input.actorDid,
|
|
366
|
+
role: input.role,
|
|
367
|
+
...(input.email ? { email: input.email } : {}),
|
|
368
|
+
...(input.sameAs ? { sameAs: input.sameAs } : {}),
|
|
369
|
+
...(input.telephone ? { telephone: input.telephone } : {}),
|
|
370
|
+
...(input.credentialMaterial ? { credentialMaterial: input.credentialMaterial } : {}),
|
|
371
|
+
}),
|
|
372
|
+
...input.additionalCredentials.map(credential => credential),
|
|
373
|
+
],
|
|
374
|
+
} : {}),
|
|
362
375
|
});
|
|
363
376
|
return this.signCompactJws(context, {
|
|
364
377
|
header: { typ: 'JWT', jwk: vpSigningKey.publicJwk },
|
|
@@ -281,6 +281,13 @@ export type ServerProfessionalOpenInput = Readonly<{
|
|
|
281
281
|
pin?: string;
|
|
282
282
|
/** Server-only seed already authorized by a product passkey/session policy. */
|
|
283
283
|
authorizedWalletSeed?: string;
|
|
284
|
+
/** Provider tenant selected by a server-authorized inter-tenant workflow. */
|
|
285
|
+
target?: Readonly<{
|
|
286
|
+
providerDid: string;
|
|
287
|
+
routeContext: RouteContext;
|
|
288
|
+
}>;
|
|
289
|
+
/** Verified access credentials appended to the managed professional VP. */
|
|
290
|
+
accessCredentials?: ReadonlyArray<object>;
|
|
284
291
|
}>;
|
|
285
292
|
/** Business authorization requested from SMART; OpenID/JWT fields stay SDK-owned. */
|
|
286
293
|
export type ServerProfessionalSmartTokenInput = Readonly<{
|
|
@@ -582,13 +582,17 @@ export class ServerProfileSessionManager {
|
|
|
582
582
|
const wallet = await this.createWallet(walletKeyDerivationId, seed);
|
|
583
583
|
const context = walletContext(walletKeyDerivationId);
|
|
584
584
|
await requireRegisteredProfileKeys(wallet, context, profile);
|
|
585
|
+
const targetProviderDid = String(input.target?.providerDid || profile.providerDid).trim();
|
|
586
|
+
const targetRouteContext = input.target?.routeContext || profile.routeContext;
|
|
587
|
+
if (!targetProviderDid)
|
|
588
|
+
throw new Error('Opening a professional requires a target provider DID.');
|
|
585
589
|
const secureTransportAdapter = {
|
|
586
|
-
pack: (message) => wallet.packForRecipientWithContext(bindOrganizationControllerTransport(message, profile
|
|
590
|
+
pack: (message) => wallet.packForRecipientWithContext(bindOrganizationControllerTransport(message, { ...profile, providerDid: targetProviderDid }), targetProviderDid, { context }),
|
|
587
591
|
unpack: async (jwe) => (await wallet.unpackWithContext(jwe, { context })).content,
|
|
588
592
|
};
|
|
589
593
|
const operationalClient = new NodeHttpClient({
|
|
590
594
|
baseUrl: this.options.gatewayBaseUrl,
|
|
591
|
-
ctx:
|
|
595
|
+
ctx: targetRouteContext,
|
|
592
596
|
bearerToken: idToken,
|
|
593
597
|
fetchImpl: this.options.fetchImpl,
|
|
594
598
|
appInfo: this.options.appInfo,
|
|
@@ -608,7 +612,7 @@ export class ServerProfileSessionManager {
|
|
|
608
612
|
const now = this.now();
|
|
609
613
|
const audience = [
|
|
610
614
|
this.options.gatewayBaseUrl.replace(/\/+$/, ''),
|
|
611
|
-
buildIdentityOpenIdSmartTokenPath(
|
|
615
|
+
buildIdentityOpenIdSmartTokenPath(targetRouteContext),
|
|
612
616
|
].join('');
|
|
613
617
|
const clientAssertion = await buildWalletClientAssertion(wallet, profile, audience, now);
|
|
614
618
|
const vpToken = await buildManagedProfessionalVp(wallet, context, {
|
|
@@ -617,9 +621,10 @@ export class ServerProfileSessionManager {
|
|
|
617
621
|
profileDid: profile.profileDid,
|
|
618
622
|
...input.professionalProof,
|
|
619
623
|
role,
|
|
624
|
+
additionalCredentials: input.accessCredentials,
|
|
620
625
|
});
|
|
621
626
|
return smartSdk.requestSmartToken({
|
|
622
|
-
...
|
|
627
|
+
...targetRouteContext,
|
|
623
628
|
actorDid: profile.actorDid,
|
|
624
629
|
subjectDid: String(smart.subjectDid || '').trim() || undefined,
|
|
625
630
|
clientId: profile.clientId,
|
|
@@ -654,7 +659,7 @@ export class ServerProfileSessionManager {
|
|
|
654
659
|
searchDigitalTwins: (search) => {
|
|
655
660
|
if (!digitalTwinAccessToken)
|
|
656
661
|
throw new Error('Digital twin SMART token has not been granted.');
|
|
657
|
-
return digitalTwin.search(
|
|
662
|
+
return digitalTwin.search(targetRouteContext, { ...search, accessToken: digitalTwinAccessToken });
|
|
658
663
|
},
|
|
659
664
|
};
|
|
660
665
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gdc-sdk-node-ts",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.6",
|
|
4
4
|
"description": "Next-generation Node runtime package for the GDC SDK family",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Antifraud Services Inc.",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"test:e2e:live-gw:clean": "bash ./scripts/run-live-gw-clean.sh"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"gdc-common-utils-ts": "2.8.
|
|
41
|
+
"gdc-common-utils-ts": "2.8.5",
|
|
42
42
|
"gdc-sdk-core-ts": "2.5.4"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|