@safetech/inheriti-client-sdk 1.17.11 → 1.17.13

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.
Files changed (28) hide show
  1. package/dist/browser.d.ts +1 -1
  2. package/dist/browser.js +1 -1
  3. package/dist/index.js +1 -1
  4. package/dist/inheriti-client-sdk.umd.js +30 -30
  5. package/dist/node.d.ts +25 -1
  6. package/dist/node.js +1 -1
  7. package/dist/sdk-types.d.ts +52 -8
  8. package/dist/src/business/plan-edit/core-edit-transport.d.ts +10 -0
  9. package/dist/src/business/plan-edit/http-plan-edit-port.d.ts +106 -0
  10. package/dist/src/business/plan-edit/plan-edit-asset-access.d.ts +28 -0
  11. package/dist/src/business/plan-edit/plan-edit-reconfiguration.d.ts +26 -0
  12. package/dist/src/business/plan-edit/quick-plan-editor.d.ts +82 -0
  13. package/dist/src/business/quick-plan/build-material.d.ts +6 -0
  14. package/dist/src/business/quick-plan/contract.d.ts +57 -0
  15. package/dist/src/business/quick-plan/http-quick-plan-port.d.ts +40 -0
  16. package/dist/src/business/quick-plan/messages.d.ts +9 -0
  17. package/dist/src/business/quick-plan/prepare-asset.d.ts +10 -0
  18. package/dist/src/business/quick-plan/quick-plan-creator.d.ts +17 -0
  19. package/dist/src/business/quick-plan/request-fingerprint.d.ts +2 -0
  20. package/dist/src/elements/elements-api-port.d.ts +5 -1
  21. package/dist/src/elements/elements-client.d.ts +19 -3
  22. package/dist/src/elements/http-elements-api-port.d.ts +5 -1
  23. package/dist/src/elements/index.d.ts +1 -1
  24. package/dist/src/elements/master-key.d.ts +4 -1
  25. package/dist/src/elements/plan-operations.d.ts +3 -0
  26. package/dist/src/elements/relay-master-key-source.d.ts +9 -1
  27. package/dist/src/elements/scoped-reveal.d.ts +6 -0
  28. package/package.json +2 -2
@@ -262,6 +262,9 @@ interface EncryptedPlanMaterial {
262
262
  notes?: string;
263
263
  code?: string;
264
264
  matchOrigins?: readonly string[];
265
+ isMedia?: boolean;
266
+ mimeType?: string;
267
+ fileName?: string;
265
268
  };
266
269
  fieldNames?: readonly string[];
267
270
  isBinary?: boolean;
