Skip to content

docs(js-sdk): Opened.decrypt({uuid}) may now return DecryptDataResult when payload was uploaded via {data} #89

@dobby-coder

Description

@dobby-coder

What changed

postguard-js#67 (merged 2026-05-13) changes the return shape of Opened.decrypt({ uuid }).

Previously, Opened.decrypt({ uuid }) always returned DecryptFileResult ({ files, sender, blob, download() }). After the fix, the SDK inspects the inner zip central directory: if the entries are exactly ['data.bin'] (the shape produced by Sealed.upload({ data })), the entry is unwrapped and the call returns DecryptDataResult ({ plaintext, sender }). Otherwise behaviour is unchanged.

This makes the round-trip pg.encrypt({ data }).upload()pg.open({ uuid }).decrypt() actually yield plaintext as the encrypt-side API implies.

Docs that need updating

docs/sdk/js-decryption.md:

  • The section "Decrypt from Cryptify UUID" currently states the result is DecryptFileResult. That is only true when the payload was uploaded with Sealed.upload({ files }). When uploaded with Sealed.upload({ data }) the result is now DecryptDataResult.
  • The two-input table at the top ({ uuid } vs { data }) should note that { uuid } mirrors whichever mode produced the upload.
  • A short note (or TypeScript union) explaining how to discriminate between the two result shapes (e.g. 'plaintext' in result) would be useful for consumers writing if/else over the result.

docs/repos/postguard-js.md snippets that show opened.decrypt({ uuid }) returning a blob should keep the file-upload framing but acknowledge the data-mode alternative.

Source

  • Code: src/opened.ts, src/util/zip.ts (new extractZipEntry).
  • PR body has the exact discriminator rule ("entries are exactly ['data.bin']").

Verify against the SDK source before writing — the PR description is accurate but the published API types are the binding reference.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions