gdc-sdk-node-ts 2.4.23 → 2.4.30
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/README.md +18 -7
- package/dist/constants/lifecycle.d.ts +8 -0
- package/dist/constants/lifecycle.js +8 -0
- package/dist/device-activation.d.ts +48 -1
- package/dist/device-activation.js +157 -1
- package/dist/digital-twin.d.ts +4 -0
- package/dist/digital-twin.js +16 -4
- package/dist/host-onboarding.d.ts +7 -0
- package/dist/node-managed-wallet.d.ts +41 -1
- package/dist/node-managed-wallet.js +52 -0
- package/dist/node-runtime-client.d.ts +39 -4
- package/dist/node-runtime-client.js +142 -51
- package/dist/orchestration/client-port.d.ts +11 -1
- package/dist/orchestration/digital-twin-sdk.js +3 -1
- package/dist/orchestration/host-onboarding-sdk.d.ts +9 -3
- package/dist/orchestration/host-onboarding-sdk.js +10 -1
- package/dist/orchestration/individual-controller-sdk.d.ts +29 -3
- package/dist/orchestration/individual-controller-sdk.js +48 -2
- package/dist/orchestration/organization-controller-sdk.d.ts +19 -6
- package/dist/orchestration/organization-controller-sdk.js +27 -6
- package/dist/organization-controller-recovery.d.ts +4 -2
- package/dist/organization-controller-recovery.js +14 -8
- package/dist/organization-employee-lifecycle.d.ts +4 -0
- package/dist/organization-employee-lifecycle.js +17 -1
- package/dist/organization-license-order.d.ts +8 -3
- package/dist/resource-operations.d.ts +67 -0
- package/dist/resource-operations.js +62 -1
- package/dist/runtime-client-paths.d.ts +10 -0
- package/dist/runtime-client-paths.js +10 -0
- package/dist/server-profile-session.d.ts +32 -3
- package/dist/server-profile-session.js +21 -17
- package/package.json +1 -1
|
@@ -57,24 +57,53 @@ export type ServerProfileStore = Readonly<{
|
|
|
57
57
|
deleteSession(sessionId: string): Promise<void>;
|
|
58
58
|
}>;
|
|
59
59
|
export type ServerProfileEnrollmentInput = Readonly<{
|
|
60
|
+
/** Stable confidential id of the authenticated portal account that owns and lists this profile. */
|
|
60
61
|
ownerId: string;
|
|
62
|
+
/** Stable local id of this wallet/profile record. This is not the DCR `client_id`. */
|
|
61
63
|
profileId: string;
|
|
64
|
+
/** SDK capability family being enrolled, for example an organization controller or employee. */
|
|
62
65
|
actorKind: ActorKind;
|
|
66
|
+
/** Authorization semantics already granted to the profile; never take this from an untrusted UI field. */
|
|
63
67
|
actorMode: ServerActorMode;
|
|
68
|
+
/** Exact role/controller DID used by the actor proof, including the VP issuer when a VP is supplied. */
|
|
64
69
|
actorDid: string;
|
|
70
|
+
/** DID represented by the managed wallet. It may equal `actorDid`, as in a controller enrollment. */
|
|
65
71
|
profileDid: string;
|
|
72
|
+
/** Organization/provider DID whose configured route and policies this profile will use. */
|
|
66
73
|
providerDid: string;
|
|
74
|
+
/** Server-owned tenant, jurisdiction and sector routing context. */
|
|
67
75
|
routeContext: RouteContext;
|
|
76
|
+
/** Server-derived subject authorization boundary; never accept arbitrary browser-selected DIDs here. */
|
|
68
77
|
allowedSubjectDids: string[];
|
|
78
|
+
/**
|
|
79
|
+
* Unlock secret for the locally protected wallet seed. It is neither sent
|
|
80
|
+
* to GW nor persisted by the SDK. The integrating product decides whether
|
|
81
|
+
* it is user-entered or a separately stored, high-entropy per-profile BFF
|
|
82
|
+
* secret; it must never be logged or reused as one shared deployment PIN.
|
|
83
|
+
*/
|
|
69
84
|
pin: string;
|
|
85
|
+
/**
|
|
86
|
+
* Signed OIDC `id_token` used by GW to bind the activation code to an
|
|
87
|
+
* authenticated account/email. Its issuer, audience, signature `kid` and
|
|
88
|
+
* public JWKS must be trusted by GW. A controller VP cannot replace it.
|
|
89
|
+
*/
|
|
70
90
|
idToken: string;
|
|
91
|
+
/** One-time code returned by the completed organization flow or employee `License/_issue`. */
|
|
71
92
|
activationCode: string;
|
|
72
|
-
/**
|
|
93
|
+
/**
|
|
94
|
+
* Optional explicit installation identity. Normally omit it so the SDK
|
|
95
|
+
* derives the identity from the wallet key it creates for this profile.
|
|
96
|
+
*/
|
|
73
97
|
clientInstanceId?: string;
|
|
98
|
+
/** Signed actor/controller VP protected with the profile for later proof and session operations. */
|
|
74
99
|
vpToken: string;
|
|
75
|
-
/**
|
|
100
|
+
/** Redirect URIs owned by this portal/app installation. */
|
|
101
|
+
redirectUris?: string[];
|
|
102
|
+
/** Human-readable portal/app name. */
|
|
103
|
+
clientName?: string;
|
|
104
|
+
/** @deprecated Use `redirectUris`; OpenID metadata is authored internally. */
|
|
76
105
|
dcrRedirectUris?: string[];
|
|
77
|
-
/**
|
|
106
|
+
/** @deprecated Use `clientName`; OpenID metadata is authored internally. */
|
|
78
107
|
dcrClientName?: string;
|
|
79
108
|
/**
|
|
80
109
|
* Optional server-only recovery seed. It must be 32 bytes encoded as
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// Copyright 2026 Antifraud Services Inc. under the Apache License, Version 2.0.
|
|
2
2
|
import { randomBytes } from 'node:crypto';
|
|
3
|
-
import { IdentityDcrMetadataFields, IdentityDeviceInfoFields } from 'gdc-common-utils-ts/constants/identity-auth';
|
|
4
3
|
import { ActorKinds } from 'gdc-common-utils-ts/constants/actor-session';
|
|
5
4
|
import { TransportProfiles, } from 'gdc-sdk-core-ts';
|
|
6
5
|
import { NodeManagedWallet } from './node-managed-wallet.js';
|
|
7
6
|
import { NodeHttpClient } from './node-runtime-client.js';
|
|
8
7
|
import { buildIdentityOpenIdSmartTokenPath } from './runtime-paths.js';
|
|
8
|
+
import { createProfileDeviceActivationRequest } from './device-activation.js';
|
|
9
9
|
import { ProfilePinRejectedError, openServerProfileSecret, protectServerProfileSecret, } from './server-profile-protection.js';
|
|
10
10
|
/**
|
|
11
11
|
* Coordinates device registration, two-factor profile protection and SMART sessions.
|
|
@@ -36,23 +36,26 @@ export class ServerProfileSessionManager {
|
|
|
36
36
|
const storagePublicJwk = publicKeys.find((entry) => entry.purpose === 'document-at-rest')?.publicJwk;
|
|
37
37
|
if (!storagePublicJwk)
|
|
38
38
|
throw new Error('Server profile enrollment requires a document-at-rest ML-KEM key.');
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
const idToken = String(input.idToken || '').trim();
|
|
40
|
+
if (!idToken)
|
|
41
|
+
throw new Error('Profile enrollment requires a signed OIDC idToken for account/email binding.');
|
|
42
|
+
const client = this.createClient(input.routeContext, idToken);
|
|
43
|
+
const redirectUris = input.redirectUris || input.dcrRedirectUris || [];
|
|
44
|
+
const clientName = String(input.clientName || input.dcrClientName || '').trim();
|
|
45
|
+
const activationRequest = createProfileDeviceActivationRequest({
|
|
42
46
|
activationCode: input.activationCode,
|
|
43
|
-
idToken
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
});
|
|
47
|
+
idToken,
|
|
48
|
+
...input.routeContext,
|
|
49
|
+
})
|
|
50
|
+
.setClientInstanceId(clientInstanceId)
|
|
51
|
+
.setClientName(clientName)
|
|
52
|
+
.setApplicationType('web')
|
|
53
|
+
.setRedirectUris(redirectUris)
|
|
54
|
+
.setPublicJwks(publicKeys.filter((entry) => entry.purpose !== 'document-at-rest').map((entry) => entry.publicJwk))
|
|
55
|
+
.setActorDid(input.actorDid)
|
|
56
|
+
.setProfileDid(input.profileDid)
|
|
57
|
+
.build();
|
|
58
|
+
const activation = await client.activateProfileDeviceWithActivationRequest(activationRequest);
|
|
56
59
|
const dcrBody = terminalBody(activation.dcr.poll.body);
|
|
57
60
|
const clientId = findText(dcrBody, ['client_id', 'clientId']);
|
|
58
61
|
if (!clientId)
|
|
@@ -357,6 +360,7 @@ function requireEnrollment(input) {
|
|
|
357
360
|
profileDid: input.profileDid,
|
|
358
361
|
providerDid: input.providerDid,
|
|
359
362
|
activationCode: input.activationCode,
|
|
363
|
+
idToken: input.idToken,
|
|
360
364
|
vpToken: input.vpToken,
|
|
361
365
|
}))
|
|
362
366
|
if (!String(value || '').trim())
|