The postguard-js SDK shipped two large user-facing features in v1.4–1.6 that have no coverage in the SDK reference pages.
What needs documenting
1. PostGuardConfig.retry and the onRetry hook (postguard-js#47)
Cryptify chunk PUTs and downloads now retry transient failures automatically. The retry budget, delays, and per-phase timeouts are configurable. Add a "Retries and timeouts" subsection to docs/sdk/js-encryption.md (and link from docs/sdk/js-decryption.md for the download side) covering:
retry: RetryOptions on PostGuardConfig — defaults: 5 attempts, 500 ms initial delay, 30 s cap, 2× multiplier, full jitter
- Per-phase timeouts:
chunkTimeoutMs (60 s default), finalizeTimeoutMs (120 s default), downloadTimeoutMs (off by default — bounded by retry budget)
- Retry classification: 5xx / network errors / internal-timeout AbortError → retry; 4xx /
UploadSessionExpiredError / caller abort → fail
onRetry: (event: RetryEvent) => void hook for surfacing "retrying… (attempt N of M)" in the UI
initUpload and finalizeUpload are deliberately not retried
Source PR: encryption4all/postguard-js#47
2. Resumable downloads via Range header (postguard-js#52)
downloadFileWithRetry now resumes mid-stream failures using a Range header. Briefly document the new behaviour in docs/sdk/js-decryption.md:
- Mid-stream errors trigger a resume from the current offset
- Resume requires
206 Partial Content with a matching Content-Range; a 200 reply on resume is treated as fail-not-retry (silent-rewind protection)
- A flapping connection that delivers some bytes per attempt still exhausts the shared retry budget — does not loop forever
- The function now returns the
ReadableStream synchronously (stream-level errors surface on the consumer's first read(), not via a function-level rejection). This is a behaviour change for callers that did await downloadFileWithRetry(...).
Source PR: encryption4all/postguard-js#52
3. New UploadSessionExpiredError (postguard-js#47)
Add a row to docs/sdk/js-errors.md. Subclass of NetworkError, parsed from cryptify's structured 404 body (upload_session_not_found). Distinct from NetworkError so retry policies short-circuit. Surfaced from both chunk and finalize paths.
Verification
- Confirm symbols exist on
main of encryption4all/postguard-js (don't trust the PR description alone — verify against current source).
- Pin source links to a full commit hash.
curl -sI each link before merging.
npm run docs:build must succeed.
Cross-link
The cryptify-side counterpart docs are tracked in a separate issue on this repo; the SDK retry contract relies on that wire behaviour.
The postguard-js SDK shipped two large user-facing features in v1.4–1.6 that have no coverage in the SDK reference pages.
What needs documenting
1.
PostGuardConfig.retryand theonRetryhook (postguard-js#47)Cryptify chunk PUTs and downloads now retry transient failures automatically. The retry budget, delays, and per-phase timeouts are configurable. Add a "Retries and timeouts" subsection to
docs/sdk/js-encryption.md(and link fromdocs/sdk/js-decryption.mdfor the download side) covering:retry: RetryOptionsonPostGuardConfig— defaults: 5 attempts, 500 ms initial delay, 30 s cap, 2× multiplier, full jitterchunkTimeoutMs(60 s default),finalizeTimeoutMs(120 s default),downloadTimeoutMs(off by default — bounded by retry budget)UploadSessionExpiredError/ caller abort → failonRetry: (event: RetryEvent) => voidhook for surfacing "retrying… (attempt N of M)" in the UIinitUploadandfinalizeUploadare deliberately not retriedSource PR: encryption4all/postguard-js#47
2. Resumable downloads via Range header (postguard-js#52)
downloadFileWithRetrynow resumes mid-stream failures using aRangeheader. Briefly document the new behaviour indocs/sdk/js-decryption.md:206 Partial Contentwith a matchingContent-Range; a200reply on resume is treated as fail-not-retry (silent-rewind protection)ReadableStreamsynchronously (stream-level errors surface on the consumer's firstread(), not via a function-level rejection). This is a behaviour change for callers that didawait downloadFileWithRetry(...).Source PR: encryption4all/postguard-js#52
3. New
UploadSessionExpiredError(postguard-js#47)Add a row to
docs/sdk/js-errors.md. Subclass ofNetworkError, parsed from cryptify's structured 404 body (upload_session_not_found). Distinct fromNetworkErrorso retry policies short-circuit. Surfaced from both chunk and finalize paths.Verification
mainofencryption4all/postguard-js(don't trust the PR description alone — verify against current source).curl -sIeach link before merging.npm run docs:buildmust succeed.Cross-link
The cryptify-side counterpart docs are tracked in a separate issue on this repo; the SDK retry contract relies on that wire behaviour.