# `Lightning.SafetyString`
[🔗](https://github.com/OpenFn/lightning/blob/main/lib/lightning/safety_string.ex#L1)

Utilities for securely encoding serializable structs, lists and strings into
URL-safe strings.

In order to pass the state around in a URL, in a manner that protects
secrets from leaking - and allows us to avoid persistance
we take a set of parameters and:

- Encode into a URI query string
- gzip it to save characters
- encrypt the string
- base64 encode it for URI encoding safety

# `decode`

```elixir
@spec decode(data :: binary()) ::
  {:error, String.t()} | %{optional(binary()) =&gt; binary()} | [binary()]
```

# `encode`

```elixir
@spec encode(data :: struct() | map() | binary() | [binary()]) :: binary()
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
