Skip to main content
When a document’s encrypt block is set, the viewer can decrypt text runs in-browser before rendering. Structure, UUIDs, and metadata stay visible regardless.

Detection

The loader calls hasEncryptedContent(doc) on every load. If encrypted content is detected, one of two flows runs:
  1. Password in config — if password was passed in config, it’s used to decrypt in-memory and the viewer renders directly.
  2. Password modal — otherwise a PasswordModal appears, prompting the user. Wrong passwords trigger an inline error and re-prompt.

JavaScript

Svelte

Programmatic helpers

Imported from the library:

Errors

When a wrong password is supplied, the viewer calls onError with a LoaderError carrying code: 'DECRYPT_FAILED'. The modal flow retries until the user cancels or succeeds.

What’s encrypted (recap)

ScreenJSON’s encryption block targets text runs only — UUIDs, scene counts, character names, revision metadata, and meta stay in plain text. See the Encryption specification for exactly which fields are touched.