@@ -366,6 +369,7 @@ interface ElementsApiPort {
366
369
  */
367
370
  startMasterKeyRelaySession(clientPublicKey: string, context?: MasterKeyRelayContext): Promise<MasterKeyRelaySessionOpened>;
368
371
  readMasterKeyRelaySession(sessionId: string): Promise<MasterKeyRelaySessionState>;
372
+ cancelMasterKeyRelaySession(sessionId: string): Promise<void>;
369
373
  listPlans(input?: ListPlansInput): Promise<PlanPage>;
370
374
  getPlan(planId: string): Promise<PlanDetail>;
371
375
  listPlanLogs(planId: string, input?: ListPlanLogsInput): Promise<PlanLogPage>;
@@ -384,6 +388,9 @@ interface ElementsApiPort {
384
388
  markGovernedDataRevealed(processId: string): Promise<void>;
385
389
  closeGovernedReveal(processId: string): Promise<void>;
386
390
  startReveal(planId: string, input: StartRevealInput): Promise<RevealSession>;
391
+ getActivePlanReveal(planId: string): Promise<(RevealSession & {
392
+ recovery: 'RESUMABLE' | 'RESTART_REQUIRED';
393
+ }) | null>;
387
394
  getReveal(revealId: string): Promise<RevealSession>;
388
395
  releaseRevealMaterial(revealId: string, materialVersion: string): Promise<unknown>;
389
396
  /** The host declaring it holds the storage-layer shares. Governed reveals only. */
@@ -408,7 +415,7 @@ interface ElementsApiPort {
408
415
  * leaves an access still open; the next reveal resumes it. This is how a host says the access is
409
416
  * not wanted after all. `aborted: false` means there was nothing to give up.
410
417
  */
411
- abortPlanAccess(planId: string): Promise<{
418
+ abortPlanAccess(planId: string, expectedRevealId?: string): Promise<{
412
419
  aborted: boolean;
413
420
  }>;
414
421
  authorizeRevealAction(revealId: string, input: AuthorizeRevealActionInput): Promise<RevealAction>;
@@ -669,7 +676,10 @@ declare function masterKeyRefKey(ref: MasterKeyRef): string;
669
676
  * KMS, and relay a third.
670
677
  */
671
678
  interface MasterKeyResolver {
672
- resolve(ref: MasterKeyRef): Promise<string | undefined>;
679
+ resolve(ref: MasterKeyRef, signal?: AbortSignal, onRelaySession?: (session: {
680
+ sessionId: string;
681
+ expiresAt: string | Date;
682
+ }) => void | Promise<void>): Promise<string | undefined>;
673
683
  }
674
684
  /**
675
685
  * Derives which key opens a plan.
@@ -714,6 +724,7 @@ interface MasterKeyRelayPort {
714
724
  status: 'PENDING' | 'DELIVERED' | 'EXPIRED';
715
725
  sealedMasterKey?: string;
716
726
  }>;
727
+ cancelRelaySession?(sessionId: string): Promise<void>;
717
728
  }
718
729
  declare class MasterKeyRelayTimedOut extends Error {
719
730
  readonly sessionId: string;
@@ -723,6 +734,10 @@ declare class MasterKeyRelayExpired extends Error {
723
734
  readonly sessionId: string;
724
735
  constructor(sessionId: string);
725
736
  }
737
+ declare class MasterKeyRelayCancellationFailed extends Error {
738
+ readonly code = "master_key_relay_cancellation_failed";
739
+ constructor(cause: unknown);
740
+ }
726
741
  interface RelayMasterKeySourceOptions {
727
742
  api: MasterKeyRelayPort;
728
743
  /** How long to wait for the device before giving up. Defaults to the session lifetime. */
@@ -740,7 +755,10 @@ interface RelayMasterKeySourceOptions {
740
755
  declare class RelayMasterKeySource implements MasterKeySource {
741
756
  private readonly options;
742
757
  constructor(options: RelayMasterKeySourceOptions);
743
- resolve(): Promise<string>;
758
+ resolve(signal?: AbortSignal, onRelaySession?: (session: {
759
+ sessionId: string;
760
+ expiresAt: string | Date;
761
+ }) => void | Promise<void>): Promise<string>;
744
762
  }
745
763
 
746
764
  /**
@@ -957,9 +975,15 @@ interface OpenRevealOptions {
957
975
  }, signal?: AbortSignal): Promise<ProCustodianShare & {
958
976
  deviceId: string;
959
977
  }>;
978
+ clearPin?(): void;
960
979
  };
961
980
  /** Every step of the reveal, named. Prefer this to `onSession`, which reports server stages only. */
962
981
  onProgress?: (progress: RevealProgress) => void;
982
+ /** Relay session metadata for cancellation after a host restarts; contains no key material. */
983
+ onRelaySession?: (session: {
984
+ sessionId: string;
985
+ expiresAt: string | Date;
986
+ }) => void | Promise<void>;
963
987
  onSession?: (session: RevealSession) => void;
964
988
  }
965
989
  /** The governance layers the server does report, read from the gate it names. */
@@ -1086,6 +1110,12 @@ declare class ElementsClient {
1086
1110
  configurePlan<TInput extends object, TResult>(input: TInput): Promise<TResult>;
1087
1111
  /** Resolves the Application's required master key without exposing it as an operation argument. */
1088
1112
  applicationMasterKey(): Promise<string>;
1113
+ /** Resolves the selected Business organization's key without requiring a plan. */
1114
+ organizationMasterKey(signal?: AbortSignal, onRelaySession?: (session: {
1115
+ sessionId: string;
1116
+ expiresAt: string | Date;
1117
+ }) => void | Promise<void>): Promise<string>;
1118
+ private resolveKey;
1089
1119
  /**
1090
1120
  * Resolves the key that opens a plan before anything is collected.
1091
1121
  *
@@ -1094,7 +1124,10 @@ declare class ElementsClient {
1094
1124
  * nothing. Resolving first also keeps a single SafeKey interaction — the relay — ahead
1095
1125
  * of the custodian's, instead of interleaving two device round trips.
1096
1126
  */
1097
- prepareReveal(planId: string): Promise<{
1127
+ prepareReveal(planId: string, signal?: AbortSignal, onRelaySession?: (session: {
1128
+ sessionId: string;
1129
+ expiresAt: string | Date;
1130
+ }) => void | Promise<void>): Promise<{
1098
1131
  masterKeyWrapped: boolean;
1099
1132
  masterKeyHex?: string;
1100
1133
  }>;
@@ -1129,10 +1162,16 @@ declare class ElementsClient {
1129
1162
  system: string;
1130
1163
  contextId: string;
1131
1164
  };
1132
- }): Promise<string | undefined>;
1165
+ }, signal?: AbortSignal, onRelaySession?: (session: {
1166
+ sessionId: string;
1167
+ expiresAt: string | Date;
1168
+ }) => void | Promise<void>): Promise<string | undefined>;
1133
1169
  initializeGovernedReveal(planId: string, stepUp?: StepUpReadContext): Promise<GovernedRevealSession>;
1134
1170
  getGovernedReveal(processId: string, stepUp?: StepUpReadContext): Promise<GovernedRevealState>;
1135
1171
  startReveal(planId: string, input: StartRevealInput): Promise<RevealSession>;
1172
+ getActivePlanReveal(planId: string): Promise<(RevealSession & {
1173
+ recovery: 'RESUMABLE' | 'RESTART_REQUIRED';
1174
+ }) | null>;
1136
1175
  getReveal(revealId: string): Promise<RevealSession>;
1137
1176
  openReveal(planId: string, options?: OpenRevealOptions): Promise<RevealHandle>;
1138
1177
  withReveal<TResult>(planId: string, options: OpenRevealOptions, work: (reveal: RevealHandle) => Promise<TResult>): Promise<TResult>;
@@ -1154,9 +1193,10 @@ declare class ElementsClient {
1154
1193
  collectRevealCustodianShare(revealId: string, shareId: string): Promise<void>;
1155
1194
  reportRevealReconstruction(revealId: string, input: RevealReconstructionInput): Promise<RevealSession>;
1156
1195
  closeReveal(revealId: string, reason: RevealCloseReason): Promise<RevealSession>;
1157
- abortPlanAccess(planId: string): Promise<{
1196
+ abortPlanAccess(planId: string, expectedRevealId?: string): Promise<{
1158
1197
  aborted: boolean;
1159
1198
  }>;
1199
+ cancelMasterKeyRelaySession(sessionId: string): Promise<void>;
1160
1200
  authorizeRevealAction(revealId: string, input: AuthorizeRevealActionInput): Promise<RevealAction>;
1161
1201
  reportRevealActionOutcome(revealId: string, actionId: string, input: ReportRevealActionOutcomeInput): Promise<RevealAction>;
1162
1202
  getCustodianShare(processId: string, stepUp?: StepUpReadContext): Promise<CustodianShareResult>;
@@ -1235,6 +1275,7 @@ declare class HttpElementsApiPort implements ElementsApiPort {
1235
1275
  foreignMasterKeyAcquisition(system: string, contextId: string): Promise<MasterKeyAcquisition>;
1236
1276
  startMasterKeyRelaySession(clientPublicKey: string, context?: MasterKeyRelayContext): Promise<MasterKeyRelaySessionOpened>;
1237
1277
  readMasterKeyRelaySession(sessionId: string): Promise<MasterKeyRelaySessionState>;
1278
+ cancelMasterKeyRelaySession(sessionId: string): Promise<void>;
1238
1279
  planKeyReference(planId: string): Promise<PlanKeyReference>;
1239
1280
  collectPlanMaterial(planId: string, stepUp?: StepUpReadContext): Promise<CollectedPlanMaterial>;
1240
1281
  initializeGovernedReveal(planId: string, stepUp?: StepUpReadContext): Promise<GovernedRevealSession>;
@@ -1246,6 +1287,9 @@ declare class HttpElementsApiPort implements ElementsApiPort {
1246
1287
  markGovernedDataRevealed(processId: string): Promise<void>;
1247
1288
  closeGovernedReveal(processId: string): Promise<void>;
1248
1289
  startReveal(planId: string, input: StartRevealInput): Promise<RevealSession>;
1290
+ getActivePlanReveal(planId: string): Promise<(RevealSession & {
1291
+ recovery: 'RESUMABLE' | 'RESTART_REQUIRED';
1292
+ }) | null>;
1249
1293
  getReveal(revealId: string): Promise<RevealSession>;
1250
1294
  releaseRevealMaterial(revealId: string, materialVersion: string): Promise<unknown>;
1251
1295
  markRevealSharesCollected(revealId: string): Promise<void>;
@@ -1258,7 +1302,7 @@ declare class HttpElementsApiPort implements ElementsApiPort {
1258
1302
  collectRevealCustodianShare(revealId: string, shareId: string): Promise<void>;
1259
1303
  reportRevealReconstruction(revealId: string, input: RevealReconstructionInput): Promise<RevealSession>;
1260
1304
  closeReveal(revealId: string, reason: RevealCloseReason): Promise<RevealSession>;
1261
- abortPlanAccess(planId: string): Promise<{
1305
+ abortPlanAccess(planId: string, expectedRevealId?: string): Promise<{
1262
1306
  aborted: boolean;
1263
1307
  }>;
1264
1308
  authorizeRevealAction(revealId: string, input: AuthorizeRevealActionInput): Promise<RevealAction>;
@@ -1561,5 +1605,5 @@ declare class OperatorSessionController {
1561
1605
  logout(): Promise<void>;
1562
1606
  }
1563
1607
 
1564
- export { BusinessOrganizationSelectionError, 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, PlanMaterialReconstructionFailed, PlanMaterialReconstructorRequired, PollingSharedPlanEventListener, RelayMasterKeySource, RevealActionsNotOpen, RevealFieldAccessError, RevealHandleClosed, StaticMasterKeyResolver, SystemOAuthClock, WebOAuthCrypto, createElementsClient, createMasterKeyResolver, getAvailableEnvs, masterKeyRefFor, masterKeyRefKey, oauthErrorCode, parseAssetFieldSelector, revealPhaseOf, selectBusinessOrganization, unwrapDekWithMasterKey, useClient, validatePlanCreationInput, validatePlanCreationMaterial };
1608
+ export { BusinessOrganizationSelectionError, CANONICAL_PLAN_ASSET_TYPES, CANONICAL_STRUCTURED_ASSET_FIELDS, CorePlanMaterialBuilder, ElementsApiPortRequired, ElementsApiRequestFailed, ElementsClient, GuidedCreateRecoveryError, GuidedPlanCreator, HostProcessRuntimeEnvironment, HttpElementsApiPort, HttpOperatorAuthTransport, InheritiClientProvider, InvalidPlanDeclaration, InvalidPlanMaterial, LocalProcessReconciliationOwnership, MasterKeyRelayCancellationFailed, MasterKeyRelayExpired, MasterKeyRelayTimedOut, MasterKeyRequired, MemoryGuidedCreateCheckpointStore, MemoryKeyVault, MemoryStatePort, OAuthProtocolError, OperatorAuthClient, OperatorAuthError, OperatorReauthenticationRequired, OperatorSessionController, PLAN_CREATION_SERVER_STAGES, PlanMaterialReconstructionFailed, PlanMaterialReconstructorRequired, PollingSharedPlanEventListener, RelayMasterKeySource, RevealActionsNotOpen, RevealFieldAccessError, RevealHandleClosed, StaticMasterKeyResolver, SystemOAuthClock, WebOAuthCrypto, createElementsClient, createMasterKeyResolver, getAvailableEnvs, masterKeyRefFor, masterKeyRefKey, oauthErrorCode, parseAssetFieldSelector, revealPhaseOf, selectBusinessOrganization, unwrapDekWithMasterKey, useClient, validatePlanCreationInput, validatePlanCreationMaterial };
1565
1609
  export type { AssetFieldSelector, AuthorizationTransaction, AuthorizeRevealActionInput, BusinessOrganization, 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, ListPlanLogsInput, ListPlansInput, MasterKeyAcquisition, MasterKeyAcquisitionOptions, MasterKeyRef, MasterKeyRelayContext, 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, PlanLog, PlanLogPage, PlanMaterialBuilder, PlanMaterialReconstructor, PlanPage, PlanParticipantRelationship, PlanRevealProfile, PlanStatus, PlanSummary, ProCustodianShare, RelayMasterKeySourceOptions, ReportRevealActionOutcomeInput, RevealAction, RevealActionDestination, RevealActionOutcome, RevealActionType, RevealCloseReason, RevealFieldConsumption, RevealFieldDestination, RevealFieldOptions, RevealHandle, RevealMode, RevealPhase, RevealProgress, RevealReconstructionInput, RevealSession, RevealStage, StartPlanCreationInput, StartRevealInput, StatePort, StepUpReadContext, ValidatedOperatorToken };
@@ -0,0 +1,10 @@
1
+ import type { HttpTransport } from '@safetech/inheriti-core-sdk/node';
2
+ export interface CoreEditTransportOptions {
3
+ apiUrl: string;
4
+ organizationId: string;
5
+ planId: string;
6
+ editId: string;
7
+ environment: 'TEST' | 'LIVE';
8
+ transport: HttpTransport;
9
+ }
10
+ export declare function coreEditTransport({ apiUrl, organizationId, planId, editId, environment, transport }: CoreEditTransportOptions): HttpTransport;
@@ -0,0 +1,106 @@
1
+ export interface EditSession {
2
+ id: string;
3
+ planId: string;
4
+ stage: string;
5
+ mode: 'DIRECT' | 'GOVERNED';
6
+ expiresAt: string;
7
+ materialVersion?: string;
8
+ }
9
+ export interface PlanEditCandidate {
10
+ id: string;
11
+ name: string;
12
+ status: 'PROTECTED';
13
+ createdAt: string;
14
+ assetSummary: {
15
+ count: number;
16
+ types: string[];
17
+ names: string[];
18
+ };
19
+ governance: {
20
+ mode: 'DIRECT' | 'GOVERNED';
21
+ minimumApprovals: number;
22
+ };
23
+ }
24
+ export interface PlanEditCandidatePage {
25
+ items: PlanEditCandidate[];
26
+ nextCursor: string | null;
27
+ }
28
+ export interface PlanEditContext {
29
+ idempotencyKey: string;
30
+ mode: 'DIRECT' | 'GOVERNED';
31
+ totalShares: number;
32
+ masterKeyEncrypted: boolean;
33
+ masterKeyAcquisition: {
34
+ system: string;
35
+ contextId: string;
36
+ };
37
+ }
38
+ export interface ReconfigureMaterial {
39
+ mergeProcessId: string;
40
+ protectionProtocol?: 'SSDP_PLUS_V1' | 'SSDP_PLUS_V2';
41
+ validatorShares: readonly {
42
+ id: string;
43
+ data?: string;
44
+ replacedShareId?: string;
45
+ }[];
46
+ dataShards: readonly {
47
+ id: string;
48
+ data?: string;
49
+ replacedShareId?: string;
50
+ }[];
51
+ backupShards: readonly {
52
+ id: string;
53
+ data?: string;
54
+ replacedShareId?: string;
55
+ }[];
56
+ encryptedKey?: string;
57
+ assetsMetadata?: unknown;
58
+ custodianPair?: {
59
+ keyShard: {
60
+ id: string;
61
+ data: string;
62
+ };
63
+ dataShard: {
64
+ id: string;
65
+ data: string;
66
+ };
67
+ };
68
+ }
69
+ export declare class HttpPlanEditPort {
70
+ private readonly apiUrl;
71
+ private readonly environment;
72
+ private readonly getBearerToken;
73
+ private readonly transport;
74
+ constructor(apiUrl: string, environment: 'TEST' | 'LIVE', getBearerToken: () => Promise<string | null>, transport?: typeof fetch);
75
+ start(organizationId: string, planId: string, mode: 'DIRECT' | 'GOVERNED', idempotencyKey: string): Promise<EditSession>;
76
+ listEligibleCandidates(organizationId: string, cursor?: string, namePrefix?: string): Promise<PlanEditCandidatePage>;
77
+ context(organizationId: string, planId: string): Promise<PlanEditContext>;
78
+ startRelaySession(organizationId: string, context: PlanEditContext['masterKeyAcquisition'], clientPublicKey: string): Promise<{
79
+ sessionId: string;
80
+ expiresAt: string | Date;
81
+ }>;
82
+ readRelaySession(organizationId: string, sessionId: string): Promise<{
83
+ status: 'PENDING' | 'DELIVERED' | 'EXPIRED';
84
+ sealedMasterKey?: string;
85
+ }>;
86
+ status(organizationId: string, editId: string): Promise<EditSession>;
87
+ preflight(organizationId: string, planId: string, material: ReconfigureMaterial): Promise<void>;
88
+ commit(organizationId: string, planId: string, material: ReconfigureMaterial): Promise<{
89
+ totalShares: number;
90
+ }>;
91
+ abort(organizationId: string, editId: string): Promise<void>;
92
+ commitStatus(organizationId: string, editId: string): Promise<{
93
+ planId: string;
94
+ status: string;
95
+ editStatus: string;
96
+ shares: Array<{
97
+ id: string;
98
+ storageLayerId: string;
99
+ }>;
100
+ assetsMetadataHash: string;
101
+ }>;
102
+ private request;
103
+ private isCandidatePage;
104
+ private isEditContext;
105
+ private reconfigureBody;
106
+ }
@@ -0,0 +1,28 @@
1
+ import type { SDKContainer, DataAsset } from '@safetech/inheriti-core-sdk/node';
2
+ import type { HttpPlanEditPort } from './http-plan-edit-port';
3
+ import type { EditRecoveryStore, PlanEditAssetReference, QuickPlanEditPhase } from './quick-plan-editor';
4
+ type Plan = {
5
+ withCustodian: boolean;
6
+ masterKeyEncrypted: boolean;
7
+ };
8
+ export declare class PlanEditAssetAccess {
9
+ private readonly port;
10
+ private readonly coreSdk;
11
+ private readonly recoveryStore;
12
+ private revealedAssets?;
13
+ private revealGeneration;
14
+ constructor(port: HttpPlanEditPort, coreSdk: SDKContainer, recoveryStore: EditRecoveryStore);
15
+ clearRevealedAssets(planId: string): void;
16
+ private configurationRepository;
17
+ loadAssets(input: PlanEditAssetReference, onProgress?: (phase: QuickPlanEditPhase) => void): Promise<{
18
+ plan: Plan;
19
+ masterKey?: string;
20
+ assets: DataAsset[];
21
+ }>;
22
+ private assertEditSession;
23
+ private resolveMasterKey;
24
+ private revealAssets;
25
+ private assertShare;
26
+ private assertNotAborted;
27
+ }
28
+ export {};
@@ -0,0 +1,26 @@
1
+ import type { SDKContainer, DataAsset } from '@safetech/inheriti-core-sdk/node';
2
+ import type { HttpPlanEditPort } from './http-plan-edit-port';
3
+ import type { AddPlanAssetInput, EditRecoveryStore, QuickPlanEditPhase } from './quick-plan-editor';
4
+ export type EditReference = Pick<AddPlanAssetInput, 'organizationId' | 'planId' | 'editId'>;
5
+ export declare class PlanEditReconfiguration {
6
+ private readonly port;
7
+ private readonly coreSdk;
8
+ private readonly recoveryStore;
9
+ private readonly clearRevealedAssets;
10
+ constructor(port: HttpPlanEditPort, coreSdk: SDKContainer, recoveryStore: EditRecoveryStore, clearRevealedAssets: (planId: string) => void);
11
+ saveAssets(input: AddPlanAssetInput, assets: DataAsset[], withCustodian: boolean, masterKey: string | undefined, assetId: string, onProgress?: (phase: QuickPlanEditPhase) => void): Promise<{
12
+ status: 'UPDATED' | 'RECOVERY_REQUIRED';
13
+ assetId: string;
14
+ }>;
15
+ recover(input: EditReference): Promise<{
16
+ status: 'UPDATED' | 'RECOVERY_REQUIRED';
17
+ }>;
18
+ discard(input: EditReference): Promise<void>;
19
+ discardLocal(planId: string): Promise<void>;
20
+ private configurationRepository;
21
+ private clearCheckpoint;
22
+ private prepareConfiguration;
23
+ private transportShares;
24
+ private commit;
25
+ private isCommitted;
26
+ }
@@ -0,0 +1,82 @@
1
+ import type { SDKContainer, DataAsset } from '@safetech/inheriti-core-sdk/node';
2
+ import type { EditSession } from './http-plan-edit-port';
3
+ import { HttpPlanEditPort } from './http-plan-edit-port';
4
+ import type { ReconfigureMaterial } from './http-plan-edit-port';
5
+ import type { EditReference } from './plan-edit-reconfiguration';
6
+ export type QuickPlanEditPhase = 'checking_edit' | 'acquiring_key' | 'opening_plan' | 'revealing' | 'pending_dms' | 'pending_approvals' | 'pending_auth' | 'pending_moderation' | 'distributing_custodian_share' | 'configuring_custodian_share' | 'claiming_custodian_share' | 'releasing_custodian_share' | 'connecting_safekey_pro' | 'collecting_validators' | 'collecting_shares' | 'reconstructing' | 'opening_window' | 'preparing_view' | 'preparing' | 'preflighting' | 'distributing_validators' | 'distributing_data' | 'finalizing' | 'verifying';
7
+ export interface AddPlanAssetInput {
8
+ organizationId: string;
9
+ planId: string;
10
+ editId: string;
11
+ asset: Omit<DataAsset, 'id'>;
12
+ totalShares: number;
13
+ masterKey?: string;
14
+ acquireMasterKey?: () => Promise<string>;
15
+ signal?: AbortSignal;
16
+ selectCustodianDevice?: () => 'SK_MOBILE' | 'SK_PRO' | Promise<'SK_MOBILE' | 'SK_PRO'>;
17
+ proDevice?: {
18
+ write(share: {
19
+ id: string;
20
+ planId: string;
21
+ shares: string[];
22
+ }, signal?: AbortSignal): Promise<{
23
+ deviceId: string;
24
+ }>;
25
+ read(request: {
26
+ shareId: string;
27
+ planId: string;
28
+ }, signal?: AbortSignal): Promise<{
29
+ id: string;
30
+ planId: string;
31
+ shares: string[];
32
+ deviceId: string;
33
+ }>;
34
+ clearPin?(): void;
35
+ };
36
+ }
37
+ export interface ReplacePlanAssetInput extends AddPlanAssetInput {
38
+ assetId: string;
39
+ }
40
+ export type PlanEditAssetReference = Pick<AddPlanAssetInput, 'organizationId' | 'planId' | 'editId' | 'masterKey' | 'acquireMasterKey' | 'signal' | 'selectCustodianDevice' | 'proDevice'>;
41
+ export type PlanEditAssetSummary = Pick<DataAsset, 'id' | 'type'> & {
42
+ name: string;
43
+ isMedia: boolean;
44
+ };
45
+ export interface EditRecoveryRecord {
46
+ organizationId: string;
47
+ planId: string;
48
+ editId: string;
49
+ assetId: string;
50
+ material: ReconfigureMaterial;
51
+ }
52
+ export interface EditRecoveryStore {
53
+ save(record: EditRecoveryRecord): Promise<boolean>;
54
+ load(planId: string): Promise<EditRecoveryRecord | null>;
55
+ remove(planId: string): Promise<void>;
56
+ }
57
+ export declare class QuickPlanEditor {
58
+ private readonly port;
59
+ private readonly coreSdk;
60
+ private readonly assetAccess;
61
+ private readonly reconfiguration;
62
+ constructor(port: HttpPlanEditPort, coreSdk: SDKContainer, recoveryStore: EditRecoveryStore);
63
+ clearRevealedAssets(planId: string): void;
64
+ start(organizationId: string, planId: string, mode: 'DIRECT' | 'GOVERNED', idempotencyKey: string): Promise<EditSession>;
65
+ listAssets(input: PlanEditAssetReference, onProgress?: (phase: QuickPlanEditPhase) => void): Promise<PlanEditAssetSummary[]>;
66
+ getAsset(input: PlanEditAssetReference, assetId: string, onProgress?: (phase: QuickPlanEditPhase) => void): Promise<DataAsset>;
67
+ replaceAsset(input: ReplacePlanAssetInput, onProgress?: (phase: QuickPlanEditPhase) => void): Promise<{
68
+ status: 'UPDATED' | 'RECOVERY_REQUIRED';
69
+ assetId: string;
70
+ }>;
71
+ addAsset(input: AddPlanAssetInput, onProgress?: (phase: QuickPlanEditPhase) => void): Promise<{
72
+ status: 'UPDATED' | 'RECOVERY_REQUIRED';
73
+ assetId: string;
74
+ }>;
75
+ private isMedia;
76
+ private hasMediaData;
77
+ recover(input: EditReference): Promise<{
78
+ status: 'UPDATED' | 'RECOVERY_REQUIRED';
79
+ }>;
80
+ discard(input: EditReference): Promise<void>;
81
+ discardLocal(planId: string): Promise<void>;
82
+ }
@@ -0,0 +1,6 @@
1
+ import type { SDKContainer } from '@safetech/inheriti-core-sdk/node';
2
+ import type { EncryptedPlanMaterial } from '../../elements/plan-operations';
3
+ import type { QuickPlanInput, QuickPlanCreateContext, QuickPlanStatus, QuickPlanPort } from './contract';
4
+ import type { prepareAsset } from './prepare-asset';
5
+ import type { QuickPlanCreatePhase } from './quick-plan-creator';
6
+ export declare function buildMaterial(input: QuickPlanInput, prepared: ReturnType<typeof prepareAsset>, context: QuickPlanCreateContext, status: QuickPlanStatus, port: QuickPlanPort, coreSdk: SDKContainer, onProgress?: (phase: QuickPlanCreatePhase) => void): Promise<EncryptedPlanMaterial>;
@@ -0,0 +1,57 @@
1
+ import type { MasterKeySource } from '@safetech/inheriti-core-sdk/node';
2
+ import type { DataAsset } from '@safetech/inheriti-core-sdk/node';
3
+ import type { EncryptedPlanMaterial } from '../../elements/plan-operations';
4
+ export interface QuickPlanInput {
5
+ organizationId: string;
6
+ planId: string;
7
+ title: string;
8
+ asset: Omit<DataAsset, 'id'>;
9
+ audience?: {
10
+ teamId: string;
11
+ };
12
+ masterKeySource?: MasterKeySource;
13
+ totalShares: number;
14
+ }
15
+ export interface QuickPlanStatus {
16
+ status: string;
17
+ mergeThreshold: number;
18
+ withCustodian: boolean;
19
+ }
20
+ export interface QuickPlanCreateContext {
21
+ planId: string;
22
+ memberId: string;
23
+ storage: {
24
+ activeDataStorageLayerCount: number;
25
+ };
26
+ masterKeyAcquisition: {
27
+ system: string;
28
+ contextId: string;
29
+ };
30
+ }
31
+ export interface QuickPlanPort {
32
+ createContext(organizationId: string): Promise<QuickPlanCreateContext>;
33
+ teams(organizationId: string): Promise<{
34
+ teams: Array<{
35
+ id: string;
36
+ name: string;
37
+ }>;
38
+ }>;
39
+ status(organizationId: string, planId: string): Promise<QuickPlanStatus>;
40
+ create(organizationId: string, planId: string, title: string, audience?: {
41
+ teamId: string;
42
+ }): Promise<void>;
43
+ distribute(organizationId: string, planId: string, material: EncryptedPlanMaterial): Promise<void>;
44
+ preflight(organizationId: string, planId: string, material: EncryptedPlanMaterial): Promise<void>;
45
+ configure(organizationId: string, planId: string, material: EncryptedPlanMaterial): Promise<void>;
46
+ startRelaySession(organizationId: string, context: {
47
+ system: string;
48
+ contextId: string;
49
+ }, clientPublicKey: string): Promise<{
50
+ sessionId: string;
51
+ expiresAt: string | Date;
52
+ }>;
53
+ readRelaySession(organizationId: string, sessionId: string): Promise<{
54
+ status: 'PENDING' | 'DELIVERED' | 'EXPIRED';
55
+ sealedMasterKey?: string;
56
+ }>;
57
+ }
@@ -0,0 +1,40 @@
1
+ import type { EncryptedPlanMaterial } from '../../elements/plan-operations';
2
+ import type { QuickPlanCreateContext, QuickPlanStatus, QuickPlanPort } from './contract';
3
+ export declare class PlanRequestFailed extends Error {
4
+ readonly status: number;
5
+ readonly code?: string | undefined;
6
+ constructor(status: number, code?: string | undefined);
7
+ }
8
+ export declare class HttpQuickPlanPort implements QuickPlanPort {
9
+ private readonly apiUrl;
10
+ private readonly environment;
11
+ private readonly getBearerToken;
12
+ private readonly transport;
13
+ constructor(apiUrl: string, environment: 'TEST' | 'LIVE', getBearerToken: () => Promise<string | null>, transport?: typeof fetch);
14
+ createContext(organizationId: string): Promise<QuickPlanCreateContext>;
15
+ teams(organizationId: string): Promise<{
16
+ teams: Array<{
17
+ id: string;
18
+ name: string;
19
+ }>;
20
+ }>;
21
+ status(organizationId: string, planId: string): Promise<QuickPlanStatus>;
22
+ create(organizationId: string, planId: string, title: string, audience?: {
23
+ teamId: string;
24
+ }): Promise<void>;
25
+ distribute(organizationId: string, planId: string, material: EncryptedPlanMaterial): Promise<void>;
26
+ preflight(organizationId: string, planId: string, material: EncryptedPlanMaterial): Promise<void>;
27
+ configure(organizationId: string, planId: string, material: EncryptedPlanMaterial): Promise<void>;
28
+ startRelaySession(organizationId: string, context: {
29
+ system: string;
30
+ contextId: string;
31
+ }, clientPublicKey: string): Promise<{
32
+ sessionId: string;
33
+ expiresAt: string | Date;
34
+ }>;
35
+ readRelaySession(organizationId: string, sessionId: string): Promise<{
36
+ status: 'PENDING' | 'DELIVERED' | 'EXPIRED';
37
+ sealedMasterKey?: string;
38
+ }>;
39
+ private request;
40
+ }
@@ -0,0 +1,9 @@
1
+ export declare const QUICK_PLAN_MESSAGES: {
2
+ readonly invalidDeclaration: "plan_declaration_invalid";
3
+ readonly invalidShares: "plan_share_count_invalid";
4
+ readonly storageChanged: "plan_storage_context_changed";
5
+ readonly invalidMasterKeyContext: "invalid_master_key_context";
6
+ readonly reauthenticationRequired: "operator_reauthentication_required";
7
+ readonly relayFailed: "master_key_relay_failed";
8
+ readonly reconciliationRequired: "reconciliation_required";
9
+ };
@@ -0,0 +1,10 @@
1
+ import type { DataAsset } from '@safetech/inheriti-core-sdk/node';
2
+ import type { StartPlanCreationInput } from '../../elements/plan-operations';
3
+ export declare function prepareAsset(input: {
4
+ planId: string;
5
+ title: string;
6
+ asset: Omit<DataAsset, 'id'>;
7
+ }): {
8
+ asset: DataAsset;
9
+ plan: StartPlanCreationInput;
10
+ };
@@ -0,0 +1,17 @@
1
+ import type { SDKContainer } from '@safetech/inheriti-core-sdk/node';
2
+ import type { QuickPlanInput, QuickPlanPort } from './contract';
3
+ export type QuickPlanCreatePhase = 'creating_plan' | 'encrypting' | 'generating_shares' | 'preflighting' | 'distributing' | 'configuring' | 'verifying';
4
+ export declare class QuickPlanCreator {
5
+ private readonly port;
6
+ private readonly coreSdk;
7
+ private readonly material;
8
+ private readonly flights;
9
+ constructor(port: QuickPlanPort, coreSdk: SDKContainer);
10
+ createQuickPlan(input: QuickPlanInput, onProgress?: (phase: QuickPlanCreatePhase) => void): Promise<{
11
+ planId: string;
12
+ status: 'READY' | 'PENDING';
13
+ }>;
14
+ private performCreate;
15
+ abandon(planId: string): void;
16
+ private statusOrMissing;
17
+ }
@@ -0,0 +1,2 @@
1
+ import type { QuickPlanInput } from './contract';
2
+ export declare function requestFingerprint(input: QuickPlanInput): Promise<string>;
@@ -67,6 +67,7 @@ export interface ElementsApiPort {
67
67
  */
68
68
  startMasterKeyRelaySession(clientPublicKey: string, context?: MasterKeyRelayContext): Promise<MasterKeyRelaySessionOpened>;
69
69
  readMasterKeyRelaySession(sessionId: string): Promise<MasterKeyRelaySessionState>;
70
+ cancelMasterKeyRelaySession(sessionId: string): Promise<void>;
70
71
  listPlans(input?: import('./plan-operations').ListPlansInput): Promise<import('./plan-operations').PlanPage>;
71
72
  getPlan(planId: string): Promise<import('./plan-operations').PlanDetail>;
72
73
  listPlanLogs(planId: string, input?: import('./plan-operations').ListPlanLogsInput): Promise<import('./plan-operations').PlanLogPage>;
@@ -85,6 +86,9 @@ export interface ElementsApiPort {
85
86
  markGovernedDataRevealed(processId: string): Promise<void>;
86
87
  closeGovernedReveal(processId: string): Promise<void>;
87
88
  startReveal(planId: string, input: StartRevealInput): Promise<RevealSession>;
89
+ getActivePlanReveal(planId: string): Promise<(RevealSession & {
90
+ recovery: 'RESUMABLE' | 'RESTART_REQUIRED';
91
+ }) | null>;
88
92
  getReveal(revealId: string): Promise<RevealSession>;
89
93
  releaseRevealMaterial(revealId: string, materialVersion: string): Promise<unknown>;
90
94
  /** The host declaring it holds the storage-layer shares. Governed reveals only. */
@@ -109,7 +113,7 @@ export interface ElementsApiPort {
109
113
  * leaves an access still open; the next reveal resumes it. This is how a host says the access is
110
114
  * not wanted after all. `aborted: false` means there was nothing to give up.
111
115
  */
112
- abortPlanAccess(planId: string): Promise<{
116
+ abortPlanAccess(planId: string, expectedRevealId?: string): Promise<{
113
117
  aborted: boolean;
114
118
  }>;
115
119
  authorizeRevealAction(revealId: string, input: AuthorizeRevealActionInput): Promise<RevealAction>;