encrypt block is set, the viewer can decrypt text
runs in-browser before rendering. Structure, UUIDs, and metadata stay
visible regardless.
Detection
The loader callshasEncryptedContent(doc) on every load. If encrypted
content is detected, one of two flows runs:
- Password in config — if
passwordwas passed in config, it’s used to decrypt in-memory and the viewer renders directly. - Password modal — otherwise a
PasswordModalappears, 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 callsonError 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, andmeta stay in plain
text. See the Encryption specification for
exactly which fields are touched.