The @e4a/pg-js SDK gained a new public surface for resuming an in-flight upload across page refreshes, tab crashes, or process restarts. The behaviour is partly covered on the cryptify side (docs/repos/cryptify.md mentions recovery_token and X-Recovery-Token), but the JS SDK reference does not document the new exports.
Source PR
encryption4all/postguard-js#66 — feat(api): capture recovery_token and add resumeUpload for cross-restart resume (merged 2026-05-13).
What needs documenting in docs/sdk/js-encryption.md
FileState.recoveryToken — initUpload now reads the snake-case recovery_token from the server response and returns it on FileState as recoveryToken. Consumers are expected to persist { uuid, recoveryToken } in their own storage (roamingSettings / browser.storage / IndexedDB).
resumeUpload(cryptifyUrl, uuid, recoveryToken, signal?) — new export. Calls GET /fileupload/{uuid}/status with the X-Recovery-Token header. Returns { state: FileState; uploaded: number }:
cryptify_token from the response is mapped to state.token
prev_token is mapped to state.prevToken (omitted before the first committed chunk)
uploaded is the byte offset to resume from; feed the returned state into the existing storeChunkWithRetry flow
UploadSessionExpiredError is already documented in docs/sdk/js-errors.md, but the JS encryption page should cross-link it from the new resume section, noting that a 404 upload_session_not_found is surfaced as this error and that cryptify deliberately collapses unknown UUID and wrong recovery token into the same response — callers should treat both as "start a new upload".
A small flow example in the JS SDK page (init → persist → resume after restart → continue with storeChunkWithRetry) would mirror the level of detail already present for the regular upload path.
Verification
- Cross-check against
src/api/cryptify.ts and src/index.ts in postguard-js at the merge commit of PR#66 for the exact signature and re-exports.
- Run
npx vitepress build docs and confirm no broken links.
- Keep style aligned with
postguard-docs/CLAUDE.md (no em dashes, minimal bold, no banned words).
The
@e4a/pg-jsSDK gained a new public surface for resuming an in-flight upload across page refreshes, tab crashes, or process restarts. The behaviour is partly covered on the cryptify side (docs/repos/cryptify.mdmentionsrecovery_tokenandX-Recovery-Token), but the JS SDK reference does not document the new exports.Source PR
encryption4all/postguard-js#66 —
feat(api): capture recovery_token and add resumeUpload for cross-restart resume(merged 2026-05-13).What needs documenting in
docs/sdk/js-encryption.mdFileState.recoveryToken—initUploadnow reads the snake-caserecovery_tokenfrom the server response and returns it onFileStateasrecoveryToken. Consumers are expected to persist{ uuid, recoveryToken }in their own storage (roamingSettings /browser.storage/ IndexedDB).resumeUpload(cryptifyUrl, uuid, recoveryToken, signal?)— new export. CallsGET /fileupload/{uuid}/statuswith theX-Recovery-Tokenheader. Returns{ state: FileState; uploaded: number }:cryptify_tokenfrom the response is mapped tostate.tokenprev_tokenis mapped tostate.prevToken(omitted before the first committed chunk)uploadedis the byte offset to resume from; feed the returnedstateinto the existingstoreChunkWithRetryflowUploadSessionExpiredErroris already documented indocs/sdk/js-errors.md, but the JS encryption page should cross-link it from the new resume section, noting that a 404upload_session_not_foundis surfaced as this error and that cryptify deliberately collapses unknown UUID and wrong recovery token into the same response — callers should treat both as "start a new upload".A small flow example in the JS SDK page (init → persist → resume after restart → continue with
storeChunkWithRetry) would mirror the level of detail already present for the regular upload path.Verification
src/api/cryptify.tsandsrc/index.tsin postguard-js at the merge commit of PR#66 for the exact signature and re-exports.npx vitepress build docsand confirm no broken links.postguard-docs/CLAUDE.md(no em dashes, minimal bold, no banned words).