Episode 17 game · Chitragupta · Water

Chitragupta’s Three Chests

Kai turns dark mode off, reloads, and the dark comes back. Feel the Greedy Tsuzura turn every value into a string and share it with every tab, put each value in the chest that fits who reads it and how long it lives, then prove nothing comes back twisted or stolen.

ChitraguptaEvery chest in my ledger keeps text, Kai, and only text. Turn your dark mode off, then reload, and watch what the chest hands back.
17Seal 17
kai.app/settings

Theme saved with localStorage.setItem('dark', dark)

Kai’s shopDark mode is on
Tab A · order #101step 3 of 3 · payment
Tab B · order #102not open yet
Chitragupta’s ledger what each chest really holds

    Every value you store is written down as text. Watch the quotes.

    1 · Feel the twist

    Kai’s shop saves dark mode with localStorage.setItem('dark', dark), and the checkout step in localStorage too. Turn dark mode off, reload, then open a second order in another tab.

    Storage keeps strings

    setItem('dark', false) stores "false", which is truthy. Write with JSON.stringify, read with JSON.parse.

    Pick by lifetime

    localStorage is shared by every tab and stays; sessionStorage belongs to one tab and ends when it closes.

    Secrets out of reach

    Let the server set the session in an HttpOnly; Secure; SameSite=Lax cookie. Scripts can’t read it.