# UserSecretsManager

- Module: [Aspire.Hosting](/reference/api/go/aspire.hosting.md)
- Version: `17.0.0`
- Kind: `interface`
- Source: [GitHub](https://github.com/microsoft/aspire/tree/bcfa151cdca6d0a573f22d5d9c23f9c727cb3b2f)

Defines an interface for managing user secrets with support for read and write operations.

## Definition

```go
type UserSecretsManager interface{}
```

## Properties

- `FilePath`: `string` `get` -- Gets the path to the user secrets file.
- `IsAvailable`: `bool` `get` -- Gets a value indicating whether user secrets are available.

## Methods

- [GetOrSetSecret](/reference/api/go/aspire.hosting/usersecretsmanager/getorsetsecret.md) -- `method` -- Gets a secret value if it exists in configuration, or sets it to the provided value if it does not.
  ```go
  GetOrSetSecret(resourceBuilder Resource, name string, value string) error
  ```
- [SaveStateJson](/reference/api/go/aspire.hosting/usersecretsmanager/savestatejson.md) -- `method` -- Saves state to user secrets from a JSON string.
  ```go
  SaveStateJson(json string, options ...*SaveStateJsonOptions) error
  ```
- [TryDeleteSecret](/reference/api/go/aspire.hosting/usersecretsmanager/trydeletesecret.md) -- `method` -- Attempts to delete a user secret value synchronously.
  ```go
  TryDeleteSecret(name string) (bool, error)
  ```
- [TrySetSecret](/reference/api/go/aspire.hosting/usersecretsmanager/trysetsecret.md) -- `method` -- Attempts to set a user secret value synchronously.
  ```go
  TrySetSecret(name string, value string) (bool, error)
  ```

## Applies to

- [`UserSecretsManager`](/reference/api/go/aspire.hosting/usersecretsmanager.md)
