---
title: SecretStore
summary: A Compute Secret Store.
url: https://www.fastly.com/documentation/reference/compute/sdks/cpp/fastly/secret_store/class.SecretStore/
---

**Kind:** Class  
**Module:** [secret_store](https://www.fastly.com/documentation/reference/compute/sdks/cpp/fastly/secret_store/)  
**Package:** compute-sdk-cpp 0.7.0  
**Source:** https://github.com/fastly/compute-sdk-cpp/blob/ff911e47be2f319e83a9cde960d2c3c5db534280/include/fastly/secret_store.h#L70

Include `fastly/secret_store.h` to use this class.

A Compute [Secret](https://www.fastly.com/documentation/reference/compute/sdks/cpp/fastly/secret_store/class.Secret/) Store.

A secret store name has a maximum length of 255 bytes and must contain only letters, numbers, dashes (-), underscores (_), and periods (.).

## Methods

### contains

**Source:** https://github.com/fastly/compute-sdk-cpp/blob/ff911e47be2f319e83a9cde960d2c3c5db534280/include/fastly/secret_store.h#L83

```cpp
fastly::expected<bool> fastly::secret_store::SecretStore::contains(std::string_view key)
```

Return true if the secret store contains a secret with the given.

name.

**Parameters**

- `key`: `std::string_view`

**Returns**

`fastly::expected<bool>`

### get

**Source:** https://github.com/fastly/compute-sdk-cpp/blob/ff911e47be2f319e83a9cde960d2c3c5db534280/include/fastly/secret_store.h#L78

```cpp
fastly::expected<std::optional<Secret>> fastly::secret_store::SecretStore::get(std::string_view key)
```

Lookup a [`Secret`](https://www.fastly.com/documentation/reference/compute/sdks/cpp/fastly/secret_store/class.Secret/) by name in this secret store.

Returns `std::optional<Secret>` if the secret is found, and `std::nullopt` if the secret was not found.

**Parameters**

- `key`: `std::string_view`

**Returns**

`fastly::expected<std::optional<Secret>>`

### open

**Flags:** static  
**Source:** https://github.com/fastly/compute-sdk-cpp/blob/ff911e47be2f319e83a9cde960d2c3c5db534280/include/fastly/secret_store.h#L72

```cpp
static fastly::expected<SecretStore> fastly::secret_store::SecretStore::open(std::string_view name)
```

**Parameters**

- `name`: `std::string_view`

**Returns**

`fastly::expected<SecretStore>`
