> ## Documentation Index
> Fetch the complete documentation index at: https://docs.edgespark.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# secret — EdgeSpark secrets

> Read encrypted EdgeSpark secrets at runtime after registering keys through the CLI and entering values through a secure browser flow.

`secret` reads values from your project's encrypted secret store. Secrets are scoped to the current environment. For newly created projects today, that means the current default production environment.

<Note>
  Secret values are not pasted into the CLI. `edgespark secret set` opens a secure EdgeSpark browser URL so the human owner can enter the value directly, without sending it through the terminal, agent context, or third-party LLM APIs such as Anthropic, Google, or OpenAI.
</Note>

## `secret.get(name)`

Declare the key in `server/src/defs/runtime.ts`, then read it at runtime:

```typescript server/src/index.ts theme={null}
import { secret } from "edgespark";
import { Hono } from "hono";

const app = new Hono().post("/api/send-email", async (c) => {
  const { to, subject, body } = await c.req.json<{
    to: string;
    subject: string;
    body: string;
  }>();

  const apiKey = secret.get("SENDGRID_API_KEY");

  await fetch("https://api.sendgrid.com/v3/mail/send", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${apiKey}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      personalizations: [{ to: [{ email: to }] }],
      from: { email: "no-reply@yourapp.com" },
      subject,
      content: [{ type: "text/plain", value: body }],
    }),
  });

  return c.json({ sent: true });
});

export default app;
```

## Manage secrets

Use the CLI to manage secret keys:

```bash theme={null}
edgespark secret list
edgespark secret set SENDGRID_API_KEY
edgespark secret delete SENDGRID_API_KEY
```

`edgespark secret set` opens a secure project URL where the value is entered in the browser.

## See also

<Columns cols={2}>
  <Card title="Manage secrets" icon="key" href="/guides/secrets">
    How to register keys, enter values securely, and use different values per environment.
  </Card>

  <Card title="Development workflow" icon="workflow" href="/guides/development-workflow">
    How secrets fit into the full repo-based workflow for schema, storage, vars, auth config, and deploys.
  </Card>
</Columns>
