# Secrets

A project's secrets are values such as a payment provider's key or an OAuth client secret. They are stored sealed (AES-256-GCM, with a key kept apart from the data) and are never written to logs or the audit trail.

## Set a secret

**In the console**: the project's **Secrets** page, "Add or replace a secret". A name, the value, and an optional description.

**From the command line**:

```
rezin secrets set PAYMENT_KEY
```

The value is asked for, or piped in. It is never taken from the command line, where other programs on your machine could see it.

**Through the connector**: the `set_secret` tool.

Names are capitals, digits and underscores, like `PAYMENT_KEY`. A value can be up to 100,000 characters. Setting a name that exists replaces its value.

## Read a secret

- The console lists names and descriptions. **Reveal** shows one value; revealing is its own recorded action on the audit trail.
- `rezin secrets list` and the connector's `list_secret_names` give names only. **Neither the command-line tool nor the connector can read a value back.**

## What secrets are used for today

- **Your functions.** Assign a secret to a function and it arrives as `context.secrets.NAME`. A function gets only the secrets assigned to it. See [Functions](https://rezincore.com/docs/functions.md).
- A project's own Google or GitHub app: `GOOGLE_CLIENT_SECRET` and `GITHUB_CLIENT_SECRET`. See [Google and GitHub](https://rezincore.com/docs/auth/providers.md#whose-provider-app-is-used).
- Keeping a value your team needs in one sealed place.

Your application cannot read a secret through the API, by design: a secret reaches code only through a function it was assigned to.

## Who can do what

| Role | Can |
|---|---|
| Owner, developer | List, set, replace, reveal and delete |
| Read-only | List names. Cannot reveal or change. |
| Rezin Core staff | Nothing, without access you have given. See [Security and privacy model](https://rezincore.com/docs/security.md). |

Every set, reveal and delete is on the project's audit record with who did it. The value never is.
