@safetech/inheriti-client-sdk 1.17.2 → 1.17.3
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 +9 -0
- package/dist/browser.d.ts +23 -0
- package/dist/browser.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/inheriti-client-sdk.umd.js +86 -83
- package/dist/node.d.ts +12 -3
- package/dist/node.js +1 -1
- package/dist/sdk-types.d.ts +711 -19
- package/dist/src/auth/inheriti-client-provider.d.ts +1 -1
- package/dist/src/elements/core-plan-material-builder.d.ts +40 -0
- package/dist/src/elements/elements-api-port.d.ts +88 -3
- package/dist/src/elements/elements-client.d.ts +58 -12
- package/dist/src/elements/guided-plan-creator.d.ts +47 -0
- package/dist/src/elements/http-elements-api-port.d.ts +17 -1
- package/dist/src/elements/index.d.ts +10 -1
- package/dist/src/elements/plan-operation-codec.d.ts +4 -0
- package/dist/src/elements/plan-operations.d.ts +160 -0
- package/dist/src/elements/polling-shared-plan-event-listener.d.ts +29 -0
- package/dist/src/elements/reveal-session-operations.d.ts +13 -0
- package/dist/src/elements/scoped-reveal.d.ts +44 -0
- package/dist/src/operator-auth/defaults.d.ts +9 -0
- package/dist/src/operator-auth/errors.d.ts +11 -0
- package/dist/src/operator-auth/http-operator-auth-transport.d.ts +16 -0
- package/dist/src/operator-auth/index.d.ts +7 -0
- package/dist/src/operator-auth/operator-auth-client.d.ts +35 -0
- package/dist/src/operator-auth/operator-session-controller.d.ts +10 -0
- package/dist/src/operator-auth/ports.d.ts +53 -0
- package/dist/src/operator-auth/types.d.ts +77 -0
- package/docs/docs.json +18331 -0
- package/docs/elements-shared-mode.md +28 -0
- package/docs/operator-auth.md +76 -0
- package/docs/plan-operations.md +41 -0
- package/index.ts +1 -0
- package/node.ts +21 -4
- package/package.json +14 -3
package/dist/sdk-types.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { SDKContainer } from '@safetech/inheriti-core-sdk/vanilla';
|
|
2
2
|
export { SDKContainer } from '@safetech/inheriti-core-sdk/vanilla';
|
|
3
|
-
import { ValidEnv, AuthClientProps, MasterKeySource } from '@safetech/inheriti-core-sdk';
|
|
3
|
+
import { ValidEnv, AuthClientProps, MasterKeySource, PlanAssetDeclaration, DataAsset } from '@safetech/inheriti-core-sdk';
|
|
4
4
|
export * from '@safetech/inheriti-core-sdk';
|
|
5
|
-
import * as
|
|
5
|
+
import * as react from 'react';
|
|
6
6
|
import { ReactNode } from 'react';
|
|
7
|
+
import { BearerTokenResolver, HttpTransport } from '@safetech/inheriti-core-sdk/node';
|
|
8
|
+
import { ProcessRuntimeEnvironment, ProcessReconciliationOwnership, SharedPlanEventListener, SharedPlanEventHandlers } from '@safetech/inheriti-core-sdk/shared-configuration';
|
|
7
9
|
|
|
8
10
|
/**
|
|
9
11
|
* Props for the `InheritiClientProvider` component.
|
|
@@ -35,7 +37,7 @@ interface InheritiClientProviderProps {
|
|
|
35
37
|
*
|
|
36
38
|
* @param props - The provider props including children, clientId, and options.
|
|
37
39
|
*/
|
|
38
|
-
declare function InheritiClientProvider({ children, clientId, options }: InheritiClientProviderProps):
|
|
40
|
+
declare function InheritiClientProvider({ children, clientId, options }: InheritiClientProviderProps): react.JSX.Element;
|
|
39
41
|
|
|
40
42
|
/**
|
|
41
43
|
* Wraps core's useClient to update the httpClient's apiUrl
|
|
@@ -145,6 +147,167 @@ declare class MemoryStatePort implements StatePort {
|
|
|
145
147
|
remove(key: string): Promise<void>;
|
|
146
148
|
}
|
|
147
149
|
|
|
150
|
+
declare const CANONICAL_PLAN_ASSET_TYPES: readonly ["PLAIN-TEXT", "USER-PSWD", "RECOVERY-CODE", "PIN-CODE", "API-KEY", "PRIVATE-KEY", "SEED-PHRASE", "PAYMENT-DEBIT-CARD", "PAYMENT-CREDIT-CARD", "DOCUMENT", "IMAGE", "VIDEO"];
|
|
151
|
+
type CanonicalPlanAssetType = (typeof CANONICAL_PLAN_ASSET_TYPES)[number];
|
|
152
|
+
declare const CANONICAL_STRUCTURED_ASSET_FIELDS: Readonly<Record<Exclude<CanonicalPlanAssetType, 'DOCUMENT' | 'IMAGE' | 'VIDEO'>, readonly string[]>>;
|
|
153
|
+
type CompatibleValue<T extends string> = T | {
|
|
154
|
+
readonly kind: 'UNKNOWN';
|
|
155
|
+
readonly raw: string;
|
|
156
|
+
};
|
|
157
|
+
type PlanStatus = CompatibleValue<'DRAFT' | 'ACTIVE' | 'CONFIGURED' | 'ARCHIVED'>;
|
|
158
|
+
type PlanGovernanceMode = CompatibleValue<'DIRECT' | 'GOVERNED'>;
|
|
159
|
+
type PlanParticipantRelationship = 'OWNER' | 'MERGER' | 'MODERATOR' | 'CUSTODIAN' | 'ALLOW' | 'DENY';
|
|
160
|
+
interface PlanAssetSummary {
|
|
161
|
+
count: number;
|
|
162
|
+
types: CompatibleValue<CanonicalPlanAssetType>[];
|
|
163
|
+
}
|
|
164
|
+
interface PlanSummary {
|
|
165
|
+
id: string;
|
|
166
|
+
name: string;
|
|
167
|
+
description?: string;
|
|
168
|
+
status: PlanStatus;
|
|
169
|
+
createdAt: string;
|
|
170
|
+
configuredAt?: string;
|
|
171
|
+
assetSummary: PlanAssetSummary;
|
|
172
|
+
governance: {
|
|
173
|
+
mode: PlanGovernanceMode;
|
|
174
|
+
minimumApprovals: number;
|
|
175
|
+
};
|
|
176
|
+
participantSummary: {
|
|
177
|
+
owners: number;
|
|
178
|
+
mergers: number;
|
|
179
|
+
moderators: number;
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
interface PlanPage {
|
|
183
|
+
items: PlanSummary[];
|
|
184
|
+
nextCursor: string | null;
|
|
185
|
+
}
|
|
186
|
+
interface ListPlansInput {
|
|
187
|
+
cursor?: string;
|
|
188
|
+
limit?: number;
|
|
189
|
+
status?: readonly string[];
|
|
190
|
+
assetType?: CanonicalPlanAssetType;
|
|
191
|
+
namePrefix?: string;
|
|
192
|
+
}
|
|
193
|
+
interface PlanDetail extends PlanSummary {
|
|
194
|
+
assets: Array<{
|
|
195
|
+
id: string;
|
|
196
|
+
/** Developer-defined stable address. Older plans may not have one and fall back to `id`. */
|
|
197
|
+
code?: string;
|
|
198
|
+
type: CompatibleValue<CanonicalPlanAssetType>;
|
|
199
|
+
name: string;
|
|
200
|
+
isBinary: boolean;
|
|
201
|
+
fieldNames: string[];
|
|
202
|
+
matchOrigins?: string[];
|
|
203
|
+
}>;
|
|
204
|
+
participants: Array<{
|
|
205
|
+
id: string;
|
|
206
|
+
displayName: string;
|
|
207
|
+
relationships: CompatibleValue<PlanParticipantRelationship>[];
|
|
208
|
+
lifecycle: CompatibleValue<'ACTIVE' | 'REVOKED'>;
|
|
209
|
+
}>;
|
|
210
|
+
revealPolicy: {
|
|
211
|
+
masterKeyRelease: CompatibleValue<'REQUIRED'>;
|
|
212
|
+
custodian: CompatibleValue<'FORCE' | 'BYPASS'>;
|
|
213
|
+
};
|
|
214
|
+
source: {
|
|
215
|
+
kind: 'NATIVE';
|
|
216
|
+
} | {
|
|
217
|
+
kind: 'BRIDGED';
|
|
218
|
+
system: CompatibleValue<'INHERITI_BUSINESS'>;
|
|
219
|
+
status: CompatibleValue<'IN_SYNC' | 'RECONCILIATION_REQUIRED'>;
|
|
220
|
+
} | {
|
|
221
|
+
kind: 'UNKNOWN';
|
|
222
|
+
raw: string;
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
interface IntegrationPlanAssetDeclaration {
|
|
226
|
+
clientAssetRef: string;
|
|
227
|
+
type: CanonicalPlanAssetType;
|
|
228
|
+
name: string;
|
|
229
|
+
fieldNames?: readonly string[];
|
|
230
|
+
isBinary: boolean;
|
|
231
|
+
fileName?: string;
|
|
232
|
+
mimeType?: string;
|
|
233
|
+
size?: number;
|
|
234
|
+
}
|
|
235
|
+
interface NativePlanParticipant {
|
|
236
|
+
clientParticipantRef: string;
|
|
237
|
+
/** Routing only. It is not identity or evidence of a SafeID/SafeKey account. */
|
|
238
|
+
routingEmail: string;
|
|
239
|
+
displayName: string;
|
|
240
|
+
relationships: readonly PlanParticipantRelationship[];
|
|
241
|
+
}
|
|
242
|
+
interface StartPlanCreationInput {
|
|
243
|
+
idempotencyKey: string;
|
|
244
|
+
name: string;
|
|
245
|
+
description?: string;
|
|
246
|
+
assets: readonly IntegrationPlanAssetDeclaration[];
|
|
247
|
+
participants: readonly NativePlanParticipant[];
|
|
248
|
+
policy?: {
|
|
249
|
+
governance?: 'DIRECT' | 'GOVERNED';
|
|
250
|
+
minimumApprovals?: number;
|
|
251
|
+
masterKeyRelease?: 'REQUIRED';
|
|
252
|
+
custodian?: 'FORCE' | 'BYPASS';
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
declare const PLAN_CREATION_SERVER_STAGES: readonly ["VALIDATED", "PLAN_CREATED", "PARTICIPANTS_PERSISTED", "STORAGE_PREPARED", "AWAITING_ENCRYPTED_MATERIAL", "VALIDATOR_SHARES_DISTRIBUTED", "CONFIGURED", "COMPLETED"];
|
|
256
|
+
type PlanCreationServerStage = (typeof PLAN_CREATION_SERVER_STAGES)[number];
|
|
257
|
+
type PlanCreationOutcome = 'IN_PROGRESS' | 'COMPLETED' | 'CANCELED' | 'FAILED_RETRYABLE' | 'FAILED_TERMINAL' | 'RECONCILIATION_REQUIRED';
|
|
258
|
+
interface PlanCreationProgress {
|
|
259
|
+
operationId: string;
|
|
260
|
+
stage: CompatibleValue<PlanCreationServerStage>;
|
|
261
|
+
outcome: CompatibleValue<PlanCreationOutcome>;
|
|
262
|
+
planId?: string;
|
|
263
|
+
lastErrorCode?: string;
|
|
264
|
+
participants?: Array<{
|
|
265
|
+
clientParticipantRef: string;
|
|
266
|
+
planParticipantId: string;
|
|
267
|
+
relationships: PlanParticipantRelationship[];
|
|
268
|
+
}>;
|
|
269
|
+
}
|
|
270
|
+
interface EncryptedPlanMaterial {
|
|
271
|
+
protectionProtocol?: 'SSDP_PLUS_V1' | 'SSDP_PLUS_V2';
|
|
272
|
+
validatorShares?: readonly EncryptedPlanShard[];
|
|
273
|
+
dataShards: readonly EncryptedPlanShard[];
|
|
274
|
+
backupShards: readonly EncryptedPlanShard[];
|
|
275
|
+
encryptedKey?: string;
|
|
276
|
+
assetsMetadata?: Readonly<Record<string, {
|
|
277
|
+
type: CanonicalPlanAssetType;
|
|
278
|
+
meta: {
|
|
279
|
+
name: string;
|
|
280
|
+
notes?: string;
|
|
281
|
+
};
|
|
282
|
+
}>>;
|
|
283
|
+
custodianShard?: {
|
|
284
|
+
keyShard: EncryptedPlanShard;
|
|
285
|
+
dataShard: EncryptedPlanShard;
|
|
286
|
+
};
|
|
287
|
+
operation?: 'DRAFT' | 'FINALIZE';
|
|
288
|
+
}
|
|
289
|
+
interface EncryptedPlanShard {
|
|
290
|
+
id: string;
|
|
291
|
+
data?: string;
|
|
292
|
+
}
|
|
293
|
+
type GuidedCreateLocalStage = 'VALIDATING_ASSETS' | 'ENCRYPTING' | 'GENERATING_SHARES';
|
|
294
|
+
interface GuidedCreateCheckpoint {
|
|
295
|
+
idempotencyKey: string;
|
|
296
|
+
operationId: string;
|
|
297
|
+
declarationHash: string;
|
|
298
|
+
serverStage: CompatibleValue<PlanCreationServerStage>;
|
|
299
|
+
}
|
|
300
|
+
declare class InvalidPlanDeclaration extends Error {
|
|
301
|
+
readonly code: string;
|
|
302
|
+
constructor(code: string);
|
|
303
|
+
}
|
|
304
|
+
declare class InvalidPlanMaterial extends Error {
|
|
305
|
+
readonly code: string;
|
|
306
|
+
constructor(code: string);
|
|
307
|
+
}
|
|
308
|
+
declare function validatePlanCreationMaterial(material: EncryptedPlanMaterial): void;
|
|
309
|
+
declare function validatePlanCreationInput(input: StartPlanCreationInput): void;
|
|
310
|
+
|
|
148
311
|
interface CollectedPlanMaterial {
|
|
149
312
|
planId: string;
|
|
150
313
|
mergeThreshold: number;
|
|
@@ -157,7 +320,7 @@ interface CollectedPlanMaterial {
|
|
|
157
320
|
}>;
|
|
158
321
|
verifiedStorageLayerTypes: string[];
|
|
159
322
|
/** True when `planKey` is still sealed under a master key and must be unwrapped. */
|
|
160
|
-
masterKeyWrapped
|
|
323
|
+
masterKeyWrapped: boolean;
|
|
161
324
|
/** The tenant holding the plan. With no source reference, this names the key. */
|
|
162
325
|
tenantId?: string;
|
|
163
326
|
/** Present when the plan came from another system, whose key still opens it. */
|
|
@@ -179,6 +342,12 @@ interface PlanKeyReference {
|
|
|
179
342
|
};
|
|
180
343
|
}
|
|
181
344
|
interface ElementsApiPort {
|
|
345
|
+
listPlans(input?: ListPlansInput): Promise<PlanPage>;
|
|
346
|
+
getPlan(planId: string): Promise<PlanDetail>;
|
|
347
|
+
startPlanCreation(input: StartPlanCreationInput): Promise<PlanCreationProgress>;
|
|
348
|
+
getPlanCreation(operationId: string): Promise<PlanCreationProgress>;
|
|
349
|
+
supplyPlanCreationMaterial(operationId: string, material: EncryptedPlanMaterial): Promise<PlanCreationProgress>;
|
|
350
|
+
cancelPlanCreation(operationId: string): Promise<PlanCreationProgress>;
|
|
182
351
|
planKeyReference(planId: string): Promise<PlanKeyReference>;
|
|
183
352
|
collectPlanMaterial(planId: string, stepUp?: StepUpReadContext): Promise<CollectedPlanMaterial>;
|
|
184
353
|
initializeGovernedReveal(planId: string, stepUp?: StepUpReadContext): Promise<GovernedRevealSession>;
|
|
@@ -189,6 +358,15 @@ interface ElementsApiPort {
|
|
|
189
358
|
markGovernedSharesReconstructed(processId: string): Promise<void>;
|
|
190
359
|
markGovernedDataRevealed(processId: string): Promise<void>;
|
|
191
360
|
closeGovernedReveal(processId: string): Promise<void>;
|
|
361
|
+
startReveal(planId: string, input: StartRevealInput): Promise<RevealSession>;
|
|
362
|
+
getReveal(revealId: string): Promise<RevealSession>;
|
|
363
|
+
releaseRevealMaterial(revealId: string, materialVersion: string): Promise<unknown>;
|
|
364
|
+
reportRevealReconstruction(revealId: string, input: RevealReconstructionInput): Promise<RevealSession>;
|
|
365
|
+
closeReveal(revealId: string, reason: RevealCloseReason): Promise<RevealSession>;
|
|
366
|
+
authorizeRevealAction(revealId: string, input: AuthorizeRevealActionInput): Promise<RevealAction>;
|
|
367
|
+
reportRevealActionOutcome(revealId: string, actionId: string, input: ReportRevealActionOutcomeInput): Promise<RevealAction>;
|
|
368
|
+
getCustodianShare(processId: string, stepUp?: StepUpReadContext): Promise<CustodianShareResult>;
|
|
369
|
+
releaseCustodianShare(processId: string): Promise<void>;
|
|
192
370
|
exportPlanBridge(planId: string, input: ExportPlanBridgeInput): Promise<PlanBridgeEnvelope>;
|
|
193
371
|
importPlanBridge(envelope: PlanBridgeEnvelope): Promise<{
|
|
194
372
|
planId: string;
|
|
@@ -206,7 +384,7 @@ interface ExportPlanBridgeInput {
|
|
|
206
384
|
}
|
|
207
385
|
interface PlanRevealProfile {
|
|
208
386
|
governance: 'KEEP' | 'BYPASS';
|
|
209
|
-
masterKeyRelease: 'REQUIRED'
|
|
387
|
+
masterKeyRelease: 'REQUIRED';
|
|
210
388
|
custodian: 'BYPASS' | 'FORCE';
|
|
211
389
|
}
|
|
212
390
|
interface PlanBridgeEnvelope {
|
|
@@ -283,7 +461,7 @@ interface GovernedRevealSession {
|
|
|
283
461
|
mergeThreshold: number;
|
|
284
462
|
status?: string;
|
|
285
463
|
/** Same key signalling the direct collection route returns, for the governed path. */
|
|
286
|
-
masterKeyWrapped
|
|
464
|
+
masterKeyWrapped: boolean;
|
|
287
465
|
tenantId?: string;
|
|
288
466
|
sourceReference?: {
|
|
289
467
|
system: string;
|
|
@@ -314,6 +492,76 @@ interface GovernedSharesMaterial {
|
|
|
314
492
|
keyShards: GovernedShare[];
|
|
315
493
|
dek: string;
|
|
316
494
|
}
|
|
495
|
+
type RevealMode = 'DIRECT' | 'GOVERNED';
|
|
496
|
+
type RevealStage = 'STARTING' | 'WAITING_FOR_PARTICIPANTS' | 'AUTHORIZED' | 'MATERIAL_AUTHORIZED' | 'MATERIAL_RELEASED' | 'RECONSTRUCTED' | 'ACTIONS_OPEN' | 'CLOSING' | 'CLOSED' | 'DENIED' | 'PARTICIPANT_REVOKED' | 'RECONCILIATION_REQUIRED' | 'EXPIRED' | 'CANCELED' | 'FAILED';
|
|
497
|
+
type RevealCloseReason = 'COMPLETED' | 'CANCELED' | 'ERROR';
|
|
498
|
+
type RevealActionType = 'VIEW_FIELD' | 'COPY_FIELD' | 'EXPORT_ASSET' | 'AUTOFILL_FIELD' | 'INSERT_FIELD';
|
|
499
|
+
type RevealActionOutcome = 'SUCCEEDED' | 'FAILED' | 'CANCELED';
|
|
500
|
+
interface StartRevealInput {
|
|
501
|
+
mode: RevealMode;
|
|
502
|
+
idempotencyKey: string;
|
|
503
|
+
}
|
|
504
|
+
interface RevealReconstructionInput {
|
|
505
|
+
status: 'SUCCEEDED' | 'FAILED';
|
|
506
|
+
errorCode?: string;
|
|
507
|
+
}
|
|
508
|
+
interface RevealSession {
|
|
509
|
+
id: string;
|
|
510
|
+
idempotencyKey: string;
|
|
511
|
+
applicationId: string;
|
|
512
|
+
environment: 'TEST' | 'LIVE';
|
|
513
|
+
planId: string;
|
|
514
|
+
mode: RevealMode;
|
|
515
|
+
stage: RevealStage;
|
|
516
|
+
materialVersion?: string;
|
|
517
|
+
expiresAt: string;
|
|
518
|
+
createdAt: string;
|
|
519
|
+
updatedAt: string;
|
|
520
|
+
participantDecisions?: unknown;
|
|
521
|
+
/** Server-resolved governed progress. Omitted for direct reveals or unavailable source progress. */
|
|
522
|
+
approvedModerators?: number;
|
|
523
|
+
requiredModerators?: number;
|
|
524
|
+
closedReason?: RevealCloseReason;
|
|
525
|
+
}
|
|
526
|
+
interface AuthorizeRevealActionInput {
|
|
527
|
+
idempotencyKey: string;
|
|
528
|
+
assetId: string;
|
|
529
|
+
fieldName?: string;
|
|
530
|
+
action: RevealActionType;
|
|
531
|
+
origin?: string;
|
|
532
|
+
}
|
|
533
|
+
interface ReportRevealActionOutcomeInput {
|
|
534
|
+
idempotencyKey: string;
|
|
535
|
+
outcome: RevealActionOutcome;
|
|
536
|
+
reportedAt: string;
|
|
537
|
+
errorCode?: string;
|
|
538
|
+
}
|
|
539
|
+
interface RevealAction {
|
|
540
|
+
id: string;
|
|
541
|
+
revealId: string;
|
|
542
|
+
assetId: string;
|
|
543
|
+
fieldName?: string;
|
|
544
|
+
action: RevealActionType;
|
|
545
|
+
status: 'AUTHORIZED' | RevealActionOutcome;
|
|
546
|
+
origin?: string;
|
|
547
|
+
outcome?: RevealActionOutcome;
|
|
548
|
+
errorCode?: string;
|
|
549
|
+
createdAt?: string;
|
|
550
|
+
updatedAt?: string;
|
|
551
|
+
}
|
|
552
|
+
type CustodianShareResult = {
|
|
553
|
+
status: 'PENDING';
|
|
554
|
+
} | {
|
|
555
|
+
id: string;
|
|
556
|
+
shares: string[];
|
|
557
|
+
planId: string;
|
|
558
|
+
isMergeAuthority: boolean;
|
|
559
|
+
};
|
|
560
|
+
declare class RevealActionsNotOpen extends Error {
|
|
561
|
+
readonly stage: string;
|
|
562
|
+
readonly code = "reveal_actions_not_open";
|
|
563
|
+
constructor(stage: string);
|
|
564
|
+
}
|
|
317
565
|
declare class ElementsApiPortRequired extends Error {
|
|
318
566
|
constructor();
|
|
319
567
|
}
|
|
@@ -329,6 +577,94 @@ declare class PlanMaterialReconstructorRequired extends Error {
|
|
|
329
577
|
constructor();
|
|
330
578
|
}
|
|
331
579
|
|
|
580
|
+
interface GuidedCreateCheckpointStore {
|
|
581
|
+
load(operationId: string): Promise<GuidedCreateCheckpoint | undefined>;
|
|
582
|
+
save(checkpoint: GuidedCreateCheckpoint): Promise<void>;
|
|
583
|
+
remove(operationId: string): Promise<void>;
|
|
584
|
+
}
|
|
585
|
+
interface PlanMaterialBuilder<TSecrets, TEncrypted = unknown> {
|
|
586
|
+
encrypt(input: {
|
|
587
|
+
planId: string;
|
|
588
|
+
declaration: StartPlanCreationInput;
|
|
589
|
+
secrets: TSecrets;
|
|
590
|
+
signal?: AbortSignal;
|
|
591
|
+
}): Promise<TEncrypted>;
|
|
592
|
+
generateShares(input: {
|
|
593
|
+
planId: string;
|
|
594
|
+
declaration: StartPlanCreationInput;
|
|
595
|
+
encrypted: TEncrypted;
|
|
596
|
+
signal?: AbortSignal;
|
|
597
|
+
}): Promise<EncryptedPlanMaterial>;
|
|
598
|
+
}
|
|
599
|
+
interface GuidedCreateOptions {
|
|
600
|
+
signal?: AbortSignal;
|
|
601
|
+
onProgress?: (stage: GuidedCreateLocalStage | PlanCreationProgress['stage']) => void;
|
|
602
|
+
}
|
|
603
|
+
/** Process-lifetime checkpoints. A host that must survive a restart supplies a durable store. */
|
|
604
|
+
declare class MemoryGuidedCreateCheckpointStore implements GuidedCreateCheckpointStore {
|
|
605
|
+
private readonly checkpoints;
|
|
606
|
+
load(operationId: string): Promise<GuidedCreateCheckpoint | undefined>;
|
|
607
|
+
save(checkpoint: GuidedCreateCheckpoint): Promise<void>;
|
|
608
|
+
remove(operationId: string): Promise<void>;
|
|
609
|
+
}
|
|
610
|
+
/** Resumable orchestration. Only its non-secret checkpoint may survive process restart. */
|
|
611
|
+
declare class GuidedPlanCreator {
|
|
612
|
+
private readonly api;
|
|
613
|
+
private readonly checkpoints;
|
|
614
|
+
constructor(api: ElementsApiPort, checkpoints: GuidedCreateCheckpointStore);
|
|
615
|
+
start(input: StartPlanCreationInput, options?: GuidedCreateOptions): Promise<PlanCreationProgress>;
|
|
616
|
+
status(operationId: string): Promise<PlanCreationProgress>;
|
|
617
|
+
resume<TSecrets, TEncrypted>(operationId: string, declaration: StartPlanCreationInput, secrets: TSecrets, builder: PlanMaterialBuilder<TSecrets, TEncrypted>, options?: GuidedCreateOptions): Promise<PlanCreationProgress>;
|
|
618
|
+
cancel(operationId: string): Promise<PlanCreationProgress>;
|
|
619
|
+
private saveCheckpoint;
|
|
620
|
+
}
|
|
621
|
+
declare class GuidedCreateRecoveryError extends Error {
|
|
622
|
+
readonly code: string;
|
|
623
|
+
constructor(code: string);
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
type AssetFieldSelector = string | {
|
|
627
|
+
asset: string;
|
|
628
|
+
field: string;
|
|
629
|
+
};
|
|
630
|
+
interface RevealFieldOptions {
|
|
631
|
+
action?: Exclude<RevealActionType, 'EXPORT_ASSET'>;
|
|
632
|
+
origin?: string;
|
|
633
|
+
idempotencyKey?: string;
|
|
634
|
+
}
|
|
635
|
+
interface OpenRevealOptions {
|
|
636
|
+
mode?: RevealMode;
|
|
637
|
+
idempotencyKey?: string;
|
|
638
|
+
signal?: AbortSignal;
|
|
639
|
+
pollIntervalMs?: number;
|
|
640
|
+
onSession?: (session: RevealSession) => void;
|
|
641
|
+
}
|
|
642
|
+
interface RevealHandle {
|
|
643
|
+
readonly session: RevealSession;
|
|
644
|
+
readonly material: Uint8Array;
|
|
645
|
+
readonly closed: boolean;
|
|
646
|
+
field<TValue = unknown>(selector: AssetFieldSelector, options?: RevealFieldOptions): Promise<TValue>;
|
|
647
|
+
close(reason?: RevealCloseReason): Promise<void>;
|
|
648
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
649
|
+
}
|
|
650
|
+
declare class RevealHandleClosed extends Error {
|
|
651
|
+
readonly code = "reveal_handle_closed";
|
|
652
|
+
constructor();
|
|
653
|
+
}
|
|
654
|
+
declare class RevealFieldAccessError extends Error {
|
|
655
|
+
readonly code: 'asset_selector_invalid' | 'asset_not_found' | 'asset_field_not_found' | 'action_not_allowed' | 'asset_decoder_required' | 'asset_value_invalid';
|
|
656
|
+
constructor(code: 'asset_selector_invalid' | 'asset_not_found' | 'asset_field_not_found' | 'action_not_allowed' | 'asset_decoder_required' | 'asset_value_invalid');
|
|
657
|
+
}
|
|
658
|
+
declare function parseAssetFieldSelector(selector: AssetFieldSelector): {
|
|
659
|
+
asset: string;
|
|
660
|
+
field: string;
|
|
661
|
+
};
|
|
662
|
+
|
|
663
|
+
interface DecodedPlanAsset {
|
|
664
|
+
id: string;
|
|
665
|
+
data: Uint8Array;
|
|
666
|
+
}
|
|
667
|
+
type PlanAssetContainerDecoder = (material: Uint8Array) => readonly DecodedPlanAsset[];
|
|
332
668
|
interface ElementsClientOptions {
|
|
333
669
|
coreSdk: SDKContainer;
|
|
334
670
|
keyVault?: KeyVault;
|
|
@@ -339,12 +675,13 @@ interface ElementsClientOptions {
|
|
|
339
675
|
* Resolves master keys per plan. A host may need several: its own Application key
|
|
340
676
|
* and a foreign organization key for each bridged plan it opens.
|
|
341
677
|
*/
|
|
342
|
-
masterKeys
|
|
678
|
+
masterKeys: MasterKeyResolver;
|
|
343
679
|
/** The Application this client acts for; needed to wrap keys of plans it creates. */
|
|
344
|
-
applicationId
|
|
680
|
+
applicationId: string;
|
|
681
|
+
assetDecoder: PlanAssetContainerDecoder;
|
|
345
682
|
}
|
|
346
683
|
declare class ElementsClient {
|
|
347
|
-
|
|
684
|
+
readonly coreSdk: SDKContainer;
|
|
348
685
|
readonly keyVault: KeyVault;
|
|
349
686
|
readonly state: StatePort;
|
|
350
687
|
constructor(coreSdk: SDKContainer, options?: {
|
|
@@ -354,22 +691,46 @@ declare class ElementsClient {
|
|
|
354
691
|
reconstructor?: PlanMaterialReconstructor;
|
|
355
692
|
masterKeys?: MasterKeyResolver;
|
|
356
693
|
applicationId?: string;
|
|
694
|
+
assetDecoder?: PlanAssetContainerDecoder;
|
|
357
695
|
});
|
|
358
696
|
private readonly api?;
|
|
359
697
|
private readonly reconstructor?;
|
|
360
698
|
private readonly masterKeys?;
|
|
361
699
|
private readonly applicationId?;
|
|
362
|
-
|
|
700
|
+
readonly assetDecoder?: PlanAssetContainerDecoder;
|
|
701
|
+
listPlans(input?: ListPlansInput): Promise<PlanPage>;
|
|
702
|
+
getPlan(planId: string): Promise<PlanDetail>;
|
|
703
|
+
startPlanCreation(input: StartPlanCreationInput): Promise<PlanCreationProgress>;
|
|
704
|
+
getPlanCreation(operationId: string): Promise<PlanCreationProgress>;
|
|
705
|
+
supplyPlanCreationMaterial(operationId: string, material: EncryptedPlanMaterial): Promise<PlanCreationProgress>;
|
|
706
|
+
cancelPlanCreation(operationId: string): Promise<PlanCreationProgress>;
|
|
707
|
+
/**
|
|
708
|
+
* The resumable creation flow over this client's own port.
|
|
709
|
+
*
|
|
710
|
+
* The four calls above are the raw stages; a host that wants recovery, progress and the
|
|
711
|
+
* encrypt/split step in the right order drives them through here instead. Checkpoints
|
|
712
|
+
* default to process memory because they only need to outlive the operation, not the host.
|
|
713
|
+
*/
|
|
714
|
+
guidedPlanCreator(checkpoints?: GuidedCreateCheckpointStore): GuidedPlanCreator;
|
|
363
715
|
/**
|
|
364
|
-
*
|
|
365
|
-
*
|
|
366
|
-
*
|
|
716
|
+
* Creates the plan definition from a declaration of what it will protect.
|
|
717
|
+
*
|
|
718
|
+
* Elements takes a `PlanAssetDeclaration` rather than the assets themselves: creation
|
|
719
|
+
* persists metadata only, and a host that has not yet collected any secret should be
|
|
720
|
+
* able to reach this point. Where Business keeps the secrets in browser storage between
|
|
721
|
+
* its create and configure pages, an Elements host holds the declaration and supplies
|
|
722
|
+
* the secrets to `configurePlan()` — how it carries them across is its own decision.
|
|
367
723
|
*/
|
|
368
|
-
|
|
369
|
-
|
|
724
|
+
createPlan<TInput extends {
|
|
725
|
+
assets: PlanAssetDeclaration;
|
|
370
726
|
}, TResult>(input: TInput): Promise<TResult>;
|
|
371
|
-
/**
|
|
372
|
-
|
|
727
|
+
/**
|
|
728
|
+
* Configures a plan under the Application's required master key. The key is resolved
|
|
729
|
+
* through the configured custody source; it is never an operation parameter.
|
|
730
|
+
*/
|
|
731
|
+
configurePlan<TInput extends object, TResult>(input: TInput): Promise<TResult>;
|
|
732
|
+
/** Resolves the Application's required master key without exposing it as an operation argument. */
|
|
733
|
+
applicationMasterKey(): Promise<string>;
|
|
373
734
|
/**
|
|
374
735
|
* Resolves the key that opens a plan before anything is collected.
|
|
375
736
|
*
|
|
@@ -407,6 +768,17 @@ declare class ElementsClient {
|
|
|
407
768
|
}): Promise<string | undefined>;
|
|
408
769
|
initializeGovernedReveal(planId: string, stepUp?: StepUpReadContext): Promise<GovernedRevealSession>;
|
|
409
770
|
getGovernedReveal(processId: string, stepUp?: StepUpReadContext): Promise<GovernedRevealState>;
|
|
771
|
+
startReveal(planId: string, input: StartRevealInput): Promise<RevealSession>;
|
|
772
|
+
getReveal(revealId: string): Promise<RevealSession>;
|
|
773
|
+
openReveal(planId: string, options?: OpenRevealOptions): Promise<RevealHandle>;
|
|
774
|
+
withReveal<TResult>(planId: string, options: OpenRevealOptions, work: (reveal: RevealHandle) => Promise<TResult>): Promise<TResult>;
|
|
775
|
+
releaseRevealMaterial(revealId: string, materialVersion: string): Promise<unknown>;
|
|
776
|
+
reportRevealReconstruction(revealId: string, input: RevealReconstructionInput): Promise<RevealSession>;
|
|
777
|
+
closeReveal(revealId: string, reason: RevealCloseReason): Promise<RevealSession>;
|
|
778
|
+
authorizeRevealAction(revealId: string, input: AuthorizeRevealActionInput): Promise<RevealAction>;
|
|
779
|
+
reportRevealActionOutcome(revealId: string, actionId: string, input: ReportRevealActionOutcomeInput): Promise<RevealAction>;
|
|
780
|
+
getCustodianShare(processId: string, stepUp?: StepUpReadContext): Promise<CustodianShareResult>;
|
|
781
|
+
releaseCustodianShare(processId: string): Promise<void>;
|
|
410
782
|
exportPlanBridge(planId: string, input: ExportPlanBridgeInput): Promise<PlanBridgeEnvelope>;
|
|
411
783
|
importPlanBridge(envelope: PlanBridgeEnvelope): Promise<{
|
|
412
784
|
planId: string;
|
|
@@ -417,6 +789,52 @@ declare class ElementsClient {
|
|
|
417
789
|
}
|
|
418
790
|
declare function createElementsClient(options: ElementsClientOptions): ElementsClient;
|
|
419
791
|
|
|
792
|
+
declare class ElementsApiRequestFailed extends Error {
|
|
793
|
+
readonly status: number;
|
|
794
|
+
readonly code?: string | undefined;
|
|
795
|
+
readonly detail?: string | undefined;
|
|
796
|
+
constructor(status: number, code?: string | undefined, detail?: string | undefined);
|
|
797
|
+
get stepUpRequestId(): string | undefined;
|
|
798
|
+
}
|
|
799
|
+
declare class HttpElementsApiPort implements ElementsApiPort {
|
|
800
|
+
private readonly apiUrl;
|
|
801
|
+
private readonly environment;
|
|
802
|
+
private readonly getBearerToken;
|
|
803
|
+
private readonly transport;
|
|
804
|
+
constructor(apiUrl: string, environment: 'TEST' | 'LIVE', getBearerToken: BearerTokenResolver, transport: HttpTransport);
|
|
805
|
+
listPlans(input?: ListPlansInput): Promise<PlanPage>;
|
|
806
|
+
getPlan(planId: string): Promise<PlanDetail>;
|
|
807
|
+
startPlanCreation(input: StartPlanCreationInput): Promise<PlanCreationProgress>;
|
|
808
|
+
getPlanCreation(operationId: string): Promise<PlanCreationProgress>;
|
|
809
|
+
supplyPlanCreationMaterial(operationId: string, material: EncryptedPlanMaterial): Promise<PlanCreationProgress>;
|
|
810
|
+
cancelPlanCreation(operationId: string): Promise<PlanCreationProgress>;
|
|
811
|
+
planKeyReference(planId: string): Promise<PlanKeyReference>;
|
|
812
|
+
collectPlanMaterial(planId: string, stepUp?: StepUpReadContext): Promise<CollectedPlanMaterial>;
|
|
813
|
+
initializeGovernedReveal(planId: string, stepUp?: StepUpReadContext): Promise<GovernedRevealSession>;
|
|
814
|
+
getGovernedReveal(processId: string, stepUp?: StepUpReadContext): Promise<GovernedRevealState>;
|
|
815
|
+
collectGovernedValidatorShares(processId: string, stepUp?: StepUpReadContext): Promise<GovernedValidatorMaterial>;
|
|
816
|
+
collectGovernedShares(processId: string, stepUp?: StepUpReadContext): Promise<GovernedSharesMaterial>;
|
|
817
|
+
markGovernedSharesCollected(processId: string): Promise<void>;
|
|
818
|
+
markGovernedSharesReconstructed(processId: string): Promise<void>;
|
|
819
|
+
markGovernedDataRevealed(processId: string): Promise<void>;
|
|
820
|
+
closeGovernedReveal(processId: string): Promise<void>;
|
|
821
|
+
startReveal(planId: string, input: StartRevealInput): Promise<RevealSession>;
|
|
822
|
+
getReveal(revealId: string): Promise<RevealSession>;
|
|
823
|
+
releaseRevealMaterial(revealId: string, materialVersion: string): Promise<unknown>;
|
|
824
|
+
reportRevealReconstruction(revealId: string, input: RevealReconstructionInput): Promise<RevealSession>;
|
|
825
|
+
closeReveal(revealId: string, reason: RevealCloseReason): Promise<RevealSession>;
|
|
826
|
+
authorizeRevealAction(revealId: string, input: AuthorizeRevealActionInput): Promise<RevealAction>;
|
|
827
|
+
reportRevealActionOutcome(revealId: string, actionId: string, input: ReportRevealActionOutcomeInput): Promise<RevealAction>;
|
|
828
|
+
getCustodianShare(processId: string, stepUp?: StepUpReadContext): Promise<CustodianShareResult>;
|
|
829
|
+
releaseCustodianShare(processId: string): Promise<void>;
|
|
830
|
+
exportPlanBridge(planId: string, input: ExportPlanBridgeInput): Promise<PlanBridgeEnvelope>;
|
|
831
|
+
importPlanBridge(envelope: PlanBridgeEnvelope): Promise<{
|
|
832
|
+
planId: string;
|
|
833
|
+
}>;
|
|
834
|
+
private request;
|
|
835
|
+
private requestWithoutResult;
|
|
836
|
+
}
|
|
837
|
+
|
|
420
838
|
/**
|
|
421
839
|
* Opens a plan key that was sealed under a master key.
|
|
422
840
|
*
|
|
@@ -463,5 +881,279 @@ declare class RelayMasterKeySource implements MasterKeySource {
|
|
|
463
881
|
resolve(): Promise<string>;
|
|
464
882
|
}
|
|
465
883
|
|
|
466
|
-
|
|
467
|
-
|
|
884
|
+
/** Elements adapter for Core's transport-neutral event port. Scheduling remains owned by Core's mature loop. */
|
|
885
|
+
declare class PollingSharedPlanEventListener implements SharedPlanEventListener {
|
|
886
|
+
private readonly api;
|
|
887
|
+
private readonly subscriptions;
|
|
888
|
+
private readonly loop;
|
|
889
|
+
constructor(api: ElementsApiPort, environment?: ProcessRuntimeEnvironment, ownership?: ProcessReconciliationOwnership, random?: () => number);
|
|
890
|
+
refreshConnection(): void;
|
|
891
|
+
subscribe(processId: string, handlers: SharedPlanEventHandlers): void;
|
|
892
|
+
unsubscribe(processId: string): void;
|
|
893
|
+
}
|
|
894
|
+
/** Cross-host runtime: browsers regain work on online/visibility events; Node uses timer-only recovery. */
|
|
895
|
+
declare class HostProcessRuntimeEnvironment implements ProcessRuntimeEnvironment {
|
|
896
|
+
visibility(): 'visible' | 'hidden';
|
|
897
|
+
isOnline(): boolean;
|
|
898
|
+
now(): number;
|
|
899
|
+
schedule(callback: () => void, delayMs: number): () => void;
|
|
900
|
+
onRecovery(callback: () => void): () => void;
|
|
901
|
+
}
|
|
902
|
+
/** One host process owns its own polling; Core's loop still enforces one active lease per subscription. */
|
|
903
|
+
declare class LocalProcessReconciliationOwnership implements ProcessReconciliationOwnership {
|
|
904
|
+
join(_processId: string, handlers: Parameters<ProcessReconciliationOwnership['join']>[1]): {
|
|
905
|
+
isOwner: () => boolean;
|
|
906
|
+
requestReconciliation: () => void;
|
|
907
|
+
publishReconciled: () => undefined;
|
|
908
|
+
leave: () => void;
|
|
909
|
+
};
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
interface CorePlanSecrets {
|
|
913
|
+
assets: DataAsset[];
|
|
914
|
+
/** Number of non-custodian share destinations. */
|
|
915
|
+
totalShares: number;
|
|
916
|
+
threshold: number;
|
|
917
|
+
withCustodian?: boolean;
|
|
918
|
+
}
|
|
919
|
+
interface PreparedCorePlanMaterial {
|
|
920
|
+
data: Uint8Array;
|
|
921
|
+
assets: DataAsset[];
|
|
922
|
+
totalShares: number;
|
|
923
|
+
threshold: number;
|
|
924
|
+
withCustodian: boolean;
|
|
925
|
+
masterKey: string;
|
|
926
|
+
}
|
|
927
|
+
/** Uses Core's registered SSDP+ generator and production share sealer as one guided-create adapter. */
|
|
928
|
+
declare class CorePlanMaterialBuilder implements PlanMaterialBuilder<CorePlanSecrets, PreparedCorePlanMaterial> {
|
|
929
|
+
private readonly masterKeySource;
|
|
930
|
+
private readonly generator;
|
|
931
|
+
private readonly sealer;
|
|
932
|
+
constructor(coreSdk: SDKContainer, masterKeySource: MasterKeySource);
|
|
933
|
+
encrypt(input: {
|
|
934
|
+
planId: string;
|
|
935
|
+
declaration: StartPlanCreationInput;
|
|
936
|
+
secrets: CorePlanSecrets;
|
|
937
|
+
signal?: AbortSignal;
|
|
938
|
+
}): Promise<PreparedCorePlanMaterial>;
|
|
939
|
+
generateShares(input: {
|
|
940
|
+
planId: string;
|
|
941
|
+
declaration: StartPlanCreationInput;
|
|
942
|
+
encrypted: PreparedCorePlanMaterial;
|
|
943
|
+
signal?: AbortSignal;
|
|
944
|
+
}): Promise<EncryptedPlanMaterial>;
|
|
945
|
+
private sealCustodianPair;
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
type ElementsEnvironment = 'TEST' | 'LIVE';
|
|
949
|
+
interface OidcDiscoveryDocument {
|
|
950
|
+
issuer: string;
|
|
951
|
+
authorizationEndpoint: string;
|
|
952
|
+
tokenEndpoint: string;
|
|
953
|
+
deviceAuthorizationEndpoint?: string;
|
|
954
|
+
endSessionEndpoint?: string;
|
|
955
|
+
revocationEndpoint?: string;
|
|
956
|
+
}
|
|
957
|
+
interface OperatorAuthConfiguration {
|
|
958
|
+
issuer: string;
|
|
959
|
+
clientId: string;
|
|
960
|
+
audience: string;
|
|
961
|
+
environment: ElementsEnvironment;
|
|
962
|
+
redirectUri: string;
|
|
963
|
+
scopes: readonly string[];
|
|
964
|
+
}
|
|
965
|
+
interface OAuthTokenResponse {
|
|
966
|
+
accessToken: string;
|
|
967
|
+
refreshToken?: string;
|
|
968
|
+
idToken?: string;
|
|
969
|
+
tokenType: string;
|
|
970
|
+
expiresInSeconds: number;
|
|
971
|
+
refreshExpiresInSeconds?: number;
|
|
972
|
+
scope?: string;
|
|
973
|
+
}
|
|
974
|
+
interface ValidatedOperatorToken {
|
|
975
|
+
issuer: string;
|
|
976
|
+
audience: string | readonly string[];
|
|
977
|
+
authorizedParty: string;
|
|
978
|
+
environment: ElementsEnvironment;
|
|
979
|
+
subject: string;
|
|
980
|
+
sessionId: string;
|
|
981
|
+
tokenId: string;
|
|
982
|
+
scopes: readonly string[];
|
|
983
|
+
nonce?: string;
|
|
984
|
+
}
|
|
985
|
+
interface OperatorSession {
|
|
986
|
+
accessToken: string;
|
|
987
|
+
refreshToken?: string;
|
|
988
|
+
idToken?: string;
|
|
989
|
+
tokenType: 'Bearer';
|
|
990
|
+
expiresAt: number;
|
|
991
|
+
refreshExpiresAt?: number;
|
|
992
|
+
principal: ValidatedOperatorToken;
|
|
993
|
+
}
|
|
994
|
+
interface AuthorizationTransaction {
|
|
995
|
+
kind: 'authorization-code';
|
|
996
|
+
state: string;
|
|
997
|
+
nonce: string;
|
|
998
|
+
codeVerifier: string;
|
|
999
|
+
redirectUri: string;
|
|
1000
|
+
expiresAt: number;
|
|
1001
|
+
}
|
|
1002
|
+
interface DeviceAuthorization {
|
|
1003
|
+
deviceCode: string;
|
|
1004
|
+
userCode: string;
|
|
1005
|
+
verificationUri: string;
|
|
1006
|
+
verificationUriComplete?: string;
|
|
1007
|
+
expiresInSeconds: number;
|
|
1008
|
+
intervalSeconds?: number;
|
|
1009
|
+
}
|
|
1010
|
+
interface DeviceTransaction extends DeviceAuthorization {
|
|
1011
|
+
kind: 'device-code';
|
|
1012
|
+
expiresAt: number;
|
|
1013
|
+
nextPollAt: number;
|
|
1014
|
+
consumed: boolean;
|
|
1015
|
+
}
|
|
1016
|
+
type OAuthTransaction = AuthorizationTransaction | DeviceTransaction;
|
|
1017
|
+
interface OperatorSessionSummary {
|
|
1018
|
+
id: string;
|
|
1019
|
+
createdAt: string;
|
|
1020
|
+
lastSeenAt?: string;
|
|
1021
|
+
current: boolean;
|
|
1022
|
+
clientId: string;
|
|
1023
|
+
environment: ElementsEnvironment;
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
interface OperatorAuthTransport {
|
|
1027
|
+
discover(issuer: string): Promise<OidcDiscoveryDocument>;
|
|
1028
|
+
exchangeAuthorizationCode(input: {
|
|
1029
|
+
tokenEndpoint: string;
|
|
1030
|
+
clientId: string;
|
|
1031
|
+
code: string;
|
|
1032
|
+
codeVerifier: string;
|
|
1033
|
+
redirectUri: string;
|
|
1034
|
+
}): Promise<OAuthTokenResponse>;
|
|
1035
|
+
startDeviceAuthorization(input: {
|
|
1036
|
+
endpoint: string;
|
|
1037
|
+
clientId: string;
|
|
1038
|
+
scopes: readonly string[];
|
|
1039
|
+
}): Promise<DeviceAuthorization>;
|
|
1040
|
+
pollDeviceToken(input: {
|
|
1041
|
+
tokenEndpoint: string;
|
|
1042
|
+
clientId: string;
|
|
1043
|
+
deviceCode: string;
|
|
1044
|
+
}): Promise<OAuthTokenResponse>;
|
|
1045
|
+
refresh(input: {
|
|
1046
|
+
tokenEndpoint: string;
|
|
1047
|
+
clientId: string;
|
|
1048
|
+
refreshToken: string;
|
|
1049
|
+
}): Promise<OAuthTokenResponse>;
|
|
1050
|
+
}
|
|
1051
|
+
interface OperatorTokenValidator {
|
|
1052
|
+
validateAccessToken(accessToken: string): Promise<ValidatedOperatorToken>;
|
|
1053
|
+
validateIdToken?(idToken: string): Promise<ValidatedOperatorToken>;
|
|
1054
|
+
}
|
|
1055
|
+
interface OperatorSessionStore {
|
|
1056
|
+
load(): Promise<OperatorSession | undefined>;
|
|
1057
|
+
save(session: OperatorSession): Promise<void>;
|
|
1058
|
+
clear(): Promise<void>;
|
|
1059
|
+
}
|
|
1060
|
+
interface OAuthTransactionStore {
|
|
1061
|
+
load(key: string): Promise<OAuthTransaction | undefined>;
|
|
1062
|
+
save(key: string, transaction: OAuthTransaction): Promise<void>;
|
|
1063
|
+
remove(key: string): Promise<void>;
|
|
1064
|
+
}
|
|
1065
|
+
interface OAuthClock {
|
|
1066
|
+
now(): number;
|
|
1067
|
+
sleep(milliseconds: number, signal?: AbortSignal): Promise<void>;
|
|
1068
|
+
}
|
|
1069
|
+
interface OAuthCrypto {
|
|
1070
|
+
randomUrlSafe(byteLength: number): string;
|
|
1071
|
+
sha256UrlSafe(value: string): Promise<string>;
|
|
1072
|
+
}
|
|
1073
|
+
interface OperatorSessionControlPort {
|
|
1074
|
+
list(): Promise<readonly OperatorSessionSummary[]>;
|
|
1075
|
+
revoke(sessionId: string): Promise<void>;
|
|
1076
|
+
logout(sessionId: string): Promise<void>;
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
declare class WebOAuthCrypto implements OAuthCrypto {
|
|
1080
|
+
randomUrlSafe(byteLength: number): string;
|
|
1081
|
+
sha256UrlSafe(value: string): Promise<string>;
|
|
1082
|
+
}
|
|
1083
|
+
declare class SystemOAuthClock implements OAuthClock {
|
|
1084
|
+
now(): number;
|
|
1085
|
+
sleep(milliseconds: number, signal?: AbortSignal): Promise<void>;
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
declare class OperatorAuthError extends Error {
|
|
1089
|
+
readonly code: string;
|
|
1090
|
+
constructor(code: string, message?: string);
|
|
1091
|
+
}
|
|
1092
|
+
declare class OperatorReauthenticationRequired extends OperatorAuthError {
|
|
1093
|
+
constructor(message?: string);
|
|
1094
|
+
}
|
|
1095
|
+
declare class OAuthProtocolError extends OperatorAuthError {
|
|
1096
|
+
constructor(code: string, message?: string);
|
|
1097
|
+
}
|
|
1098
|
+
declare function oauthErrorCode(error: unknown): string | undefined;
|
|
1099
|
+
|
|
1100
|
+
type OAuthHttpTransport = (input: URL | RequestInfo, init?: RequestInit) => Promise<Response>;
|
|
1101
|
+
/** Standard public-client OAuth/OIDC transport. Confidential BFFs should inject their own transport. */
|
|
1102
|
+
declare class HttpOperatorAuthTransport implements OperatorAuthTransport {
|
|
1103
|
+
private readonly http;
|
|
1104
|
+
constructor(http?: OAuthHttpTransport);
|
|
1105
|
+
discover(issuer: string): Promise<OidcDiscoveryDocument>;
|
|
1106
|
+
exchangeAuthorizationCode(input: Parameters<OperatorAuthTransport['exchangeAuthorizationCode']>[0]): Promise<OAuthTokenResponse>;
|
|
1107
|
+
startDeviceAuthorization(input: Parameters<OperatorAuthTransport['startDeviceAuthorization']>[0]): Promise<DeviceAuthorization>;
|
|
1108
|
+
pollDeviceToken(input: Parameters<OperatorAuthTransport['pollDeviceToken']>[0]): Promise<OAuthTokenResponse>;
|
|
1109
|
+
refresh(input: Parameters<OperatorAuthTransport['refresh']>[0]): Promise<OAuthTokenResponse>;
|
|
1110
|
+
private token;
|
|
1111
|
+
private form;
|
|
1112
|
+
private json;
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
interface OperatorAuthClientOptions {
|
|
1116
|
+
configuration: OperatorAuthConfiguration;
|
|
1117
|
+
transport: OperatorAuthTransport;
|
|
1118
|
+
tokenValidator: OperatorTokenValidator;
|
|
1119
|
+
sessions: OperatorSessionStore;
|
|
1120
|
+
transactions: OAuthTransactionStore;
|
|
1121
|
+
crypto?: OAuthCrypto;
|
|
1122
|
+
clock?: OAuthClock;
|
|
1123
|
+
}
|
|
1124
|
+
declare class OperatorAuthClient {
|
|
1125
|
+
private readonly options;
|
|
1126
|
+
private readonly crypto;
|
|
1127
|
+
private readonly clock;
|
|
1128
|
+
private discovery?;
|
|
1129
|
+
private refreshFlight?;
|
|
1130
|
+
constructor(options: OperatorAuthClientOptions);
|
|
1131
|
+
beginAuthorizationCode(): Promise<{
|
|
1132
|
+
authorizationUrl: string;
|
|
1133
|
+
expiresAt: number;
|
|
1134
|
+
}>;
|
|
1135
|
+
completeAuthorizationCode(callbackUrl: string): Promise<OperatorSession>;
|
|
1136
|
+
beginDeviceAuthorization(): Promise<DeviceTransaction>;
|
|
1137
|
+
pollDeviceAuthorization(signal?: AbortSignal): Promise<OperatorSession>;
|
|
1138
|
+
getAccessToken(): Promise<string | undefined>;
|
|
1139
|
+
refresh(): Promise<OperatorSession>;
|
|
1140
|
+
clear(): Promise<void>;
|
|
1141
|
+
private performRefresh;
|
|
1142
|
+
private getDiscovery;
|
|
1143
|
+
private transactionKey;
|
|
1144
|
+
private acceptTokens;
|
|
1145
|
+
private assertPrincipal;
|
|
1146
|
+
private assertIdentity;
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
declare class OperatorSessionController {
|
|
1150
|
+
private readonly control;
|
|
1151
|
+
private readonly local;
|
|
1152
|
+
constructor(control: OperatorSessionControlPort, local: OperatorSessionStore);
|
|
1153
|
+
list(): Promise<readonly OperatorSessionSummary[]>;
|
|
1154
|
+
revoke(sessionId: string): Promise<void>;
|
|
1155
|
+
logout(): Promise<void>;
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
export { CANONICAL_PLAN_ASSET_TYPES, CANONICAL_STRUCTURED_ASSET_FIELDS, CorePlanMaterialBuilder, ElementsApiPortRequired, ElementsApiRequestFailed, ElementsClient, GuidedCreateRecoveryError, GuidedPlanCreator, HostProcessRuntimeEnvironment, HttpElementsApiPort, HttpOperatorAuthTransport, InheritiClientProvider, InvalidPlanDeclaration, InvalidPlanMaterial, LocalProcessReconciliationOwnership, MasterKeyRelayExpired, MasterKeyRelayTimedOut, MasterKeyRequired, MemoryGuidedCreateCheckpointStore, MemoryKeyVault, MemoryStatePort, OAuthProtocolError, OperatorAuthClient, OperatorAuthError, OperatorReauthenticationRequired, OperatorSessionController, PLAN_CREATION_SERVER_STAGES, PlanMaterialReconstructorRequired, PollingSharedPlanEventListener, RelayMasterKeySource, RevealActionsNotOpen, RevealFieldAccessError, RevealHandleClosed, StaticMasterKeyResolver, SystemOAuthClock, WebOAuthCrypto, createElementsClient, getAvailableEnvs, masterKeyRefFor, masterKeyRefKey, oauthErrorCode, parseAssetFieldSelector, unwrapDekWithMasterKey, useClient, validatePlanCreationInput, validatePlanCreationMaterial };
|
|
1159
|
+
export type { AssetFieldSelector, AuthorizationTransaction, AuthorizeRevealActionInput, CanonicalPlanAssetType, CollectedPlanMaterial, CompatibleValue, CorePlanSecrets, CustodianShareResult, DecodedPlanAsset, DeviceAuthorization, DeviceTransaction, ElementsApiPort, ElementsClientOptions, ElementsEnvironment, EncryptedPlanMaterial, EncryptedPlanShard, ExportPlanBridgeInput, GovernedRevealSession, GovernedRevealState, GovernedShare, GovernedSharesMaterial, GovernedValidatorMaterial, GuidedCreateCheckpoint, GuidedCreateCheckpointStore, GuidedCreateLocalStage, GuidedCreateOptions, InheritiClientProviderProps, IntegrationPlanAssetDeclaration, KeyVault, ListPlansInput, MasterKeyRef, MasterKeyRelayPort, MasterKeyResolver, NativePlanParticipant, OAuthClock, OAuthCrypto, OAuthHttpTransport, OAuthTokenResponse, OAuthTransaction, OAuthTransactionStore, OidcDiscoveryDocument, OpenRevealOptions, OperatorAuthClientOptions, OperatorAuthConfiguration, OperatorAuthTransport, OperatorSession, OperatorSessionControlPort, OperatorSessionStore, OperatorSessionSummary, OperatorTokenValidator, PlanAssetContainerDecoder, PlanAssetSummary, PlanBridgeEnvelope, PlanCreationOutcome, PlanCreationProgress, PlanCreationServerStage, PlanDetail, PlanGovernanceMode, PlanMaterialBuilder, PlanMaterialReconstructor, PlanPage, PlanParticipantRelationship, PlanRevealProfile, PlanStatus, PlanSummary, RelayMasterKeySourceOptions, ReportRevealActionOutcomeInput, RevealAction, RevealActionOutcome, RevealActionType, RevealCloseReason, RevealFieldOptions, RevealHandle, RevealMode, RevealReconstructionInput, RevealSession, RevealStage, StartPlanCreationInput, StartRevealInput, StatePort, StepUpReadContext, ValidatedOperatorToken };
|