npx skills add ...
npx skills add encoredev/skills --skill encore-secret
npx skills add encoredev/skills --skill encore-secret
Manage API keys, credentials, and other secrets in Encore.ts using `secret(...)` from `encore.dev/config`.
Secrets are encrypted, environment-scoped values managed by Encore. Declare them at package level by calling secret(name) and read them by calling the returned function.
Secret names are globally unique across the application (the same name resolves to the same value everywhere).
Environment types: production (alias prod), development (alias dev), preview (alias pr), local.
For local development without going through encore secret set, create a .secrets.local.cue file at the repo root (gitignore it):
secret(...) at package level, never inside functions.stripeKey() not stripeKey.encore secret set --type <env>..secrets.local.cue for local overrides and gitignore it.encore-webhook skill.# Set per environment type
encore secret set --type prod StripeSecretKey
encore secret set --type dev StripeSecretKey
encore secret set --type local StripeSecretKeyStripeSecretKey: "sk_test_local_..."
GitHubAPIToken: "ghp_local_..."// HTTP headers
const githubToken = secret("GitHubAPIToken");
const resp = await fetch("https://api.github.com/user", {
headers: { Authorization: `token ${githubToken()}` },
});
// Webhook signature verification
const stripeWebhookSecret = secret("StripeWebhookSecret");
stripe.webhooks.constructEvent(rawBody, sig, stripeWebhookSecret());
// Connecting to a third-party SDK
const openaiKey = secret("OpenAIKey");
const openai = new OpenAI({ apiKey: openaiKey() });