@safetech/inheriti-client-sdk 1.17.3 → 1.17.4
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 +3 -3
- package/dist/browser.d.ts +70 -2
- package/dist/browser.js +1 -1
- package/dist/index.js +1 -1
- package/dist/inheriti-client-sdk.umd.js +82 -47
- package/dist/node.d.ts +13 -2
- package/dist/node.js +1 -1
- package/dist/sdk-types.d.ts +434 -140
- package/dist/src/elements/browser-plan-material-reconstructor.d.ts +23 -0
- package/dist/src/elements/core-plan-material-builder.d.ts +1 -0
- package/dist/src/elements/elements-api-port.d.ts +78 -3
- package/dist/src/elements/elements-client.d.ts +56 -5
- package/dist/src/elements/http-elements-api-port.d.ts +20 -1
- package/dist/src/elements/index.d.ts +7 -3
- package/dist/src/elements/master-key-acquisition.d.ts +46 -0
- package/dist/src/elements/node-plan-material-reconstructor.d.ts +9 -6
- package/dist/src/elements/plan-operations.d.ts +62 -4
- package/dist/src/elements/scoped-reveal.d.ts +62 -1
- package/dist/src/elements/ssdp-v2-plan-material-reconstructor.d.ts +17 -0
- package/node.ts +14 -3
- package/package.json +2 -2
package/dist/sdk-types.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { SDKContainer } from '@safetech/inheriti-core-sdk/vanilla';
|
|
|
2
2
|
export { SDKContainer } from '@safetech/inheriti-core-sdk/vanilla';
|
|
3
3
|
import { ValidEnv, AuthClientProps, MasterKeySource, PlanAssetDeclaration, DataAsset } from '@safetech/inheriti-core-sdk';
|
|
4
4
|
export * from '@safetech/inheriti-core-sdk';
|
|
5
|
+
export { MasterKeySource } from '@safetech/inheriti-core-sdk';
|
|
5
6
|
import * as react from 'react';
|
|
6
7
|
import { ReactNode } from 'react';
|
|
7
8
|
import { BearerTokenResolver, HttpTransport } from '@safetech/inheriti-core-sdk/node';
|
|
@@ -58,95 +59,6 @@ declare function getAvailableEnvs(): {
|
|
|
58
59
|
demoKeyApiUrl: string;
|
|
59
60
|
};
|
|
60
61
|
|
|
61
|
-
/**
|
|
62
|
-
* Identifies which master key opens a plan.
|
|
63
|
-
*
|
|
64
|
-
* A plan's key is a property of the plan, not of the Application holding it: a bridged
|
|
65
|
-
* plan is never re-wrapped, so it stays sealed under the key of the context it came
|
|
66
|
-
* from. One host may therefore need several keys at once — its own Application key and
|
|
67
|
-
* a foreign organization key for each bridged plan.
|
|
68
|
-
*/
|
|
69
|
-
interface MasterKeyRef {
|
|
70
|
-
system: 'INHERITI_BUSINESS' | 'INHERITI_ELEMENTS';
|
|
71
|
-
contextId: string;
|
|
72
|
-
}
|
|
73
|
-
/** Stable string form of a ref, used as the `KeyVault` key. */
|
|
74
|
-
declare function masterKeyRefKey(ref: MasterKeyRef): string;
|
|
75
|
-
/**
|
|
76
|
-
* Resolves the master key for a given plan's key reference.
|
|
77
|
-
*
|
|
78
|
-
* Custody says how a key came into existence; a resolver says how *this* host obtains
|
|
79
|
-
* it. The two are independent, so a resolver may derive one key, read another from a
|
|
80
|
-
* KMS, and relay a third.
|
|
81
|
-
*/
|
|
82
|
-
interface MasterKeyResolver {
|
|
83
|
-
resolve(ref: MasterKeyRef): Promise<string | undefined>;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Derives which key opens a plan.
|
|
87
|
-
*
|
|
88
|
-
* A bridged plan names its source context; a locally created one is opened by the key
|
|
89
|
-
* of the Application holding it.
|
|
90
|
-
*/
|
|
91
|
-
declare function masterKeyRefFor(material: {
|
|
92
|
-
tenantId?: string;
|
|
93
|
-
sourceReference?: {
|
|
94
|
-
system: string;
|
|
95
|
-
contextId: string;
|
|
96
|
-
};
|
|
97
|
-
}): MasterKeyRef | undefined;
|
|
98
|
-
/** Thrown when a plan is master key wrapped and no key resolves for its reference. */
|
|
99
|
-
declare class MasterKeyRequired extends Error {
|
|
100
|
-
readonly ref: MasterKeyRef;
|
|
101
|
-
constructor(ref: MasterKeyRef);
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Resolves keys from a static map of references to sources.
|
|
105
|
-
*
|
|
106
|
-
* Sources come from the Core SDK, so a passphrase-derived key and one supplied from a
|
|
107
|
-
* KMS are the same to everything downstream.
|
|
108
|
-
*/
|
|
109
|
-
declare class StaticMasterKeyResolver implements MasterKeyResolver {
|
|
110
|
-
private readonly sources;
|
|
111
|
-
constructor(entries?: Array<{
|
|
112
|
-
ref: MasterKeyRef;
|
|
113
|
-
source: MasterKeySource;
|
|
114
|
-
}>);
|
|
115
|
-
register(ref: MasterKeyRef, source: MasterKeySource): this;
|
|
116
|
-
resolve(ref: MasterKeyRef): Promise<string | undefined>;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Where the host keeps master keys between operations.
|
|
121
|
-
*
|
|
122
|
-
* Keyed by master key reference rather than by Application: a host may hold its own
|
|
123
|
-
* Application key alongside a foreign organization key for each bridged plan, and those
|
|
124
|
-
* are different keys that must not collide.
|
|
125
|
-
*/
|
|
126
|
-
interface KeyVault {
|
|
127
|
-
store(ref: MasterKeyRef, key: Uint8Array): Promise<void>;
|
|
128
|
-
load(ref: MasterKeyRef): Promise<Uint8Array | undefined>;
|
|
129
|
-
remove(ref: MasterKeyRef): Promise<void>;
|
|
130
|
-
}
|
|
131
|
-
declare class MemoryKeyVault implements KeyVault {
|
|
132
|
-
private readonly keys;
|
|
133
|
-
store(ref: MasterKeyRef, key: Uint8Array): Promise<void>;
|
|
134
|
-
load(ref: MasterKeyRef): Promise<Uint8Array | undefined>;
|
|
135
|
-
remove(ref: MasterKeyRef): Promise<void>;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
interface StatePort {
|
|
139
|
-
set<T>(key: string, value: T): Promise<void>;
|
|
140
|
-
get<T>(key: string): Promise<T | undefined>;
|
|
141
|
-
remove(key: string): Promise<void>;
|
|
142
|
-
}
|
|
143
|
-
declare class MemoryStatePort implements StatePort {
|
|
144
|
-
private readonly values;
|
|
145
|
-
set<T>(key: string, value: T): Promise<void>;
|
|
146
|
-
get<T>(key: string): Promise<T | undefined>;
|
|
147
|
-
remove(key: string): Promise<void>;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
62
|
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
63
|
type CanonicalPlanAssetType = (typeof CANONICAL_PLAN_ASSET_TYPES)[number];
|
|
152
64
|
declare const CANONICAL_STRUCTURED_ASSET_FIELDS: Readonly<Record<Exclude<CanonicalPlanAssetType, 'DOCUMENT' | 'IMAGE' | 'VIDEO'>, readonly string[]>>;
|
|
@@ -160,6 +72,8 @@ type PlanParticipantRelationship = 'OWNER' | 'MERGER' | 'MODERATOR' | 'CUSTODIAN
|
|
|
160
72
|
interface PlanAssetSummary {
|
|
161
73
|
count: number;
|
|
162
74
|
types: CompatibleValue<CanonicalPlanAssetType>[];
|
|
75
|
+
/** The names the developer gave the assets, in plan order. A binary asset's filename is not here. */
|
|
76
|
+
names: string[];
|
|
163
77
|
}
|
|
164
78
|
interface PlanSummary {
|
|
165
79
|
id: string;
|
|
@@ -178,6 +92,14 @@ interface PlanSummary {
|
|
|
178
92
|
mergers: number;
|
|
179
93
|
moderators: number;
|
|
180
94
|
};
|
|
95
|
+
/**
|
|
96
|
+
* The authentication a merge has to satisfy before the plan opens. Empty means the plan carries
|
|
97
|
+
* none. A method's own settings are not part of the host-facing shape.
|
|
98
|
+
*/
|
|
99
|
+
authentication: Array<{
|
|
100
|
+
id: CompatibleValue<'SK_MOBILE'>;
|
|
101
|
+
status: CompatibleValue<'ACTIVE' | 'INACTIVE'>;
|
|
102
|
+
}>;
|
|
181
103
|
}
|
|
182
104
|
interface PlanPage {
|
|
183
105
|
items: PlanSummary[];
|
|
@@ -199,6 +121,10 @@ interface PlanDetail extends PlanSummary {
|
|
|
199
121
|
name: string;
|
|
200
122
|
isBinary: boolean;
|
|
201
123
|
fieldNames: string[];
|
|
124
|
+
/** Binary assets only: what the file was called, what it is, and how big. */
|
|
125
|
+
fileName?: string;
|
|
126
|
+
mimeType?: string;
|
|
127
|
+
size?: number;
|
|
202
128
|
matchOrigins?: string[];
|
|
203
129
|
}>;
|
|
204
130
|
participants: Array<{
|
|
@@ -211,6 +137,12 @@ interface PlanDetail extends PlanSummary {
|
|
|
211
137
|
masterKeyRelease: CompatibleValue<'REQUIRED'>;
|
|
212
138
|
custodian: CompatibleValue<'FORCE' | 'BYPASS'>;
|
|
213
139
|
};
|
|
140
|
+
dms?: {
|
|
141
|
+
subjectEmail: string;
|
|
142
|
+
countdownDays: number;
|
|
143
|
+
countdownHours: number;
|
|
144
|
+
countdownMinutes: number;
|
|
145
|
+
};
|
|
214
146
|
source: {
|
|
215
147
|
kind: 'NATIVE';
|
|
216
148
|
} | {
|
|
@@ -227,6 +159,12 @@ interface IntegrationPlanAssetDeclaration {
|
|
|
227
159
|
type: CanonicalPlanAssetType;
|
|
228
160
|
name: string;
|
|
229
161
|
fieldNames?: readonly string[];
|
|
162
|
+
/**
|
|
163
|
+
* Origins this asset belongs to, so an origin-bound host can tell which of a plan's logins
|
|
164
|
+
* matches the page in front of the operator. Declared at creation and returned on the plan;
|
|
165
|
+
* without it a browser host offers every field in the plan and ranks none of them.
|
|
166
|
+
*/
|
|
167
|
+
matchOrigins?: readonly string[];
|
|
230
168
|
isBinary: boolean;
|
|
231
169
|
fileName?: string;
|
|
232
170
|
mimeType?: string;
|
|
@@ -245,12 +183,37 @@ interface StartPlanCreationInput {
|
|
|
245
183
|
description?: string;
|
|
246
184
|
assets: readonly IntegrationPlanAssetDeclaration[];
|
|
247
185
|
participants: readonly NativePlanParticipant[];
|
|
248
|
-
policy?:
|
|
249
|
-
|
|
186
|
+
policy?: PlanGovernancePolicy;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* How a plan is governed, declared one layer at a time.
|
|
190
|
+
*
|
|
191
|
+
* The three layers are independent and each is optional on its own — the member confirming on their
|
|
192
|
+
* device, moderators approving, a dead man's switch running down — but a plan must select at least
|
|
193
|
+
* one. A plan nobody has to answer for is not a protected plan, so there is no way to declare one.
|
|
194
|
+
*
|
|
195
|
+
* This replaces a single `governance: 'DIRECT' | 'GOVERNED'` switch, which said that a plan was
|
|
196
|
+
* governed without saying by what, and left every layer's real configuration to a default.
|
|
197
|
+
*/
|
|
198
|
+
interface PlanGovernancePolicy {
|
|
199
|
+
/** The member proving it is them, on SafeKey Mobile. `true` takes the Application's method. */
|
|
200
|
+
authentication?: boolean | {
|
|
201
|
+
mode?: 'EXCLUSIVE' | 'ALL_REQUIRED';
|
|
202
|
+
};
|
|
203
|
+
/** Approval by the plan's `MODERATOR` participants. `UNANIMOUS` ignores `minimumApprovals`. */
|
|
204
|
+
moderation?: {
|
|
250
205
|
minimumApprovals?: number;
|
|
251
|
-
|
|
252
|
-
|
|
206
|
+
approvalMode?: 'THRESHOLD' | 'UNANIMOUS';
|
|
207
|
+
};
|
|
208
|
+
/** A countdown a designated participant can stop. Independent of the plan's type in Elements. */
|
|
209
|
+
dms?: {
|
|
210
|
+
subjectEmail: string;
|
|
211
|
+
countdownDays: number;
|
|
212
|
+
countdownHours?: number;
|
|
213
|
+
countdownMinutes?: number;
|
|
253
214
|
};
|
|
215
|
+
masterKeyRelease?: 'REQUIRED';
|
|
216
|
+
custodian?: 'FORCE' | 'BYPASS';
|
|
254
217
|
}
|
|
255
218
|
declare const PLAN_CREATION_SERVER_STAGES: readonly ["VALIDATED", "PLAN_CREATED", "PARTICIPANTS_PERSISTED", "STORAGE_PREPARED", "AWAITING_ENCRYPTED_MATERIAL", "VALIDATOR_SHARES_DISTRIBUTED", "CONFIGURED", "COMPLETED"];
|
|
256
219
|
type PlanCreationServerStage = (typeof PLAN_CREATION_SERVER_STAGES)[number];
|
|
@@ -278,7 +241,14 @@ interface EncryptedPlanMaterial {
|
|
|
278
241
|
meta: {
|
|
279
242
|
name: string;
|
|
280
243
|
notes?: string;
|
|
244
|
+
code?: string;
|
|
245
|
+
matchOrigins?: readonly string[];
|
|
281
246
|
};
|
|
247
|
+
fieldNames?: readonly string[];
|
|
248
|
+
isBinary?: boolean;
|
|
249
|
+
fileName?: string;
|
|
250
|
+
mimeType?: string;
|
|
251
|
+
size?: number;
|
|
282
252
|
}>>;
|
|
283
253
|
custodianShard?: {
|
|
284
254
|
keyShard: EncryptedPlanShard;
|
|
@@ -341,7 +311,38 @@ interface PlanKeyReference {
|
|
|
341
311
|
contextId: string;
|
|
342
312
|
};
|
|
343
313
|
}
|
|
314
|
+
/**
|
|
315
|
+
* How a host may obtain the master key for one context.
|
|
316
|
+
*
|
|
317
|
+
* Custody says how the key came into existence; `relayAvailable` says whether *this* caller can be
|
|
318
|
+
* given it by the device holding it. The two are independent, and the verifier is never returned:
|
|
319
|
+
* handing it out would hand out the check a wrong key must fail.
|
|
320
|
+
*/
|
|
321
|
+
interface MasterKeyAcquisition {
|
|
322
|
+
custody: 'DERIVED' | 'EXTERNAL';
|
|
323
|
+
configured: boolean;
|
|
324
|
+
argon2Salt: string | null;
|
|
325
|
+
relayAvailable: boolean;
|
|
326
|
+
}
|
|
327
|
+
interface MasterKeyRelaySessionOpened {
|
|
328
|
+
sessionId: string;
|
|
329
|
+
expiresAt: string | Date;
|
|
330
|
+
}
|
|
331
|
+
interface MasterKeyRelaySessionState {
|
|
332
|
+
status: 'PENDING' | 'DELIVERED' | 'EXPIRED';
|
|
333
|
+
sealedMasterKey?: string;
|
|
334
|
+
}
|
|
344
335
|
interface ElementsApiPort {
|
|
336
|
+
/** How this host can obtain the key for its own Application. */
|
|
337
|
+
masterKeyAcquisition(): Promise<MasterKeyAcquisition>;
|
|
338
|
+
/** The same, for the source context of a plan bridged from another system. */
|
|
339
|
+
foreignMasterKeyAcquisition(system: string, contextId: string): Promise<MasterKeyAcquisition>;
|
|
340
|
+
/**
|
|
341
|
+
* Asks the device holding the key to release it to this host. Creating the session *is* the
|
|
342
|
+
* SafeKey request; there is no separate "notify" step.
|
|
343
|
+
*/
|
|
344
|
+
startMasterKeyRelaySession(clientPublicKey: string): Promise<MasterKeyRelaySessionOpened>;
|
|
345
|
+
readMasterKeyRelaySession(sessionId: string): Promise<MasterKeyRelaySessionState>;
|
|
345
346
|
listPlans(input?: ListPlansInput): Promise<PlanPage>;
|
|
346
347
|
getPlan(planId: string): Promise<PlanDetail>;
|
|
347
348
|
startPlanCreation(input: StartPlanCreationInput): Promise<PlanCreationProgress>;
|
|
@@ -361,8 +362,27 @@ interface ElementsApiPort {
|
|
|
361
362
|
startReveal(planId: string, input: StartRevealInput): Promise<RevealSession>;
|
|
362
363
|
getReveal(revealId: string): Promise<RevealSession>;
|
|
363
364
|
releaseRevealMaterial(revealId: string, materialVersion: string): Promise<unknown>;
|
|
365
|
+
/** The host declaring it holds the storage-layer shares. Governed reveals only. */
|
|
366
|
+
markRevealSharesCollected(revealId: string): Promise<void>;
|
|
367
|
+
/**
|
|
368
|
+
* The custodian steps on the operator surface. The `/shared-plans/merge/...` equivalents are
|
|
369
|
+
* credential routes and refuse an operator token, so a host addresses them by reveal id.
|
|
370
|
+
*/
|
|
371
|
+
requestRevealCustodianRelease(revealId: string): Promise<void>;
|
|
372
|
+
getRevealCustodianAccess(revealId: string): Promise<CustodianShareAccess>;
|
|
373
|
+
getRevealCustodianShare(revealId: string): Promise<CustodianShareResult>;
|
|
364
374
|
reportRevealReconstruction(revealId: string, input: RevealReconstructionInput): Promise<RevealSession>;
|
|
365
375
|
closeReveal(revealId: string, reason: RevealCloseReason): Promise<RevealSession>;
|
|
376
|
+
/**
|
|
377
|
+
* Gives up the governed access this operator holds on a plan.
|
|
378
|
+
*
|
|
379
|
+
* A governed reveal outlives the session that started it, so a host that cancelled or crashed
|
|
380
|
+
* leaves an access still open; the next reveal resumes it. This is how a host says the access is
|
|
381
|
+
* not wanted after all. `aborted: false` means there was nothing to give up.
|
|
382
|
+
*/
|
|
383
|
+
abortPlanAccess(planId: string): Promise<{
|
|
384
|
+
aborted: boolean;
|
|
385
|
+
}>;
|
|
366
386
|
authorizeRevealAction(revealId: string, input: AuthorizeRevealActionInput): Promise<RevealAction>;
|
|
367
387
|
reportRevealActionOutcome(revealId: string, actionId: string, input: ReportRevealActionOutcomeInput): Promise<RevealAction>;
|
|
368
388
|
getCustodianShare(processId: string, stepUp?: StepUpReadContext): Promise<CustodianShareResult>;
|
|
@@ -493,9 +513,11 @@ interface GovernedSharesMaterial {
|
|
|
493
513
|
dek: string;
|
|
494
514
|
}
|
|
495
515
|
type RevealMode = 'DIRECT' | 'GOVERNED';
|
|
496
|
-
|
|
497
|
-
type
|
|
498
|
-
type
|
|
516
|
+
/** Reveal stages are additive. Hosts must treat unknown non-terminal values as waiting. */
|
|
517
|
+
type RevealStage = 'STARTING' | 'WAITING_FOR_DMS' | 'WAITING_FOR_PARTICIPANTS' | 'AUTHORIZED' | 'MATERIAL_AUTHORIZED' | 'MATERIAL_RELEASED' | 'RECONSTRUCTED' | 'ACTIONS_OPEN' | 'CLOSING' | 'CLOSED' | 'DENIED' | 'PARTICIPANT_REVOKED' | 'RECONCILIATION_REQUIRED' | 'EXPIRED' | 'CANCELED' | 'FAILED' | 'WAITING_FOR_CUSTODIAN_CLAIM' | 'WAITING_FOR_CUSTODIAN';
|
|
518
|
+
type RevealCloseReason = 'COMPLETED' | 'CANCELED' | 'DMS_RESET' | 'ERROR';
|
|
519
|
+
type RevealActionType = 'VIEW_FIELD' | 'COPY_FIELD' | 'USE_FIELD' | 'EXPORT_ASSET' | 'AUTOFILL_FIELD' | 'INSERT_FIELD';
|
|
520
|
+
type RevealActionDestination = 'STDIN' | 'ENVIRONMENT' | 'FILE_DESCRIPTOR' | 'LOCAL_SOCKET' | 'TEMPORARY_FILE';
|
|
499
521
|
type RevealActionOutcome = 'SUCCEEDED' | 'FAILED' | 'CANCELED';
|
|
500
522
|
interface StartRevealInput {
|
|
501
523
|
mode: RevealMode;
|
|
@@ -515,19 +537,41 @@ interface RevealSession {
|
|
|
515
537
|
stage: RevealStage;
|
|
516
538
|
materialVersion?: string;
|
|
517
539
|
expiresAt: string;
|
|
540
|
+
/** Expiry of the active dead-man's-switch gate. Present only while the DMS is pending. */
|
|
541
|
+
dmsExpiresAt?: string;
|
|
518
542
|
createdAt: string;
|
|
519
543
|
updatedAt: string;
|
|
520
544
|
participantDecisions?: unknown;
|
|
521
545
|
/** Server-resolved governed progress. Omitted for direct reveals or unavailable source progress. */
|
|
522
546
|
approvedModerators?: number;
|
|
523
547
|
requiredModerators?: number;
|
|
548
|
+
/** Server-resolved decision state for each plan moderator. */
|
|
549
|
+
moderators?: Array<{
|
|
550
|
+
id: string;
|
|
551
|
+
status: 'PENDING' | 'APPROVED' | 'REJECTED';
|
|
552
|
+
}>;
|
|
553
|
+
/**
|
|
554
|
+
* Which governance layer the reveal is stopped at, in the order they run: the dead man's switch,
|
|
555
|
+
* the member proving who they are, then the moderators. One waiting stage covers all three, so
|
|
556
|
+
* without this a host cannot tell whose action it is waiting for. Absent past governance.
|
|
557
|
+
*/
|
|
558
|
+
governanceGate?: 'DMS' | 'AUTHENTICATION' | 'MODERATION';
|
|
559
|
+
/** Deadline of the active authentication or moderation layer. */
|
|
560
|
+
governanceExpiresAt?: string;
|
|
524
561
|
closedReason?: RevealCloseReason;
|
|
525
562
|
}
|
|
563
|
+
interface CustodianShareAccess {
|
|
564
|
+
status: 'PENDING' | 'DISTRIBUTED' | 'CLAIMED' | 'INVALID' | 'NOT_FOUND';
|
|
565
|
+
deviceType: string;
|
|
566
|
+
shareId: string;
|
|
567
|
+
distributedAt: string | null;
|
|
568
|
+
}
|
|
526
569
|
interface AuthorizeRevealActionInput {
|
|
527
570
|
idempotencyKey: string;
|
|
528
571
|
assetId: string;
|
|
529
572
|
fieldName?: string;
|
|
530
573
|
action: RevealActionType;
|
|
574
|
+
destination?: RevealActionDestination;
|
|
531
575
|
origin?: string;
|
|
532
576
|
}
|
|
533
577
|
interface ReportRevealActionOutcomeInput {
|
|
@@ -542,6 +586,7 @@ interface RevealAction {
|
|
|
542
586
|
assetId: string;
|
|
543
587
|
fieldName?: string;
|
|
544
588
|
action: RevealActionType;
|
|
589
|
+
destination?: RevealActionDestination;
|
|
545
590
|
status: 'AUTHORIZED' | RevealActionOutcome;
|
|
546
591
|
origin?: string;
|
|
547
592
|
outcome?: RevealActionOutcome;
|
|
@@ -566,6 +611,177 @@ declare class ElementsApiPortRequired extends Error {
|
|
|
566
611
|
constructor();
|
|
567
612
|
}
|
|
568
613
|
|
|
614
|
+
/**
|
|
615
|
+
* Identifies which master key opens a plan.
|
|
616
|
+
*
|
|
617
|
+
* A plan's key is a property of the plan, not of the Application holding it: a bridged
|
|
618
|
+
* plan is never re-wrapped, so it stays sealed under the key of the context it came
|
|
619
|
+
* from. One host may therefore need several keys at once — its own Application key and
|
|
620
|
+
* a foreign organization key for each bridged plan.
|
|
621
|
+
*/
|
|
622
|
+
interface MasterKeyRef {
|
|
623
|
+
system: 'INHERITI_BUSINESS' | 'INHERITI_ELEMENTS';
|
|
624
|
+
contextId: string;
|
|
625
|
+
}
|
|
626
|
+
/** Stable string form of a ref, used as the `KeyVault` key. */
|
|
627
|
+
declare function masterKeyRefKey(ref: MasterKeyRef): string;
|
|
628
|
+
/**
|
|
629
|
+
* Resolves the master key for a given plan's key reference.
|
|
630
|
+
*
|
|
631
|
+
* Custody says how a key came into existence; a resolver says how *this* host obtains
|
|
632
|
+
* it. The two are independent, so a resolver may derive one key, read another from a
|
|
633
|
+
* KMS, and relay a third.
|
|
634
|
+
*/
|
|
635
|
+
interface MasterKeyResolver {
|
|
636
|
+
resolve(ref: MasterKeyRef): Promise<string | undefined>;
|
|
637
|
+
}
|
|
638
|
+
/**
|
|
639
|
+
* Derives which key opens a plan.
|
|
640
|
+
*
|
|
641
|
+
* A bridged plan names its source context; a locally created one is opened by the key
|
|
642
|
+
* of the Application holding it.
|
|
643
|
+
*/
|
|
644
|
+
declare function masterKeyRefFor(material: {
|
|
645
|
+
tenantId?: string;
|
|
646
|
+
sourceReference?: {
|
|
647
|
+
system: string;
|
|
648
|
+
contextId: string;
|
|
649
|
+
};
|
|
650
|
+
}): MasterKeyRef | undefined;
|
|
651
|
+
/** Thrown when a plan is master key wrapped and no key resolves for its reference. */
|
|
652
|
+
declare class MasterKeyRequired extends Error {
|
|
653
|
+
readonly ref: MasterKeyRef;
|
|
654
|
+
constructor(ref: MasterKeyRef);
|
|
655
|
+
}
|
|
656
|
+
/**
|
|
657
|
+
* Resolves keys from a static map of references to sources.
|
|
658
|
+
*
|
|
659
|
+
* Sources come from the Core SDK, so a passphrase-derived key and one supplied from a
|
|
660
|
+
* KMS are the same to everything downstream.
|
|
661
|
+
*/
|
|
662
|
+
declare class StaticMasterKeyResolver implements MasterKeyResolver {
|
|
663
|
+
private readonly sources;
|
|
664
|
+
constructor(entries?: Array<{
|
|
665
|
+
ref: MasterKeyRef;
|
|
666
|
+
source: MasterKeySource;
|
|
667
|
+
}>);
|
|
668
|
+
register(ref: MasterKeyRef, source: MasterKeySource): this;
|
|
669
|
+
resolve(ref: MasterKeyRef): Promise<string | undefined>;
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
interface MasterKeyRelayPort {
|
|
673
|
+
startRelaySession(clientPublicKey: string): Promise<{
|
|
674
|
+
sessionId: string;
|
|
675
|
+
expiresAt: string | Date;
|
|
676
|
+
}>;
|
|
677
|
+
readRelaySession(sessionId: string): Promise<{
|
|
678
|
+
status: 'PENDING' | 'DELIVERED' | 'EXPIRED';
|
|
679
|
+
sealedMasterKey?: string;
|
|
680
|
+
}>;
|
|
681
|
+
}
|
|
682
|
+
declare class MasterKeyRelayTimedOut extends Error {
|
|
683
|
+
readonly sessionId: string;
|
|
684
|
+
constructor(sessionId: string);
|
|
685
|
+
}
|
|
686
|
+
declare class MasterKeyRelayExpired extends Error {
|
|
687
|
+
readonly sessionId: string;
|
|
688
|
+
constructor(sessionId: string);
|
|
689
|
+
}
|
|
690
|
+
interface RelayMasterKeySourceOptions {
|
|
691
|
+
api: MasterKeyRelayPort;
|
|
692
|
+
/** How long to wait for the device before giving up. Defaults to the session lifetime. */
|
|
693
|
+
timeoutMs?: number;
|
|
694
|
+
pollIntervalMs?: number;
|
|
695
|
+
sleep?: (ms: number) => Promise<void>;
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* Obtains the master key from the device holding it.
|
|
699
|
+
*
|
|
700
|
+
* Elements has no websocket layer, so the host polls. The key is sealed to an ephemeral
|
|
701
|
+
* public key generated here and never leaves this process in the clear: the private half
|
|
702
|
+
* is not persisted, so a relayed key cannot be replayed from stored state.
|
|
703
|
+
*/
|
|
704
|
+
declare class RelayMasterKeySource implements MasterKeySource {
|
|
705
|
+
private readonly options;
|
|
706
|
+
constructor(options: RelayMasterKeySourceOptions);
|
|
707
|
+
resolve(): Promise<string>;
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
/**
|
|
711
|
+
* Local custody as a host declares it.
|
|
712
|
+
*
|
|
713
|
+
* Wider than `MasterKeySource` on purpose — see `MasterKeyAcquisitionOptions.source`. Every
|
|
714
|
+
* `MasterKeySource` satisfies it.
|
|
715
|
+
*/
|
|
716
|
+
interface DeclaredMasterKeySource {
|
|
717
|
+
resolve(): Promise<string | undefined>;
|
|
718
|
+
}
|
|
719
|
+
interface MasterKeyAcquisitionOptions {
|
|
720
|
+
api: ElementsApiPort;
|
|
721
|
+
/** The Application this host acts for. A ref naming any other context is foreign. */
|
|
722
|
+
applicationId: string;
|
|
723
|
+
/**
|
|
724
|
+
* What this host can produce on its own: a passphrase-derived key, or key material it already
|
|
725
|
+
* holds. Absent means the host has no custody of its own and must be given the key.
|
|
726
|
+
*
|
|
727
|
+
* Wider than `MasterKeySource` on purpose — a host may only discover at reveal time that it holds
|
|
728
|
+
* nothing, because the operator has not stored a secret yet. Answering `undefined` then is not a
|
|
729
|
+
* failure: it falls through to asking the device that holds the key, which is the same outcome as
|
|
730
|
+
* declaring no source at all. Every `MasterKeySource` satisfies this.
|
|
731
|
+
*/
|
|
732
|
+
source?: DeclaredMasterKeySource;
|
|
733
|
+
/** Passed through to the relay, for hosts that want a different wait or poll interval. */
|
|
734
|
+
relay?: Omit<RelayMasterKeySourceOptions, 'api'>;
|
|
735
|
+
}
|
|
736
|
+
/**
|
|
737
|
+
* Decides how this host obtains the key that opens a plan, and does it.
|
|
738
|
+
*
|
|
739
|
+
* The decision belongs here rather than in each host. A host declares what custody it holds — a
|
|
740
|
+
* passphrase, raw key material, or nothing — and this composes the rest: a host that can derive
|
|
741
|
+
* never asks anyone, and a host that cannot asks Elements whether a device holds the key and then
|
|
742
|
+
* asks that device. Nothing here prompts a person for a secret; acquisition during a reveal is
|
|
743
|
+
* either automatic or a request to the holder.
|
|
744
|
+
*
|
|
745
|
+
* `EXTERNAL` custody is expected to arrive as `source` — the host loaded it from its own key
|
|
746
|
+
* management. Relay is not refused for it, because relay is a transport rather than a custody, but
|
|
747
|
+
* it is not the path such a host is meant to take.
|
|
748
|
+
*
|
|
749
|
+
* Nothing is cached here: `ElementsClient` checks its `KeyVault` before calling a resolver and
|
|
750
|
+
* stores what comes back, so a second reveal in the same process never asks a phone again.
|
|
751
|
+
*/
|
|
752
|
+
declare function createMasterKeyResolver(options: MasterKeyAcquisitionOptions): MasterKeyResolver;
|
|
753
|
+
|
|
754
|
+
/**
|
|
755
|
+
* Where the host keeps master keys between operations.
|
|
756
|
+
*
|
|
757
|
+
* Keyed by master key reference rather than by Application: a host may hold its own
|
|
758
|
+
* Application key alongside a foreign organization key for each bridged plan, and those
|
|
759
|
+
* are different keys that must not collide.
|
|
760
|
+
*/
|
|
761
|
+
interface KeyVault {
|
|
762
|
+
store(ref: MasterKeyRef, key: Uint8Array): Promise<void>;
|
|
763
|
+
load(ref: MasterKeyRef): Promise<Uint8Array | undefined>;
|
|
764
|
+
remove(ref: MasterKeyRef): Promise<void>;
|
|
765
|
+
}
|
|
766
|
+
declare class MemoryKeyVault implements KeyVault {
|
|
767
|
+
private readonly keys;
|
|
768
|
+
store(ref: MasterKeyRef, key: Uint8Array): Promise<void>;
|
|
769
|
+
load(ref: MasterKeyRef): Promise<Uint8Array | undefined>;
|
|
770
|
+
remove(ref: MasterKeyRef): Promise<void>;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
interface StatePort {
|
|
774
|
+
set<T>(key: string, value: T): Promise<void>;
|
|
775
|
+
get<T>(key: string): Promise<T | undefined>;
|
|
776
|
+
remove(key: string): Promise<void>;
|
|
777
|
+
}
|
|
778
|
+
declare class MemoryStatePort implements StatePort {
|
|
779
|
+
private readonly values;
|
|
780
|
+
set<T>(key: string, value: T): Promise<void>;
|
|
781
|
+
get<T>(key: string): Promise<T | undefined>;
|
|
782
|
+
remove(key: string): Promise<void>;
|
|
783
|
+
}
|
|
784
|
+
|
|
569
785
|
interface PlanMaterialReconstructor {
|
|
570
786
|
/**
|
|
571
787
|
* `masterKeyHex` is required when the material reports `masterKeyWrapped`: the plan
|
|
@@ -629,21 +845,72 @@ type AssetFieldSelector = string | {
|
|
|
629
845
|
};
|
|
630
846
|
interface RevealFieldOptions {
|
|
631
847
|
action?: Exclude<RevealActionType, 'EXPORT_ASSET'>;
|
|
848
|
+
destination?: RevealActionDestination;
|
|
632
849
|
origin?: string;
|
|
633
850
|
idempotencyKey?: string;
|
|
634
851
|
}
|
|
852
|
+
interface RevealFieldConsumption {
|
|
853
|
+
selector: AssetFieldSelector;
|
|
854
|
+
options?: RevealFieldOptions;
|
|
855
|
+
}
|
|
856
|
+
interface ConsumedRevealField {
|
|
857
|
+
/** Canonical metadata only; the value must never be logged or returned by the workflow. */
|
|
858
|
+
selector: string;
|
|
859
|
+
value: unknown;
|
|
860
|
+
}
|
|
861
|
+
type RevealFieldDestination = (fields: readonly ConsumedRevealField[]) => void | Promise<void>;
|
|
862
|
+
/**
|
|
863
|
+
* Where a reveal has got to, in the order a reveal runs.
|
|
864
|
+
*
|
|
865
|
+
* The sequence is this client's own: it clears the governance layers in turn — the dead man's switch,
|
|
866
|
+
* the member proving who they are, then the moderators — releases the material from its storage
|
|
867
|
+
* layers, asks the device for the custodian shard when one is owed, and rebuilds the secret. Only the
|
|
868
|
+
* governance layers have server stages, and the server collapses all of them into one; everything
|
|
869
|
+
* after `AUTHORIZED` happens here and was invisible to callers. So the phase is reported here, where
|
|
870
|
+
* it is known, rather than inferred by each host from a stage that cannot express it.
|
|
871
|
+
*/
|
|
872
|
+
type RevealPhase =
|
|
873
|
+
/**
|
|
874
|
+
* The key that opens the plan is being asked of the device holding it.
|
|
875
|
+
*
|
|
876
|
+
* First, and before the reveal exists: the key is resolved ahead of governance and ahead of any
|
|
877
|
+
* one-shot material release. A host that derives its own key never sees this phase — it passes
|
|
878
|
+
* through in a single call — so its presence means a person has to answer on SafeKey Mobile.
|
|
879
|
+
*/
|
|
880
|
+
'WAITING_FOR_MASTER_KEY' | 'STARTING' | 'WAITING_FOR_DMS' | 'WAITING_FOR_AUTHENTICATION' | 'WAITING_FOR_MODERATION' | 'RELEASING_MATERIAL' | 'WAITING_FOR_CUSTODIAN_CLAIM' | 'WAITING_FOR_CUSTODIAN' | 'RECONSTRUCTING' | 'OPEN' | 'DENIED' | 'EXPIRED' | 'PARTICIPANT_REVOKED' | 'RECONCILIATION_REQUIRED' | 'STOPPED_BY_DMS' | 'ENDED'
|
|
881
|
+
/** A stage this build has not been taught to name. Stages are additive, so it is a wait. */
|
|
882
|
+
| 'CONTINUING';
|
|
883
|
+
interface RevealProgress {
|
|
884
|
+
readonly phase: RevealPhase;
|
|
885
|
+
/**
|
|
886
|
+
* The server's own view, for the deadlines and counts a caller renders beside the phase.
|
|
887
|
+
*
|
|
888
|
+
* Absent before the reveal is started: `WAITING_FOR_MASTER_KEY` is reported while the key is
|
|
889
|
+
* being acquired, which happens before there is a session to describe. Every phase from
|
|
890
|
+
* `STARTING` onwards carries one.
|
|
891
|
+
*/
|
|
892
|
+
readonly session?: RevealSession;
|
|
893
|
+
}
|
|
635
894
|
interface OpenRevealOptions {
|
|
636
895
|
mode?: RevealMode;
|
|
637
896
|
idempotencyKey?: string;
|
|
638
897
|
signal?: AbortSignal;
|
|
639
898
|
pollIntervalMs?: number;
|
|
899
|
+
/** How long to wait for a SafeKey Mobile custodian release before giving up. Default 2 minutes. */
|
|
900
|
+
custodianTimeoutMs?: number;
|
|
901
|
+
/** Every step of the reveal, named. Prefer this to `onSession`, which reports server stages only. */
|
|
902
|
+
onProgress?: (progress: RevealProgress) => void;
|
|
640
903
|
onSession?: (session: RevealSession) => void;
|
|
641
904
|
}
|
|
905
|
+
/** The governance layers the server does report, read from the gate it names. */
|
|
906
|
+
declare function revealPhaseOf(session: RevealSession): RevealPhase;
|
|
642
907
|
interface RevealHandle {
|
|
643
908
|
readonly session: RevealSession;
|
|
644
909
|
readonly material: Uint8Array;
|
|
645
910
|
readonly closed: boolean;
|
|
646
911
|
field<TValue = unknown>(selector: AssetFieldSelector, options?: RevealFieldOptions): Promise<TValue>;
|
|
912
|
+
/** Authorize, decode and deliver fields without returning their plaintext to the caller. */
|
|
913
|
+
consumeFields(fields: readonly RevealFieldConsumption[], destination: RevealFieldDestination): Promise<void>;
|
|
647
914
|
close(reason?: RevealCloseReason): Promise<void>;
|
|
648
915
|
[Symbol.asyncDispose](): Promise<void>;
|
|
649
916
|
}
|
|
@@ -666,7 +933,13 @@ interface DecodedPlanAsset {
|
|
|
666
933
|
}
|
|
667
934
|
type PlanAssetContainerDecoder = (material: Uint8Array) => readonly DecodedPlanAsset[];
|
|
668
935
|
interface ElementsClientOptions {
|
|
669
|
-
|
|
936
|
+
/**
|
|
937
|
+
* Only plan *creation* needs the Core container. `createPlan` and `configurePlan` reach it
|
|
938
|
+
* through `useCase()`; nothing on the reveal path — `prepareReveal`, `collectPlanMaterial`,
|
|
939
|
+
* `reconstructPlanMaterial`, `openScopedReveal` — touches it. A reveal-only host therefore
|
|
940
|
+
* composes a client without one rather than porting Core's container to its platform.
|
|
941
|
+
*/
|
|
942
|
+
coreSdk?: SDKContainer;
|
|
670
943
|
keyVault?: KeyVault;
|
|
671
944
|
state?: StatePort;
|
|
672
945
|
api?: ElementsApiPort;
|
|
@@ -674,22 +947,38 @@ interface ElementsClientOptions {
|
|
|
674
947
|
/**
|
|
675
948
|
* Resolves master keys per plan. A host may need several: its own Application key
|
|
676
949
|
* and a foreign organization key for each bridged plan it opens.
|
|
950
|
+
*
|
|
951
|
+
* A host that has no reason to compose its own leaves this out and declares `masterKey`
|
|
952
|
+
* instead, which is the shape every integration host should use.
|
|
677
953
|
*/
|
|
678
|
-
masterKeys
|
|
954
|
+
masterKeys?: MasterKeyResolver;
|
|
955
|
+
/**
|
|
956
|
+
* What custody this host holds locally, for the client to compose acquisition around.
|
|
957
|
+
*
|
|
958
|
+
* `source` present means this host can produce the key alone; absent means it must be given the
|
|
959
|
+
* key by the device holding it. Either way the host declares custody and consumes the result —
|
|
960
|
+
* it never decides between deriving and relaying, and never speaks the relay protocol itself.
|
|
961
|
+
* Ignored when `masterKeys` is given, so an explicitly composed resolver always wins.
|
|
962
|
+
*/
|
|
963
|
+
masterKey?: {
|
|
964
|
+
source?: MasterKeyAcquisitionOptions['source'];
|
|
965
|
+
relay?: MasterKeyAcquisitionOptions['relay'];
|
|
966
|
+
};
|
|
679
967
|
/** The Application this client acts for; needed to wrap keys of plans it creates. */
|
|
680
968
|
applicationId: string;
|
|
681
969
|
assetDecoder: PlanAssetContainerDecoder;
|
|
682
970
|
}
|
|
683
971
|
declare class ElementsClient {
|
|
684
|
-
readonly coreSdk: SDKContainer;
|
|
972
|
+
readonly coreSdk: SDKContainer | undefined;
|
|
685
973
|
readonly keyVault: KeyVault;
|
|
686
974
|
readonly state: StatePort;
|
|
687
|
-
constructor(coreSdk: SDKContainer, options?: {
|
|
975
|
+
constructor(coreSdk: SDKContainer | undefined, options?: {
|
|
688
976
|
keyVault?: KeyVault;
|
|
689
977
|
state?: StatePort;
|
|
690
978
|
api?: ElementsApiPort;
|
|
691
979
|
reconstructor?: PlanMaterialReconstructor;
|
|
692
980
|
masterKeys?: MasterKeyResolver;
|
|
981
|
+
masterKey?: ElementsClientOptions['masterKey'];
|
|
693
982
|
applicationId?: string;
|
|
694
983
|
assetDecoder?: PlanAssetContainerDecoder;
|
|
695
984
|
});
|
|
@@ -750,6 +1039,15 @@ declare class ElementsClient {
|
|
|
750
1039
|
revealPlan(planId: string, stepUp?: StepUpReadContext): Promise<Uint8Array>;
|
|
751
1040
|
collectPlanMaterial(planId: string, stepUp?: StepUpReadContext): Promise<CollectedPlanMaterial>;
|
|
752
1041
|
reconstructPlanMaterial(material: CollectedPlanMaterial): Promise<Uint8Array>;
|
|
1042
|
+
/**
|
|
1043
|
+
* Drops a held master key, so the next reveal acquires it again.
|
|
1044
|
+
*
|
|
1045
|
+
* The vault keeps a resolved key for the life of this client — a whole editor window or browser
|
|
1046
|
+
* service worker — which is what stops a second reveal asking the phone again. This is how a host
|
|
1047
|
+
* gives that up: a "lock" action, and the only way to see the acquisition happen twice.
|
|
1048
|
+
* Omitting `ref` forgets the key for this client's own Application.
|
|
1049
|
+
*/
|
|
1050
|
+
forgetMasterKey(ref?: MasterKeyRef): Promise<void>;
|
|
753
1051
|
/**
|
|
754
1052
|
* Resolves the key that opens this plan, caching it in the vault.
|
|
755
1053
|
*
|
|
@@ -773,8 +1071,22 @@ declare class ElementsClient {
|
|
|
773
1071
|
openReveal(planId: string, options?: OpenRevealOptions): Promise<RevealHandle>;
|
|
774
1072
|
withReveal<TResult>(planId: string, options: OpenRevealOptions, work: (reveal: RevealHandle) => Promise<TResult>): Promise<TResult>;
|
|
775
1073
|
releaseRevealMaterial(revealId: string, materialVersion: string): Promise<unknown>;
|
|
1074
|
+
/**
|
|
1075
|
+
* States that this client holds the storage-layer shares.
|
|
1076
|
+
*
|
|
1077
|
+
* Only the client can say so, so it is a call rather than something the release infers. It also
|
|
1078
|
+
* settles the custodian: a first access advances straight past it, because the custodian shard
|
|
1079
|
+
* travelled with the material, and every access after this one goes through SafeKey Mobile.
|
|
1080
|
+
*/
|
|
1081
|
+
markRevealSharesCollected(revealId: string): Promise<void>;
|
|
1082
|
+
requestRevealCustodianRelease(revealId: string): Promise<void>;
|
|
1083
|
+
getRevealCustodianAccess(revealId: string): Promise<CustodianShareAccess>;
|
|
1084
|
+
getRevealCustodianShare(revealId: string): Promise<CustodianShareResult>;
|
|
776
1085
|
reportRevealReconstruction(revealId: string, input: RevealReconstructionInput): Promise<RevealSession>;
|
|
777
1086
|
closeReveal(revealId: string, reason: RevealCloseReason): Promise<RevealSession>;
|
|
1087
|
+
abortPlanAccess(planId: string): Promise<{
|
|
1088
|
+
aborted: boolean;
|
|
1089
|
+
}>;
|
|
778
1090
|
authorizeRevealAction(revealId: string, input: AuthorizeRevealActionInput): Promise<RevealAction>;
|
|
779
1091
|
reportRevealActionOutcome(revealId: string, actionId: string, input: ReportRevealActionOutcomeInput): Promise<RevealAction>;
|
|
780
1092
|
getCustodianShare(processId: string, stepUp?: StepUpReadContext): Promise<CustodianShareResult>;
|
|
@@ -808,6 +1120,18 @@ declare class HttpElementsApiPort implements ElementsApiPort {
|
|
|
808
1120
|
getPlanCreation(operationId: string): Promise<PlanCreationProgress>;
|
|
809
1121
|
supplyPlanCreationMaterial(operationId: string, material: EncryptedPlanMaterial): Promise<PlanCreationProgress>;
|
|
810
1122
|
cancelPlanCreation(operationId: string): Promise<PlanCreationProgress>;
|
|
1123
|
+
/**
|
|
1124
|
+
* Master key acquisition, on the operator lane.
|
|
1125
|
+
*
|
|
1126
|
+
* Elements answers these questions on two lanes with the same use cases behind them: `/master-key`
|
|
1127
|
+
* for a caller holding an Application credential, `v1/master-key` for one signed in as an
|
|
1128
|
+
* operator. This client authenticates as an operator everywhere else it reads a plan, so it asks
|
|
1129
|
+
* on that lane too — a credential bearer is refused here and an operator token is refused there.
|
|
1130
|
+
*/
|
|
1131
|
+
masterKeyAcquisition(): Promise<MasterKeyAcquisition>;
|
|
1132
|
+
foreignMasterKeyAcquisition(system: string, contextId: string): Promise<MasterKeyAcquisition>;
|
|
1133
|
+
startMasterKeyRelaySession(clientPublicKey: string): Promise<MasterKeyRelaySessionOpened>;
|
|
1134
|
+
readMasterKeyRelaySession(sessionId: string): Promise<MasterKeyRelaySessionState>;
|
|
811
1135
|
planKeyReference(planId: string): Promise<PlanKeyReference>;
|
|
812
1136
|
collectPlanMaterial(planId: string, stepUp?: StepUpReadContext): Promise<CollectedPlanMaterial>;
|
|
813
1137
|
initializeGovernedReveal(planId: string, stepUp?: StepUpReadContext): Promise<GovernedRevealSession>;
|
|
@@ -821,8 +1145,15 @@ declare class HttpElementsApiPort implements ElementsApiPort {
|
|
|
821
1145
|
startReveal(planId: string, input: StartRevealInput): Promise<RevealSession>;
|
|
822
1146
|
getReveal(revealId: string): Promise<RevealSession>;
|
|
823
1147
|
releaseRevealMaterial(revealId: string, materialVersion: string): Promise<unknown>;
|
|
1148
|
+
markRevealSharesCollected(revealId: string): Promise<void>;
|
|
1149
|
+
requestRevealCustodianRelease(revealId: string): Promise<void>;
|
|
1150
|
+
getRevealCustodianAccess(revealId: string): Promise<CustodianShareAccess>;
|
|
1151
|
+
getRevealCustodianShare(revealId: string): Promise<CustodianShareResult>;
|
|
824
1152
|
reportRevealReconstruction(revealId: string, input: RevealReconstructionInput): Promise<RevealSession>;
|
|
825
1153
|
closeReveal(revealId: string, reason: RevealCloseReason): Promise<RevealSession>;
|
|
1154
|
+
abortPlanAccess(planId: string): Promise<{
|
|
1155
|
+
aborted: boolean;
|
|
1156
|
+
}>;
|
|
826
1157
|
authorizeRevealAction(revealId: string, input: AuthorizeRevealActionInput): Promise<RevealAction>;
|
|
827
1158
|
reportRevealActionOutcome(revealId: string, actionId: string, input: ReportRevealActionOutcomeInput): Promise<RevealAction>;
|
|
828
1159
|
getCustodianShare(processId: string, stepUp?: StepUpReadContext): Promise<CustodianShareResult>;
|
|
@@ -843,44 +1174,6 @@ declare class HttpElementsApiPort implements ElementsApiPort {
|
|
|
843
1174
|
*/
|
|
844
1175
|
declare function unwrapDekWithMasterKey(wrappedDekBase64: string, masterKeyHex?: string): Promise<string>;
|
|
845
1176
|
|
|
846
|
-
interface MasterKeyRelayPort {
|
|
847
|
-
startRelaySession(clientPublicKey: string): Promise<{
|
|
848
|
-
sessionId: string;
|
|
849
|
-
expiresAt: string | Date;
|
|
850
|
-
}>;
|
|
851
|
-
readRelaySession(sessionId: string): Promise<{
|
|
852
|
-
status: 'PENDING' | 'DELIVERED' | 'EXPIRED';
|
|
853
|
-
sealedMasterKey?: string;
|
|
854
|
-
}>;
|
|
855
|
-
}
|
|
856
|
-
declare class MasterKeyRelayTimedOut extends Error {
|
|
857
|
-
readonly sessionId: string;
|
|
858
|
-
constructor(sessionId: string);
|
|
859
|
-
}
|
|
860
|
-
declare class MasterKeyRelayExpired extends Error {
|
|
861
|
-
readonly sessionId: string;
|
|
862
|
-
constructor(sessionId: string);
|
|
863
|
-
}
|
|
864
|
-
interface RelayMasterKeySourceOptions {
|
|
865
|
-
api: MasterKeyRelayPort;
|
|
866
|
-
/** How long to wait for the device before giving up. Defaults to the session lifetime. */
|
|
867
|
-
timeoutMs?: number;
|
|
868
|
-
pollIntervalMs?: number;
|
|
869
|
-
sleep?: (ms: number) => Promise<void>;
|
|
870
|
-
}
|
|
871
|
-
/**
|
|
872
|
-
* Obtains the master key from the device holding it.
|
|
873
|
-
*
|
|
874
|
-
* Elements has no websocket layer, so the host polls. The key is sealed to an ephemeral
|
|
875
|
-
* public key generated here and never leaves this process in the clear: the private half
|
|
876
|
-
* is not persisted, so a relayed key cannot be replayed from stored state.
|
|
877
|
-
*/
|
|
878
|
-
declare class RelayMasterKeySource implements MasterKeySource {
|
|
879
|
-
private readonly options;
|
|
880
|
-
constructor(options: RelayMasterKeySourceOptions);
|
|
881
|
-
resolve(): Promise<string>;
|
|
882
|
-
}
|
|
883
|
-
|
|
884
1177
|
/** Elements adapter for Core's transport-neutral event port. Scheduling remains owned by Core's mature loop. */
|
|
885
1178
|
declare class PollingSharedPlanEventListener implements SharedPlanEventListener {
|
|
886
1179
|
private readonly api;
|
|
@@ -914,6 +1207,7 @@ interface CorePlanSecrets {
|
|
|
914
1207
|
/** Number of non-custodian share destinations. */
|
|
915
1208
|
totalShares: number;
|
|
916
1209
|
threshold: number;
|
|
1210
|
+
/** @deprecated Custodian posture is derived from the plan declaration and this value is ignored. */
|
|
917
1211
|
withCustodian?: boolean;
|
|
918
1212
|
}
|
|
919
1213
|
interface PreparedCorePlanMaterial {
|
|
@@ -1155,5 +1449,5 @@ declare class OperatorSessionController {
|
|
|
1155
1449
|
logout(): Promise<void>;
|
|
1156
1450
|
}
|
|
1157
1451
|
|
|
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 };
|
|
1452
|
+
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, createMasterKeyResolver, getAvailableEnvs, masterKeyRefFor, masterKeyRefKey, oauthErrorCode, parseAssetFieldSelector, revealPhaseOf, unwrapDekWithMasterKey, useClient, validatePlanCreationInput, validatePlanCreationMaterial };
|
|
1453
|
+
export type { AssetFieldSelector, AuthorizationTransaction, AuthorizeRevealActionInput, CanonicalPlanAssetType, CollectedPlanMaterial, CompatibleValue, ConsumedRevealField, CorePlanSecrets, CustodianShareResult, DeclaredMasterKeySource, DecodedPlanAsset, DeviceAuthorization, DeviceTransaction, ElementsApiPort, ElementsClientOptions, ElementsEnvironment, EncryptedPlanMaterial, EncryptedPlanShard, ExportPlanBridgeInput, GovernedRevealSession, GovernedRevealState, GovernedShare, GovernedSharesMaterial, GovernedValidatorMaterial, GuidedCreateCheckpoint, GuidedCreateCheckpointStore, GuidedCreateLocalStage, GuidedCreateOptions, InheritiClientProviderProps, IntegrationPlanAssetDeclaration, KeyVault, ListPlansInput, MasterKeyAcquisition, MasterKeyAcquisitionOptions, MasterKeyRef, MasterKeyRelayPort, MasterKeyRelaySessionOpened, MasterKeyRelaySessionState, 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, PlanGovernancePolicy, PlanMaterialBuilder, PlanMaterialReconstructor, PlanPage, PlanParticipantRelationship, PlanRevealProfile, PlanStatus, PlanSummary, RelayMasterKeySourceOptions, ReportRevealActionOutcomeInput, RevealAction, RevealActionDestination, RevealActionOutcome, RevealActionType, RevealCloseReason, RevealFieldConsumption, RevealFieldDestination, RevealFieldOptions, RevealHandle, RevealMode, RevealPhase, RevealProgress, RevealReconstructionInput, RevealSession, RevealStage, StartPlanCreationInput, StartRevealInput, StatePort, StepUpReadContext, ValidatedOperatorToken };
|