Skip to content

SEA: preserve raw strings with decrypt skipParse option - #1427

Open
tmsteph wants to merge 1 commit into
amark:masterfrom
tmsteph:agent/sea-decrypt-skip-parse-1418
Open

SEA: preserve raw strings with decrypt skipParse option#1427
tmsteph wants to merge 1 commit into
amark:masterfrom
tmsteph:agent/sea-decrypt-skip-parse-1418

Conversation

@tmsteph

@tmsteph tmsteph commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

What changed

Adds an opt-in skipParse option to SEA.decrypt so callers can recover plaintext strings exactly as encrypted, even when the string happens to look like JSON.

The default behavior is unchanged for backwards compatibility: decrypted plaintext still passes through SEA.opt.parse unless skipParse is explicitly enabled.

Example:

const enc = await SEA.encrypt('[hello there]', pair);
const dec = await SEA.decrypt(enc, pair, null, { skipParse: true });
// dec === '[hello there]'

This updates both the canonical sea.js bundle and extracted sea/decrypt.js, exposes the callback/options arguments in the TypeScript declarations, and adds regression coverage for JSON-looking string payloads.

Fixes #1418.

Validation

  • npm run testsea: 36 passing, 1 pending, including the new skipParse regression.
  • test/sea/nodeauth.js: all 5 visible scenarios passed on the first clean run. The harness intentionally calls process.exit(-1) in its after hook, so it exits with status 255 after the tests.
  • git diff --check: clean.

@tmsteph
tmsteph marked this pull request as ready for review August 22, 2026 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] SEA.decrypt fails to decrypt the output of SEA.encrypt where the encrypted data is a malformed JSON string

1 participant