@safetech/inheriti-client-sdk 1.17.1 → 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 +141 -83
- package/dist/node.d.ts +22 -1
- package/dist/node.js +1 -1
- package/dist/sdk-types.d.ts +906 -16
- 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 +116 -1
- package/dist/src/elements/elements-client.d.ts +104 -4
- package/dist/src/elements/guided-plan-creator.d.ts +47 -0
- package/dist/src/elements/http-elements-api-port.d.ts +18 -1
- package/dist/src/elements/index.d.ts +15 -1
- package/dist/src/elements/key-vault.d.ts +14 -6
- package/dist/src/elements/master-key.d.ts +58 -0
- package/dist/src/elements/node-plan-material-reconstructor.d.ts +1 -1
- package/dist/src/elements/plan-material-reconstructor.d.ts +5 -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/relay-master-key-source.d.ts +38 -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/elements/unwrap-dek.d.ts +7 -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/dist/test/index.js +1 -1
- 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 +36 -3
- package/package.json +14 -3
|
@@ -31,4 +31,4 @@ export interface InheritiClientProviderProps {
|
|
|
31
31
|
*
|
|
32
32
|
* @param props - The provider props including children, clientId, and options.
|
|
33
33
|
*/
|
|
34
|
-
export default function InheritiClientProvider({ children, clientId, options }: InheritiClientProviderProps): import("react
|
|
34
|
+
export default function InheritiClientProvider({ children, clientId, options }: InheritiClientProviderProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { DataAsset, MasterKeySource } from '@safetech/inheriti-core-sdk';
|
|
2
|
+
import type { SDKContainer } from '@safetech/inheriti-core-sdk/vanilla';
|
|
3
|
+
import type { PlanMaterialBuilder } from './guided-plan-creator';
|
|
4
|
+
import type { EncryptedPlanMaterial, StartPlanCreationInput } from './plan-operations';
|
|
5
|
+
export interface CorePlanSecrets {
|
|
6
|
+
assets: DataAsset[];
|
|
7
|
+
/** Number of non-custodian share destinations. */
|
|
8
|
+
totalShares: number;
|
|
9
|
+
threshold: number;
|
|
10
|
+
withCustodian?: boolean;
|
|
11
|
+
}
|
|
12
|
+
interface PreparedCorePlanMaterial {
|
|
13
|
+
data: Uint8Array;
|
|
14
|
+
assets: DataAsset[];
|
|
15
|
+
totalShares: number;
|
|
16
|
+
threshold: number;
|
|
17
|
+
withCustodian: boolean;
|
|
18
|
+
masterKey: string;
|
|
19
|
+
}
|
|
20
|
+
/** Uses Core's registered SSDP+ generator and production share sealer as one guided-create adapter. */
|
|
21
|
+
export declare class CorePlanMaterialBuilder implements PlanMaterialBuilder<CorePlanSecrets, PreparedCorePlanMaterial> {
|
|
22
|
+
private readonly masterKeySource;
|
|
23
|
+
private readonly generator;
|
|
24
|
+
private readonly sealer;
|
|
25
|
+
constructor(coreSdk: SDKContainer, masterKeySource: MasterKeySource);
|
|
26
|
+
encrypt(input: {
|
|
27
|
+
planId: string;
|
|
28
|
+
declaration: StartPlanCreationInput;
|
|
29
|
+
secrets: CorePlanSecrets;
|
|
30
|
+
signal?: AbortSignal;
|
|
31
|
+
}): Promise<PreparedCorePlanMaterial>;
|
|
32
|
+
generateShares(input: {
|
|
33
|
+
planId: string;
|
|
34
|
+
declaration: StartPlanCreationInput;
|
|
35
|
+
encrypted: PreparedCorePlanMaterial;
|
|
36
|
+
signal?: AbortSignal;
|
|
37
|
+
}): Promise<EncryptedPlanMaterial>;
|
|
38
|
+
private sealCustodianPair;
|
|
39
|
+
}
|
|
40
|
+
export {};
|
|
@@ -9,8 +9,36 @@ export interface CollectedPlanMaterial {
|
|
|
9
9
|
data: string;
|
|
10
10
|
}>;
|
|
11
11
|
verifiedStorageLayerTypes: string[];
|
|
12
|
+
/** True when `planKey` is still sealed under a master key and must be unwrapped. */
|
|
13
|
+
masterKeyWrapped: boolean;
|
|
14
|
+
/** The tenant holding the plan. With no source reference, this names the key. */
|
|
15
|
+
tenantId?: string;
|
|
16
|
+
/** Present when the plan came from another system, whose key still opens it. */
|
|
17
|
+
sourceReference?: {
|
|
18
|
+
system: string;
|
|
19
|
+
planId: string;
|
|
20
|
+
contextId: string;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/** Metadata naming the key that opens a plan, without collecting anything. */
|
|
24
|
+
export interface PlanKeyReference {
|
|
25
|
+
planId: string;
|
|
26
|
+
masterKeyWrapped: boolean;
|
|
27
|
+
tenantId: string;
|
|
28
|
+
sourceReference?: {
|
|
29
|
+
system: string;
|
|
30
|
+
planId: string;
|
|
31
|
+
contextId: string;
|
|
32
|
+
};
|
|
12
33
|
}
|
|
13
34
|
export interface ElementsApiPort {
|
|
35
|
+
listPlans(input?: import('./plan-operations').ListPlansInput): Promise<import('./plan-operations').PlanPage>;
|
|
36
|
+
getPlan(planId: string): Promise<import('./plan-operations').PlanDetail>;
|
|
37
|
+
startPlanCreation(input: import('./plan-operations').StartPlanCreationInput): Promise<import('./plan-operations').PlanCreationProgress>;
|
|
38
|
+
getPlanCreation(operationId: string): Promise<import('./plan-operations').PlanCreationProgress>;
|
|
39
|
+
supplyPlanCreationMaterial(operationId: string, material: import('./plan-operations').EncryptedPlanMaterial): Promise<import('./plan-operations').PlanCreationProgress>;
|
|
40
|
+
cancelPlanCreation(operationId: string): Promise<import('./plan-operations').PlanCreationProgress>;
|
|
41
|
+
planKeyReference(planId: string): Promise<PlanKeyReference>;
|
|
14
42
|
collectPlanMaterial(planId: string, stepUp?: StepUpReadContext): Promise<CollectedPlanMaterial>;
|
|
15
43
|
initializeGovernedReveal(planId: string, stepUp?: StepUpReadContext): Promise<GovernedRevealSession>;
|
|
16
44
|
getGovernedReveal(processId: string, stepUp?: StepUpReadContext): Promise<GovernedRevealState>;
|
|
@@ -20,6 +48,15 @@ export interface ElementsApiPort {
|
|
|
20
48
|
markGovernedSharesReconstructed(processId: string): Promise<void>;
|
|
21
49
|
markGovernedDataRevealed(processId: string): Promise<void>;
|
|
22
50
|
closeGovernedReveal(processId: string): Promise<void>;
|
|
51
|
+
startReveal(planId: string, input: StartRevealInput): Promise<RevealSession>;
|
|
52
|
+
getReveal(revealId: string): Promise<RevealSession>;
|
|
53
|
+
releaseRevealMaterial(revealId: string, materialVersion: string): Promise<unknown>;
|
|
54
|
+
reportRevealReconstruction(revealId: string, input: RevealReconstructionInput): Promise<RevealSession>;
|
|
55
|
+
closeReveal(revealId: string, reason: RevealCloseReason): Promise<RevealSession>;
|
|
56
|
+
authorizeRevealAction(revealId: string, input: AuthorizeRevealActionInput): Promise<RevealAction>;
|
|
57
|
+
reportRevealActionOutcome(revealId: string, actionId: string, input: ReportRevealActionOutcomeInput): Promise<RevealAction>;
|
|
58
|
+
getCustodianShare(processId: string, stepUp?: StepUpReadContext): Promise<CustodianShareResult>;
|
|
59
|
+
releaseCustodianShare(processId: string): Promise<void>;
|
|
23
60
|
exportPlanBridge(planId: string, input: ExportPlanBridgeInput): Promise<PlanBridgeEnvelope>;
|
|
24
61
|
importPlanBridge(envelope: PlanBridgeEnvelope): Promise<{
|
|
25
62
|
planId: string;
|
|
@@ -37,7 +74,7 @@ export interface ExportPlanBridgeInput {
|
|
|
37
74
|
}
|
|
38
75
|
export interface PlanRevealProfile {
|
|
39
76
|
governance: 'KEEP' | 'BYPASS';
|
|
40
|
-
masterKeyRelease: 'REQUIRED'
|
|
77
|
+
masterKeyRelease: 'REQUIRED';
|
|
41
78
|
custodian: 'BYPASS' | 'FORCE';
|
|
42
79
|
}
|
|
43
80
|
export interface PlanBridgeEnvelope {
|
|
@@ -113,6 +150,14 @@ export interface GovernedRevealSession {
|
|
|
113
150
|
planId: string;
|
|
114
151
|
mergeThreshold: number;
|
|
115
152
|
status?: string;
|
|
153
|
+
/** Same key signalling the direct collection route returns, for the governed path. */
|
|
154
|
+
masterKeyWrapped: boolean;
|
|
155
|
+
tenantId?: string;
|
|
156
|
+
sourceReference?: {
|
|
157
|
+
system: string;
|
|
158
|
+
planId: string;
|
|
159
|
+
contextId: string;
|
|
160
|
+
};
|
|
116
161
|
}
|
|
117
162
|
export interface GovernedRevealState {
|
|
118
163
|
id: string;
|
|
@@ -137,6 +182,76 @@ export interface GovernedSharesMaterial {
|
|
|
137
182
|
keyShards: GovernedShare[];
|
|
138
183
|
dek: string;
|
|
139
184
|
}
|
|
185
|
+
export type RevealMode = 'DIRECT' | 'GOVERNED';
|
|
186
|
+
export type RevealStage = 'STARTING' | 'WAITING_FOR_PARTICIPANTS' | 'AUTHORIZED' | 'MATERIAL_AUTHORIZED' | 'MATERIAL_RELEASED' | 'RECONSTRUCTED' | 'ACTIONS_OPEN' | 'CLOSING' | 'CLOSED' | 'DENIED' | 'PARTICIPANT_REVOKED' | 'RECONCILIATION_REQUIRED' | 'EXPIRED' | 'CANCELED' | 'FAILED';
|
|
187
|
+
export type RevealCloseReason = 'COMPLETED' | 'CANCELED' | 'ERROR';
|
|
188
|
+
export type RevealActionType = 'VIEW_FIELD' | 'COPY_FIELD' | 'EXPORT_ASSET' | 'AUTOFILL_FIELD' | 'INSERT_FIELD';
|
|
189
|
+
export type RevealActionOutcome = 'SUCCEEDED' | 'FAILED' | 'CANCELED';
|
|
190
|
+
export interface StartRevealInput {
|
|
191
|
+
mode: RevealMode;
|
|
192
|
+
idempotencyKey: string;
|
|
193
|
+
}
|
|
194
|
+
export interface RevealReconstructionInput {
|
|
195
|
+
status: 'SUCCEEDED' | 'FAILED';
|
|
196
|
+
errorCode?: string;
|
|
197
|
+
}
|
|
198
|
+
export interface RevealSession {
|
|
199
|
+
id: string;
|
|
200
|
+
idempotencyKey: string;
|
|
201
|
+
applicationId: string;
|
|
202
|
+
environment: 'TEST' | 'LIVE';
|
|
203
|
+
planId: string;
|
|
204
|
+
mode: RevealMode;
|
|
205
|
+
stage: RevealStage;
|
|
206
|
+
materialVersion?: string;
|
|
207
|
+
expiresAt: string;
|
|
208
|
+
createdAt: string;
|
|
209
|
+
updatedAt: string;
|
|
210
|
+
participantDecisions?: unknown;
|
|
211
|
+
/** Server-resolved governed progress. Omitted for direct reveals or unavailable source progress. */
|
|
212
|
+
approvedModerators?: number;
|
|
213
|
+
requiredModerators?: number;
|
|
214
|
+
closedReason?: RevealCloseReason;
|
|
215
|
+
}
|
|
216
|
+
export interface AuthorizeRevealActionInput {
|
|
217
|
+
idempotencyKey: string;
|
|
218
|
+
assetId: string;
|
|
219
|
+
fieldName?: string;
|
|
220
|
+
action: RevealActionType;
|
|
221
|
+
origin?: string;
|
|
222
|
+
}
|
|
223
|
+
export interface ReportRevealActionOutcomeInput {
|
|
224
|
+
idempotencyKey: string;
|
|
225
|
+
outcome: RevealActionOutcome;
|
|
226
|
+
reportedAt: string;
|
|
227
|
+
errorCode?: string;
|
|
228
|
+
}
|
|
229
|
+
export interface RevealAction {
|
|
230
|
+
id: string;
|
|
231
|
+
revealId: string;
|
|
232
|
+
assetId: string;
|
|
233
|
+
fieldName?: string;
|
|
234
|
+
action: RevealActionType;
|
|
235
|
+
status: 'AUTHORIZED' | RevealActionOutcome;
|
|
236
|
+
origin?: string;
|
|
237
|
+
outcome?: RevealActionOutcome;
|
|
238
|
+
errorCode?: string;
|
|
239
|
+
createdAt?: string;
|
|
240
|
+
updatedAt?: string;
|
|
241
|
+
}
|
|
242
|
+
export type CustodianShareResult = {
|
|
243
|
+
status: 'PENDING';
|
|
244
|
+
} | {
|
|
245
|
+
id: string;
|
|
246
|
+
shares: string[];
|
|
247
|
+
planId: string;
|
|
248
|
+
isMergeAuthority: boolean;
|
|
249
|
+
};
|
|
250
|
+
export declare class RevealActionsNotOpen extends Error {
|
|
251
|
+
readonly stage: string;
|
|
252
|
+
readonly code = "reveal_actions_not_open";
|
|
253
|
+
constructor(stage: string);
|
|
254
|
+
}
|
|
140
255
|
export declare class ElementsApiPortRequired extends Error {
|
|
141
256
|
constructor();
|
|
142
257
|
}
|
|
@@ -1,17 +1,36 @@
|
|
|
1
1
|
import type { SDKContainer } from '@safetech/inheriti-core-sdk/vanilla';
|
|
2
2
|
import type { KeyVault } from './key-vault';
|
|
3
3
|
import type { StatePort } from './state-port';
|
|
4
|
-
import type { CollectedPlanMaterial, ElementsApiPort, ExportPlanBridgeInput, GovernedRevealSession, GovernedRevealState, PlanBridgeEnvelope, StepUpReadContext } from './elements-api-port';
|
|
4
|
+
import type { AuthorizeRevealActionInput, CollectedPlanMaterial, CustodianShareResult, ElementsApiPort, ExportPlanBridgeInput, GovernedRevealSession, GovernedRevealState, PlanBridgeEnvelope, ReportRevealActionOutcomeInput, RevealAction, RevealCloseReason, RevealReconstructionInput, RevealSession, StartRevealInput, StepUpReadContext } from './elements-api-port';
|
|
5
5
|
import type { PlanMaterialReconstructor } from './plan-material-reconstructor';
|
|
6
|
+
import type { MasterKeyResolver } from './master-key';
|
|
7
|
+
import type { PlanAssetDeclaration } from '@safetech/inheriti-core-sdk';
|
|
8
|
+
import type { EncryptedPlanMaterial, ListPlansInput, PlanCreationProgress, PlanDetail, PlanPage, StartPlanCreationInput } from './plan-operations';
|
|
9
|
+
import type { GuidedCreateCheckpointStore } from './guided-plan-creator';
|
|
10
|
+
import { GuidedPlanCreator } from './guided-plan-creator';
|
|
11
|
+
import type { OpenRevealOptions, RevealHandle } from './scoped-reveal';
|
|
12
|
+
export interface DecodedPlanAsset {
|
|
13
|
+
id: string;
|
|
14
|
+
data: Uint8Array;
|
|
15
|
+
}
|
|
16
|
+
export type PlanAssetContainerDecoder = (material: Uint8Array) => readonly DecodedPlanAsset[];
|
|
6
17
|
export interface ElementsClientOptions {
|
|
7
18
|
coreSdk: SDKContainer;
|
|
8
19
|
keyVault?: KeyVault;
|
|
9
20
|
state?: StatePort;
|
|
10
21
|
api?: ElementsApiPort;
|
|
11
22
|
reconstructor?: PlanMaterialReconstructor;
|
|
23
|
+
/**
|
|
24
|
+
* Resolves master keys per plan. A host may need several: its own Application key
|
|
25
|
+
* and a foreign organization key for each bridged plan it opens.
|
|
26
|
+
*/
|
|
27
|
+
masterKeys: MasterKeyResolver;
|
|
28
|
+
/** The Application this client acts for; needed to wrap keys of plans it creates. */
|
|
29
|
+
applicationId: string;
|
|
30
|
+
assetDecoder: PlanAssetContainerDecoder;
|
|
12
31
|
}
|
|
13
32
|
export default class ElementsClient {
|
|
14
|
-
|
|
33
|
+
readonly coreSdk: SDKContainer;
|
|
15
34
|
readonly keyVault: KeyVault;
|
|
16
35
|
readonly state: StatePort;
|
|
17
36
|
constructor(coreSdk: SDKContainer, options?: {
|
|
@@ -19,15 +38,96 @@ export default class ElementsClient {
|
|
|
19
38
|
state?: StatePort;
|
|
20
39
|
api?: ElementsApiPort;
|
|
21
40
|
reconstructor?: PlanMaterialReconstructor;
|
|
41
|
+
masterKeys?: MasterKeyResolver;
|
|
42
|
+
applicationId?: string;
|
|
43
|
+
assetDecoder?: PlanAssetContainerDecoder;
|
|
22
44
|
});
|
|
23
45
|
private readonly api?;
|
|
24
46
|
private readonly reconstructor?;
|
|
25
|
-
|
|
26
|
-
|
|
47
|
+
private readonly masterKeys?;
|
|
48
|
+
private readonly applicationId?;
|
|
49
|
+
readonly assetDecoder?: PlanAssetContainerDecoder;
|
|
50
|
+
listPlans(input?: ListPlansInput): Promise<PlanPage>;
|
|
51
|
+
getPlan(planId: string): Promise<PlanDetail>;
|
|
52
|
+
startPlanCreation(input: StartPlanCreationInput): Promise<PlanCreationProgress>;
|
|
53
|
+
getPlanCreation(operationId: string): Promise<PlanCreationProgress>;
|
|
54
|
+
supplyPlanCreationMaterial(operationId: string, material: EncryptedPlanMaterial): Promise<PlanCreationProgress>;
|
|
55
|
+
cancelPlanCreation(operationId: string): Promise<PlanCreationProgress>;
|
|
56
|
+
/**
|
|
57
|
+
* The resumable creation flow over this client's own port.
|
|
58
|
+
*
|
|
59
|
+
* The four calls above are the raw stages; a host that wants recovery, progress and the
|
|
60
|
+
* encrypt/split step in the right order drives them through here instead. Checkpoints
|
|
61
|
+
* default to process memory because they only need to outlive the operation, not the host.
|
|
62
|
+
*/
|
|
63
|
+
guidedPlanCreator(checkpoints?: GuidedCreateCheckpointStore): GuidedPlanCreator;
|
|
64
|
+
/**
|
|
65
|
+
* Creates the plan definition from a declaration of what it will protect.
|
|
66
|
+
*
|
|
67
|
+
* Elements takes a `PlanAssetDeclaration` rather than the assets themselves: creation
|
|
68
|
+
* persists metadata only, and a host that has not yet collected any secret should be
|
|
69
|
+
* able to reach this point. Where Business keeps the secrets in browser storage between
|
|
70
|
+
* its create and configure pages, an Elements host holds the declaration and supplies
|
|
71
|
+
* the secrets to `configurePlan()` — how it carries them across is its own decision.
|
|
72
|
+
*/
|
|
73
|
+
createPlan<TInput extends {
|
|
74
|
+
assets: PlanAssetDeclaration;
|
|
75
|
+
}, TResult>(input: TInput): Promise<TResult>;
|
|
76
|
+
/**
|
|
77
|
+
* Configures a plan under the Application's required master key. The key is resolved
|
|
78
|
+
* through the configured custody source; it is never an operation parameter.
|
|
79
|
+
*/
|
|
80
|
+
configurePlan<TInput extends object, TResult>(input: TInput): Promise<TResult>;
|
|
81
|
+
/** Resolves the Application's required master key without exposing it as an operation argument. */
|
|
82
|
+
applicationMasterKey(): Promise<string>;
|
|
83
|
+
/**
|
|
84
|
+
* Resolves the key that opens a plan before anything is collected.
|
|
85
|
+
*
|
|
86
|
+
* Ordering matters: collecting releases the custodian share and advances the reveal,
|
|
87
|
+
* so discovering afterwards that the key is unavailable spends a one-shot release for
|
|
88
|
+
* nothing. Resolving first also keeps a single SafeKey interaction — the relay — ahead
|
|
89
|
+
* of the custodian's, instead of interleaving two device round trips.
|
|
90
|
+
*/
|
|
91
|
+
prepareReveal(planId: string): Promise<{
|
|
92
|
+
masterKeyWrapped: boolean;
|
|
93
|
+
masterKeyHex?: string;
|
|
94
|
+
}>;
|
|
95
|
+
/**
|
|
96
|
+
* The whole direct reveal in the order it must happen: hold the key, then collect,
|
|
97
|
+
* then reconstruct.
|
|
98
|
+
*/
|
|
99
|
+
revealPlan(planId: string, stepUp?: StepUpReadContext): Promise<Uint8Array>;
|
|
27
100
|
collectPlanMaterial(planId: string, stepUp?: StepUpReadContext): Promise<CollectedPlanMaterial>;
|
|
28
101
|
reconstructPlanMaterial(material: CollectedPlanMaterial): Promise<Uint8Array>;
|
|
102
|
+
/**
|
|
103
|
+
* Resolves the key that opens this plan, caching it in the vault.
|
|
104
|
+
*
|
|
105
|
+
* Fails with the reference named rather than letting an unwrap collapse into an
|
|
106
|
+
* opaque decrypt error: "you are missing the key for Business organization X" is the
|
|
107
|
+
* diagnostic that matters.
|
|
108
|
+
*/
|
|
109
|
+
resolveMasterKey(material: {
|
|
110
|
+
planId: string;
|
|
111
|
+
masterKeyWrapped?: boolean;
|
|
112
|
+
tenantId?: string;
|
|
113
|
+
sourceReference?: {
|
|
114
|
+
system: string;
|
|
115
|
+
contextId: string;
|
|
116
|
+
};
|
|
117
|
+
}): Promise<string | undefined>;
|
|
29
118
|
initializeGovernedReveal(planId: string, stepUp?: StepUpReadContext): Promise<GovernedRevealSession>;
|
|
30
119
|
getGovernedReveal(processId: string, stepUp?: StepUpReadContext): Promise<GovernedRevealState>;
|
|
120
|
+
startReveal(planId: string, input: StartRevealInput): Promise<RevealSession>;
|
|
121
|
+
getReveal(revealId: string): Promise<RevealSession>;
|
|
122
|
+
openReveal(planId: string, options?: OpenRevealOptions): Promise<RevealHandle>;
|
|
123
|
+
withReveal<TResult>(planId: string, options: OpenRevealOptions, work: (reveal: RevealHandle) => Promise<TResult>): Promise<TResult>;
|
|
124
|
+
releaseRevealMaterial(revealId: string, materialVersion: string): Promise<unknown>;
|
|
125
|
+
reportRevealReconstruction(revealId: string, input: RevealReconstructionInput): Promise<RevealSession>;
|
|
126
|
+
closeReveal(revealId: string, reason: RevealCloseReason): Promise<RevealSession>;
|
|
127
|
+
authorizeRevealAction(revealId: string, input: AuthorizeRevealActionInput): Promise<RevealAction>;
|
|
128
|
+
reportRevealActionOutcome(revealId: string, actionId: string, input: ReportRevealActionOutcomeInput): Promise<RevealAction>;
|
|
129
|
+
getCustodianShare(processId: string, stepUp?: StepUpReadContext): Promise<CustodianShareResult>;
|
|
130
|
+
releaseCustodianShare(processId: string): Promise<void>;
|
|
31
131
|
exportPlanBridge(planId: string, input: ExportPlanBridgeInput): Promise<PlanBridgeEnvelope>;
|
|
32
132
|
importPlanBridge(envelope: PlanBridgeEnvelope): Promise<{
|
|
33
133
|
planId: string;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { ElementsApiPort } from './elements-api-port';
|
|
2
|
+
import type { EncryptedPlanMaterial, GuidedCreateCheckpoint, GuidedCreateLocalStage, PlanCreationProgress, StartPlanCreationInput } from './plan-operations';
|
|
3
|
+
export interface GuidedCreateCheckpointStore {
|
|
4
|
+
load(operationId: string): Promise<GuidedCreateCheckpoint | undefined>;
|
|
5
|
+
save(checkpoint: GuidedCreateCheckpoint): Promise<void>;
|
|
6
|
+
remove(operationId: string): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
export interface PlanMaterialBuilder<TSecrets, TEncrypted = unknown> {
|
|
9
|
+
encrypt(input: {
|
|
10
|
+
planId: string;
|
|
11
|
+
declaration: StartPlanCreationInput;
|
|
12
|
+
secrets: TSecrets;
|
|
13
|
+
signal?: AbortSignal;
|
|
14
|
+
}): Promise<TEncrypted>;
|
|
15
|
+
generateShares(input: {
|
|
16
|
+
planId: string;
|
|
17
|
+
declaration: StartPlanCreationInput;
|
|
18
|
+
encrypted: TEncrypted;
|
|
19
|
+
signal?: AbortSignal;
|
|
20
|
+
}): Promise<EncryptedPlanMaterial>;
|
|
21
|
+
}
|
|
22
|
+
export interface GuidedCreateOptions {
|
|
23
|
+
signal?: AbortSignal;
|
|
24
|
+
onProgress?: (stage: GuidedCreateLocalStage | PlanCreationProgress['stage']) => void;
|
|
25
|
+
}
|
|
26
|
+
/** Process-lifetime checkpoints. A host that must survive a restart supplies a durable store. */
|
|
27
|
+
export declare class MemoryGuidedCreateCheckpointStore implements GuidedCreateCheckpointStore {
|
|
28
|
+
private readonly checkpoints;
|
|
29
|
+
load(operationId: string): Promise<GuidedCreateCheckpoint | undefined>;
|
|
30
|
+
save(checkpoint: GuidedCreateCheckpoint): Promise<void>;
|
|
31
|
+
remove(operationId: string): Promise<void>;
|
|
32
|
+
}
|
|
33
|
+
/** Resumable orchestration. Only its non-secret checkpoint may survive process restart. */
|
|
34
|
+
export declare class GuidedPlanCreator {
|
|
35
|
+
private readonly api;
|
|
36
|
+
private readonly checkpoints;
|
|
37
|
+
constructor(api: ElementsApiPort, checkpoints: GuidedCreateCheckpointStore);
|
|
38
|
+
start(input: StartPlanCreationInput, options?: GuidedCreateOptions): Promise<PlanCreationProgress>;
|
|
39
|
+
status(operationId: string): Promise<PlanCreationProgress>;
|
|
40
|
+
resume<TSecrets, TEncrypted>(operationId: string, declaration: StartPlanCreationInput, secrets: TSecrets, builder: PlanMaterialBuilder<TSecrets, TEncrypted>, options?: GuidedCreateOptions): Promise<PlanCreationProgress>;
|
|
41
|
+
cancel(operationId: string): Promise<PlanCreationProgress>;
|
|
42
|
+
private saveCheckpoint;
|
|
43
|
+
}
|
|
44
|
+
export declare class GuidedCreateRecoveryError extends Error {
|
|
45
|
+
readonly code: string;
|
|
46
|
+
constructor(code: string);
|
|
47
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { BearerTokenResolver, HttpTransport } from '@safetech/inheriti-core-sdk/node';
|
|
2
|
-
import type { CollectedPlanMaterial, ElementsApiPort, ExportPlanBridgeInput, GovernedRevealSession, GovernedRevealState, GovernedSharesMaterial, GovernedValidatorMaterial, PlanBridgeEnvelope, StepUpReadContext } from './elements-api-port';
|
|
2
|
+
import type { AuthorizeRevealActionInput, CollectedPlanMaterial, CustodianShareResult, ElementsApiPort, PlanKeyReference, ExportPlanBridgeInput, GovernedRevealSession, GovernedRevealState, GovernedSharesMaterial, GovernedValidatorMaterial, PlanBridgeEnvelope, ReportRevealActionOutcomeInput, RevealAction, RevealCloseReason, RevealReconstructionInput, RevealSession, StartRevealInput, StepUpReadContext } from './elements-api-port';
|
|
3
|
+
import type { EncryptedPlanMaterial, ListPlansInput, PlanCreationProgress, PlanDetail, PlanPage, StartPlanCreationInput } from './plan-operations';
|
|
3
4
|
export declare class ElementsApiRequestFailed extends Error {
|
|
4
5
|
readonly status: number;
|
|
5
6
|
readonly code?: string | undefined;
|
|
@@ -13,6 +14,13 @@ export default class HttpElementsApiPort implements ElementsApiPort {
|
|
|
13
14
|
private readonly getBearerToken;
|
|
14
15
|
private readonly transport;
|
|
15
16
|
constructor(apiUrl: string, environment: 'TEST' | 'LIVE', getBearerToken: BearerTokenResolver, transport: HttpTransport);
|
|
17
|
+
listPlans(input?: ListPlansInput): Promise<PlanPage>;
|
|
18
|
+
getPlan(planId: string): Promise<PlanDetail>;
|
|
19
|
+
startPlanCreation(input: StartPlanCreationInput): Promise<PlanCreationProgress>;
|
|
20
|
+
getPlanCreation(operationId: string): Promise<PlanCreationProgress>;
|
|
21
|
+
supplyPlanCreationMaterial(operationId: string, material: EncryptedPlanMaterial): Promise<PlanCreationProgress>;
|
|
22
|
+
cancelPlanCreation(operationId: string): Promise<PlanCreationProgress>;
|
|
23
|
+
planKeyReference(planId: string): Promise<PlanKeyReference>;
|
|
16
24
|
collectPlanMaterial(planId: string, stepUp?: StepUpReadContext): Promise<CollectedPlanMaterial>;
|
|
17
25
|
initializeGovernedReveal(planId: string, stepUp?: StepUpReadContext): Promise<GovernedRevealSession>;
|
|
18
26
|
getGovernedReveal(processId: string, stepUp?: StepUpReadContext): Promise<GovernedRevealState>;
|
|
@@ -22,6 +30,15 @@ export default class HttpElementsApiPort implements ElementsApiPort {
|
|
|
22
30
|
markGovernedSharesReconstructed(processId: string): Promise<void>;
|
|
23
31
|
markGovernedDataRevealed(processId: string): Promise<void>;
|
|
24
32
|
closeGovernedReveal(processId: string): Promise<void>;
|
|
33
|
+
startReveal(planId: string, input: StartRevealInput): Promise<RevealSession>;
|
|
34
|
+
getReveal(revealId: string): Promise<RevealSession>;
|
|
35
|
+
releaseRevealMaterial(revealId: string, materialVersion: string): Promise<unknown>;
|
|
36
|
+
reportRevealReconstruction(revealId: string, input: RevealReconstructionInput): Promise<RevealSession>;
|
|
37
|
+
closeReveal(revealId: string, reason: RevealCloseReason): Promise<RevealSession>;
|
|
38
|
+
authorizeRevealAction(revealId: string, input: AuthorizeRevealActionInput): Promise<RevealAction>;
|
|
39
|
+
reportRevealActionOutcome(revealId: string, actionId: string, input: ReportRevealActionOutcomeInput): Promise<RevealAction>;
|
|
40
|
+
getCustodianShare(processId: string, stepUp?: StepUpReadContext): Promise<CustodianShareResult>;
|
|
41
|
+
releaseCustodianShare(processId: string): Promise<void>;
|
|
25
42
|
exportPlanBridge(planId: string, input: ExportPlanBridgeInput): Promise<PlanBridgeEnvelope>;
|
|
26
43
|
importPlanBridge(envelope: PlanBridgeEnvelope): Promise<{
|
|
27
44
|
planId: string;
|
|
@@ -1,12 +1,26 @@
|
|
|
1
1
|
export { default as ElementsClient, createElementsClient } from './elements-client';
|
|
2
2
|
export type { ElementsClientOptions } from './elements-client';
|
|
3
|
+
export type { DecodedPlanAsset, PlanAssetContainerDecoder } from './elements-client';
|
|
3
4
|
export { MemoryKeyVault } from './key-vault';
|
|
4
5
|
export type { KeyVault } from './key-vault';
|
|
5
6
|
export { MemoryStatePort } from './state-port';
|
|
6
7
|
export type { StatePort } from './state-port';
|
|
7
8
|
export type { CollectedPlanMaterial, ElementsApiPort, StepUpReadContext } from './elements-api-port';
|
|
8
9
|
export type { GovernedRevealSession, GovernedRevealState, GovernedShare, GovernedSharesMaterial, GovernedValidatorMaterial } from './elements-api-port';
|
|
10
|
+
export type { AuthorizeRevealActionInput, CustodianShareResult, ReportRevealActionOutcomeInput, RevealAction, RevealActionOutcome, RevealActionType, RevealCloseReason, RevealMode, RevealReconstructionInput, RevealSession, RevealStage, StartRevealInput } from './elements-api-port';
|
|
9
11
|
export type { ExportPlanBridgeInput, PlanBridgeEnvelope, PlanRevealProfile } from './elements-api-port';
|
|
10
|
-
export { ElementsApiPortRequired } from './elements-api-port';
|
|
12
|
+
export { ElementsApiPortRequired, RevealActionsNotOpen } from './elements-api-port';
|
|
13
|
+
export { parseAssetFieldSelector, RevealFieldAccessError, RevealHandleClosed } from './scoped-reveal';
|
|
14
|
+
export type { AssetFieldSelector, OpenRevealOptions, RevealFieldOptions, RevealHandle } from './scoped-reveal';
|
|
15
|
+
export { default as HttpElementsApiPort, ElementsApiRequestFailed } from './http-elements-api-port';
|
|
11
16
|
export type { PlanMaterialReconstructor } from './plan-material-reconstructor';
|
|
12
17
|
export { PlanMaterialReconstructorRequired } from './plan-material-reconstructor';
|
|
18
|
+
export { MasterKeyRequired, StaticMasterKeyResolver, masterKeyRefFor, masterKeyRefKey } from './master-key';
|
|
19
|
+
export type { MasterKeyRef, MasterKeyResolver } from './master-key';
|
|
20
|
+
export { unwrapDekWithMasterKey } from './unwrap-dek';
|
|
21
|
+
export { RelayMasterKeySource, MasterKeyRelayExpired, MasterKeyRelayTimedOut } from './relay-master-key-source';
|
|
22
|
+
export type { MasterKeyRelayPort, RelayMasterKeySourceOptions } from './relay-master-key-source';
|
|
23
|
+
export { HostProcessRuntimeEnvironment, LocalProcessReconciliationOwnership, PollingSharedPlanEventListener } from './polling-shared-plan-event-listener';
|
|
24
|
+
export * from './plan-operations';
|
|
25
|
+
export * from './guided-plan-creator';
|
|
26
|
+
export * from './core-plan-material-builder';
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
+
import type { MasterKeyRef } from './master-key';
|
|
2
|
+
/**
|
|
3
|
+
* Where the host keeps master keys between operations.
|
|
4
|
+
*
|
|
5
|
+
* Keyed by master key reference rather than by Application: a host may hold its own
|
|
6
|
+
* Application key alongside a foreign organization key for each bridged plan, and those
|
|
7
|
+
* are different keys that must not collide.
|
|
8
|
+
*/
|
|
1
9
|
export interface KeyVault {
|
|
2
|
-
store(
|
|
3
|
-
load(
|
|
4
|
-
remove(
|
|
10
|
+
store(ref: MasterKeyRef, key: Uint8Array): Promise<void>;
|
|
11
|
+
load(ref: MasterKeyRef): Promise<Uint8Array | undefined>;
|
|
12
|
+
remove(ref: MasterKeyRef): Promise<void>;
|
|
5
13
|
}
|
|
6
14
|
export declare class MemoryKeyVault implements KeyVault {
|
|
7
15
|
private readonly keys;
|
|
8
|
-
store(
|
|
9
|
-
load(
|
|
10
|
-
remove(
|
|
16
|
+
store(ref: MasterKeyRef, key: Uint8Array): Promise<void>;
|
|
17
|
+
load(ref: MasterKeyRef): Promise<Uint8Array | undefined>;
|
|
18
|
+
remove(ref: MasterKeyRef): Promise<void>;
|
|
11
19
|
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { MasterKeySource } from '@safetech/inheriti-core-sdk';
|
|
2
|
+
/**
|
|
3
|
+
* Identifies which master key opens a plan.
|
|
4
|
+
*
|
|
5
|
+
* A plan's key is a property of the plan, not of the Application holding it: a bridged
|
|
6
|
+
* plan is never re-wrapped, so it stays sealed under the key of the context it came
|
|
7
|
+
* from. One host may therefore need several keys at once — its own Application key and
|
|
8
|
+
* a foreign organization key for each bridged plan.
|
|
9
|
+
*/
|
|
10
|
+
export interface MasterKeyRef {
|
|
11
|
+
system: 'INHERITI_BUSINESS' | 'INHERITI_ELEMENTS';
|
|
12
|
+
contextId: string;
|
|
13
|
+
}
|
|
14
|
+
/** Stable string form of a ref, used as the `KeyVault` key. */
|
|
15
|
+
export declare function masterKeyRefKey(ref: MasterKeyRef): string;
|
|
16
|
+
/**
|
|
17
|
+
* Resolves the master key for a given plan's key reference.
|
|
18
|
+
*
|
|
19
|
+
* Custody says how a key came into existence; a resolver says how *this* host obtains
|
|
20
|
+
* it. The two are independent, so a resolver may derive one key, read another from a
|
|
21
|
+
* KMS, and relay a third.
|
|
22
|
+
*/
|
|
23
|
+
export interface MasterKeyResolver {
|
|
24
|
+
resolve(ref: MasterKeyRef): Promise<string | undefined>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Derives which key opens a plan.
|
|
28
|
+
*
|
|
29
|
+
* A bridged plan names its source context; a locally created one is opened by the key
|
|
30
|
+
* of the Application holding it.
|
|
31
|
+
*/
|
|
32
|
+
export declare function masterKeyRefFor(material: {
|
|
33
|
+
tenantId?: string;
|
|
34
|
+
sourceReference?: {
|
|
35
|
+
system: string;
|
|
36
|
+
contextId: string;
|
|
37
|
+
};
|
|
38
|
+
}): MasterKeyRef | undefined;
|
|
39
|
+
/** Thrown when a plan is master key wrapped and no key resolves for its reference. */
|
|
40
|
+
export declare class MasterKeyRequired extends Error {
|
|
41
|
+
readonly ref: MasterKeyRef;
|
|
42
|
+
constructor(ref: MasterKeyRef);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Resolves keys from a static map of references to sources.
|
|
46
|
+
*
|
|
47
|
+
* Sources come from the Core SDK, so a passphrase-derived key and one supplied from a
|
|
48
|
+
* KMS are the same to everything downstream.
|
|
49
|
+
*/
|
|
50
|
+
export declare class StaticMasterKeyResolver implements MasterKeyResolver {
|
|
51
|
+
private readonly sources;
|
|
52
|
+
constructor(entries?: Array<{
|
|
53
|
+
ref: MasterKeyRef;
|
|
54
|
+
source: MasterKeySource;
|
|
55
|
+
}>);
|
|
56
|
+
register(ref: MasterKeyRef, source: MasterKeySource): this;
|
|
57
|
+
resolve(ref: MasterKeyRef): Promise<string | undefined>;
|
|
58
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CollectedPlanMaterial } from './elements-api-port';
|
|
2
2
|
import type { PlanMaterialReconstructor } from './plan-material-reconstructor';
|
|
3
3
|
export default class NodePlanMaterialReconstructor implements PlanMaterialReconstructor {
|
|
4
|
-
reconstruct(material: CollectedPlanMaterial): Promise<Uint8Array>;
|
|
4
|
+
reconstruct(material: CollectedPlanMaterial, masterKeyHex?: string): Promise<Uint8Array>;
|
|
5
5
|
private decryptShare;
|
|
6
6
|
private decodeBase64;
|
|
7
7
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { CollectedPlanMaterial } from './elements-api-port';
|
|
2
2
|
export interface PlanMaterialReconstructor {
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* `masterKeyHex` is required when the material reports `masterKeyWrapped`: the plan
|
|
5
|
+
* key comes back sealed and the platform cannot open it.
|
|
6
|
+
*/
|
|
7
|
+
reconstruct(material: CollectedPlanMaterial, masterKeyHex?: string): Promise<Uint8Array>;
|
|
4
8
|
}
|
|
5
9
|
export declare class PlanMaterialReconstructorRequired extends Error {
|
|
6
10
|
constructor();
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PlanCreationProgress, PlanDetail, PlanPage } from './plan-operations';
|
|
2
|
+
export declare function decodePlanPage(value: unknown): PlanPage;
|
|
3
|
+
export declare function decodePlanDetail(value: unknown): PlanDetail;
|
|
4
|
+
export declare function decodePlanCreationProgress(value: unknown): PlanCreationProgress;
|