Expand description
Shareable scenario permalinks (self-contained Base64, RFC 4648).
A scenario in the playground is a TOML document. To share it as a URL, the TOML is
Base64-encoded into a ?s= query parameter; opening that URL decodes it back. This
module provides the codec — a dependency-free RFC 4648 Base64 (the standard +/
alphabet for interop, and the URL-safe -_ alphabet without padding for clean query
strings) and the encode_scenario / decode_scenario wrappers.
Keeping it in the engine (rather than only in JavaScript) means the same encoding is available to the Rust, CLI, Python, and WebAssembly surfaces, and is unit-tested against the canonical RFC 4648 vectors.
Functions§
- base64_
decode - Standard RFC 4648 Base64 decode.
- base64_
encode - Standard RFC 4648 Base64 encode (alphabet
A–Za–z0–9+/,=padding). - decode_
scenario - Decode a permalink token back into the scenario TOML, or
Noneif the token is not valid Base64 or not valid UTF-8. - encode_
scenario - Encode a scenario TOML document into a URL-safe, unpadded permalink token suitable
for a
?s=query parameter (no+,/, or=to escape).