import type { IBackupArchiveManifest, IBackupArchiveObject, TIsolatedRestoreResourceMapping } from './backup.js'; /** Operations carried by a short-lived, single-operation restore grant. */ export declare const isolatedRestoreGrantOperations: readonly ["prepare", "write-object", "execute", "cleanup", "status"]; export type TIsolatedRestoreGrantOperation = (typeof isolatedRestoreGrantOperations)[number]; /** * Versioned limits shared by signers, relays, and Corestore. * * V1 uses an inline descriptor manifest inside a 1 MiB control request. Its * 4,096 object slots reserve 256 entries for config, snapshots, keys, and * index segments; the remaining 3,840 slots fit 1,920 default 8 MiB pack/index * pairs. The 15 GiB total envelope is therefore reachable with the default * ContainerArchive packing profile instead of advertising impossible capacity. */ export declare const isolatedRestoreContractLimits: Readonly<{ version: 1; maximumControlJsonBytes: number; maximumRestoreGrantBytes: number; maximumConfiguredStringBytes: 2048; maximumPathBytes: 4096; maximumResourceMappings: 256; maximumArchiveObjects: 4096; reservedArchiveMetadataObjects: 256; defaultContainerArchivePackTargetBytes: number; maximumArchiveObjectBytes: number; maximumArchiveTotalBytes: number; maximumWriteChunkBytes: number; maximumWriteChunkBase64Characters: 699052; maximumObjectChunks: 4096; }>; /** ContainerArchive v1 paths that may be replicated into restore staging. */ export declare const isolatedRestoreRepositoryPathProfile: Readonly<{ version: 1; rootObject: "config.json"; topLevelDirectories: readonly ["packs", "snapshots", "index", "keys"]; temporaryFilesAllowed: false; ancestorConflictsAllowed: false; }>; /** * Exact normalized payload of a signed isolated restore grant. * Persist this projection for audit/recovery, never the compact bearer JWT. */ export interface IIsolatedRestoreGrantClaims { grantVersion: 1; iss: string; aud: string; sub: string; jti: string; authorizationId: string; tenantId: string; clusterId: string; targetNodeName: string; restoreId: string; sourceBackupId: string; sourceServiceId: string; scratchNamespaceId: string; stagingArchiveId: string; operation: TIsolatedRestoreGrantOperation; resourceMappingsSha256: string; archiveManifestSha256: string; iat: number; nbf: number; exp: number; } declare const isolatedRestoreVerifiedGrantBrand: unique symbol; /** * Runtime-branded result of invoking a cryptographic verifier for a compact * restore grant. The bearer itself remains in module-private storage so this * value cannot disclose it through serialization or reflection. It cannot be * reconstructed from claims alone and is accepted only by the same module * instance that performed verification. */ export interface IVerifiedIsolatedRestoreGrant { readonly claims: Readonly; readonly [isolatedRestoreVerifiedGrantBrand]: true; } export type TIsolatedRestoreGrantVerifier = (compactArg: string) => unknown | Promise; /** The signed restoreGrant is the only authority accepted in control bodies. */ export interface IIsolatedRestoreControlForbiddenAuthority { authorizationId?: never; tenantId?: never; clusterId?: never; targetNodeName?: never; restoreId?: never; sourceBackupId?: never; sourceServiceId?: never; targetServiceId?: never; scratchNamespaceId?: never; stagingArchiveId?: never; operation?: never; resourceMappingsSha256?: never; archiveManifestSha256?: never; } export interface IIsolatedRestoreControlPrepareRequest extends IIsolatedRestoreControlForbiddenAuthority { restoreGrant: string; expectedRevision: number; resourceMappings: TIsolatedRestoreResourceMapping[]; archiveManifest: IBackupArchiveManifest; } /** * One bounded chunk of an immutable manifest object. `size` and `sha256` * describe the complete object; `chunkSha256` authenticates this request's * decoded bytes. Offset + decoded length === size means only that the chunk * reaches the object boundary; it does not prove object completion. */ export interface IIsolatedRestoreControlWriteRequest extends IIsolatedRestoreControlForbiddenAuthority { restoreGrant: string; expectedRevision: number; path: string; size: number; sha256: string; offset: number; chunkSha256: string; contentsBase64: string; } export interface IIsolatedRestoreControlExecuteRequest extends IIsolatedRestoreControlForbiddenAuthority { restoreGrant: string; expectedRevision: number; } export interface IIsolatedRestoreControlCleanupRequest extends IIsolatedRestoreControlForbiddenAuthority { restoreGrant: string; expectedRevision: number; } export interface IIsolatedRestoreControlStatusRequest extends IIsolatedRestoreControlForbiddenAuthority { restoreGrant: string; } export type TIsolatedRestoreControlRequest = IIsolatedRestoreControlPrepareRequest | IIsolatedRestoreControlWriteRequest | IIsolatedRestoreControlExecuteRequest | IIsolatedRestoreControlCleanupRequest | IIsolatedRestoreControlStatusRequest; /** * Stable authority shared by every grant for one restore plan. Request-local * operation, jti, and validity times are intentionally excluded so separately * authorized write requests can contribute to the same object. */ export interface IIsolatedRestoreAuthorityProjection { version: 1; iss: string; aud: string; sub: string; authorizationId: string; tenantId: string; clusterId: string; targetNodeName: string; restoreId: string; sourceBackupId: string; sourceServiceId: string; scratchNamespaceId: string; stagingArchiveId: string; resourceMappingsSha256: string; archiveManifestSha256: string; } export type TIsolatedRestoreBoundPrepareRequest = Omit; export type TIsolatedRestoreBoundWriteRequestData = Omit; export type TIsolatedRestoreBoundExecuteRequest = Omit; export type TIsolatedRestoreBoundCleanupRequest = Omit; export type TIsolatedRestoreBoundStatusRequest = Omit; export interface IIsolatedRestoreBoundPlan { authority: Readonly; authoritySha256: string; claims: Readonly; resourceMappings: readonly TIsolatedRestoreResourceMapping[]; archiveManifest: Readonly; } export interface IIsolatedRestoreBoundPrepareRequest { authority: Readonly; authoritySha256: string; claims: Readonly; request: Readonly; } export interface IIsolatedRestoreVerifiedChunkDescriptor { contentsBase64: string; decodedSize: number; sha256: string; } export interface IIsolatedRestoreBoundWriteRequest { authority: Readonly; authoritySha256: string; claims: Readonly; request: Readonly; descriptor: Readonly; chunk: Readonly; /** * The chunk reaches the declared size boundary. This is not object * completion: only bindIsolatedRestoreCompletedObject proves contiguous * coverage from offset 0 and the complete manifest-object SHA-256. */ endsAtObjectSize: boolean; } export interface IIsolatedRestoreBoundControlRequest { authority: Readonly; authoritySha256: string; claims: Readonly; request: Readonly; plan: IIsolatedRestoreBoundPlan; } declare const isolatedRestoreCompletedObjectBrand: unique symbol; export interface IIsolatedRestoreCompletedObjectBinding { readonly authority: Readonly; readonly authoritySha256: string; readonly descriptor: Readonly; readonly chunkCount: number; readonly contiguousBytes: number; readonly sha256: string; readonly [isolatedRestoreCompletedObjectBrand]: true; } /** * Bearer-free receipt suitable for trusted Corestore persistence. Its hashes * detect corruption and bind authority, descriptor, range, and chunk digest; * they do not replace grant authentication or authenticate an untrusted store. */ export interface IIsolatedRestoreDurableChunkReceipt { version: 1; authority: Readonly; authoritySha256: string; descriptor: Readonly; offset: number; decodedSize: number; chunkSha256: string; receiptSha256: string; } /** Durable, bearer-free proof regenerated from receipts and one file snapshot. */ export interface IIsolatedRestoreDurableCompletedObjectProof { version: 1; authority: Readonly; authoritySha256: string; descriptor: Readonly; chunkCount: number; contiguousBytes: number; sha256: string; receiptSetSha256: string; proofSha256: string; } export declare class IsolatedRestoreContractError extends Error { constructor(reasonArg: string); } /** Cross-runtime rules for restore authority digests. */ export declare const isolatedRestoreCanonicalJsonRules: Readonly<{ version: 1; encoding: "utf-8"; objectKeyOrdering: "utf-16-code-unit-ascending"; arrayOrdering: "preserved-dense"; unicodeNormalization: "preserved"; numberEncoding: "safe-integer-json-no-negative-zero"; digest: "sha256-lowercase-hex"; }>; /** * Enforces the raw HTTP ingress limit before buffering or JSON parsing. * Apply it to Content-Length and to the running byte count after every chunk. */ export declare const assertIsolatedRestoreControlIngressByteLength: (byteLengthArg: unknown) => number; export declare const normalizeIsolatedRestoreResourceMappings: (valueArg: unknown) => TIsolatedRestoreResourceMapping[]; /** * Rejects names that the exact restore providers cannot provision, replace, * or delete. Keep this separate from structural normalization so historical * coordinator state remains readable for cleanup after a contract upgrade. */ export declare const assertIsolatedRestoreProviderRestorableResourceMappings: (mappingsArg: readonly TIsolatedRestoreResourceMapping[]) => void; export declare const normalizeIsolatedRestoreArchiveManifest: (valueArg: unknown) => IBackupArchiveManifest; export declare const normalizeIsolatedRestoreGrantClaims: (valueArg: unknown) => Readonly; export declare const normalizeIsolatedRestoreControlPrepareRequest: (valueArg: unknown) => IIsolatedRestoreControlPrepareRequest; export declare const normalizeIsolatedRestoreControlWriteRequest: (valueArg: unknown) => IIsolatedRestoreControlWriteRequest; export declare const normalizeIsolatedRestoreControlExecuteRequest: (valueArg: unknown) => IIsolatedRestoreControlExecuteRequest; export declare const normalizeIsolatedRestoreControlCleanupRequest: (valueArg: unknown) => IIsolatedRestoreControlCleanupRequest; export declare const normalizeIsolatedRestoreControlStatusRequest: (valueArg: unknown) => IIsolatedRestoreControlStatusRequest; export declare const canonicalizeIsolatedRestoreResourceMappings: (valueArg: readonly TIsolatedRestoreResourceMapping[]) => string; export declare const canonicalizeIsolatedRestoreArchiveManifest: (valueArg: IBackupArchiveManifest) => string; export declare const canonicalizeIsolatedRestoreGrantClaims: (valueArg: IIsolatedRestoreGrantClaims) => string; export declare const normalizeIsolatedRestoreAuthorityProjection: (valueArg: unknown) => Readonly; export declare const createIsolatedRestoreAuthorityProjection: (claimsArg: IIsolatedRestoreGrantClaims) => Readonly; export declare const canonicalizeIsolatedRestoreAuthorityProjection: (valueArg: IIsolatedRestoreAuthorityProjection) => string; export declare const createIsolatedRestoreBytesSha256: (contentsArg: Uint8Array) => Promise; export declare const createIsolatedRestoreResourceMappingsSha256: (valueArg: unknown) => Promise; export declare const createIsolatedRestoreArchiveManifestSha256: (valueArg: unknown) => Promise; export declare const createIsolatedRestoreGrantClaimsSha256: (valueArg: unknown) => Promise; export declare const createIsolatedRestoreAuthoritySha256: (valueArg: unknown) => Promise; /** * Invokes the caller's cryptographic verifier for exactly `compact`, retains * that bearer in module-private storage, and brands the immutable claims * projection. Binding helpers reject claims supplied without this operation * and reject any control body carrying another compact JWT. */ export declare const verifyIsolatedRestoreGrant: (compactArg: unknown, verifierArg: TIsolatedRestoreGrantVerifier) => Promise; export declare const assertIsolatedRestoreGrantOperation: (grantArg: IVerifiedIsolatedRestoreGrant, expectedOperationArg: TIsolatedRestoreGrantOperation) => Readonly; export declare const bindIsolatedRestoreGrantToPlan: (grantArg: IVerifiedIsolatedRestoreGrant, expectedOperationArg: TIsolatedRestoreGrantOperation, resourceMappingsArg: unknown, archiveManifestArg: unknown) => Promise; export declare const bindIsolatedRestorePrepareRequestToGrant: (grantArg: IVerifiedIsolatedRestoreGrant, requestArg: unknown) => Promise; export declare const bindIsolatedRestoreExecuteRequestToGrant: (grantArg: IVerifiedIsolatedRestoreGrant, requestArg: unknown, resourceMappingsArg: unknown, archiveManifestArg: unknown) => Promise>; export declare const bindIsolatedRestoreCleanupRequestToGrant: (grantArg: IVerifiedIsolatedRestoreGrant, requestArg: unknown, resourceMappingsArg: unknown, archiveManifestArg: unknown) => Promise>; export declare const bindIsolatedRestoreStatusRequestToGrant: (grantArg: IVerifiedIsolatedRestoreGrant, requestArg: unknown, resourceMappingsArg: unknown, archiveManifestArg: unknown) => Promise>; export declare const bindIsolatedRestoreWriteRequestToGrant: (grantArg: IVerifiedIsolatedRestoreGrant, requestArg: unknown, resourceMappingsArg: unknown, archiveManifestArg: unknown) => Promise; /** Returns a fresh caller-owned copy; verified bindings never expose mutable bytes. */ export declare const decodeIsolatedRestoreBoundWriteChunk: (bindingArg: IIsolatedRestoreBoundWriteRequest) => Uint8Array; export declare const normalizeIsolatedRestoreDurableChunkReceipt: (valueArg: unknown) => Readonly; /** * Rehydrates a trusted-store receipt and verifies both consistency digests. * This does not replace verification of the grant that originally produced it. */ export declare const verifyIsolatedRestoreDurableChunkReceipt: (valueArg: unknown) => Promise>; /** * Creates a bearer-free receipt only from a runtime-verified write binding. * Persist the result in authenticated/trusted Corestore state for recovery. */ export declare const createIsolatedRestoreDurableChunkReceipt: (bindingArg: IIsolatedRestoreBoundWriteRequest) => Promise>; /** * Rehydrates ordered trusted-store receipts and verifies them against one * defensive snapshot of the complete staged file. Per-range and full-file * SHA-256 checks bind the resulting proof to authority, object, and receipt set. */ export declare const verifyIsolatedRestoreDurableCompletedObject: (receiptsArg: readonly unknown[], contentsArg: Uint8Array) => Promise>; /** * Process-local completion convenience for runtime-branded chunks. It does not * survive restart. Enterprise/Corestore workflows must persist durable chunk * receipts and call verifyIsolatedRestoreDurableCompletedObject after recovery. * Chunks must share one authority and descriptor, cover [0, size) contiguously, * and hash to the complete manifest descriptor. */ export declare const bindIsolatedRestoreCompletedObject: (bindingsArg: readonly IIsolatedRestoreBoundWriteRequest[]) => Promise; export declare const assertIsolatedRestoreCompletedObject: (completedArg: IIsolatedRestoreCompletedObjectBinding) => IIsolatedRestoreCompletedObjectBinding; export {};