Skip to content
Français

verifyRecoveryTransfer

import { verifyRecoveryTransfer } from "@elie-laloum/outpost";

Check a retained transfer directory: state.json, the three patches, commits.bundle when commits changed and every listed file, then optionally Git restorability and checksums. Failed checks are reported in the result, not thrown; nothing is applied and the author is not authenticated. restorability without repository or an invalid maxBytes rejects with code configuration.

Complete example and detailed rules.

  • pathRequired
    string
    Retained transfer directory to verify; a missing directory rejects with code workspace.
  • optionsOptional
    RecoveryVerificationOptions | undefined
    Restorability and checksum checks, the repository they use and the hashing limit.
  • options.restorabilityOptional
    boolean | undefined
    Clone repository into a temporary directory and check that the commits exist, the bundle unpacks and the three patches apply. Runs only when the structure checks pass; requires repository.
  • options.repositoryOptional
    string | undefined
    Git checkout cloned for the restorability check; a shallow or partial clone, or one with alternates, fails that check.
  • options.checksumsOptional
    boolean | undefined
    Hash every file listed in checksums.json with SHA-256 and compare kind, size and digest. Runs only when the earlier checks pass.
  • options.maxBytesOptional
    number | undefined
    Maximum bytes hashed for checksums, default 1073741824 (1 GiB). Exceeding it fails with CHECKSUM_LIMIT and leaves integrity unverified.

Promise<RecoveryVerification>

export declare function verifyRecoveryTransfer(
  path: string,
  options?: RecoveryVerificationOptions,
): Promise<RecoveryVerification>;