---
title: Secrets Store
description: Read account-level secrets from the Cloudflare Secrets Store.
sidebar:
  badge: Experimental
---

The [Secrets Store](https://developers.cloudflare.com/secrets-store/integrations/workers/) holds account-level secrets that can be bound to a worker. The `exp/cloudflare/secretsstore` package wraps the `SecretsStoreSecret` binding.

:::warning[Experimental]
This package lives under `exp/cloudflare` and its API may change.
:::

## Declare the binding

Each `[[secrets_store_secrets]]` entry maps one secret — identified by `store_id` and `secret_name` — to a binding name.

```toml
[[secrets_store_secrets]]
binding = "MY_SECRET"
store_id = "<your store id>"
secret_name = "<your secret name>"
```

## Read a secret

`secretsstore.NewSecretsStoreSecret` resolves the binding by name. `Get` returns the secret value as a string, or an error if the secret does not exist.

```go
import "github.com/syumai/workers-go/exp/cloudflare/secretsstore"

secret, err := secretsstore.NewSecretsStoreSecret("MY_SECRET")
if err != nil {
	return err
}

value, err := secret.Get()
if err != nil {
	return err
}
```
