# DefaultSecretStore API

Process-local in-memory secret store for development and tests.

---
Canonical: /handbook/api/classes/_purista_core.DefaultSecretStore/
Source: DefaultSecretStore/DefaultSecretStore.impl.ts
Format: Markdown for agents
---

Process-local in-memory secret store for development and tests.

Package: `@purista/core`

## Signature

```typescript
class DefaultSecretStore
```

## Examples

```typescript
const store = new DefaultSecretStore({
 config: {
   secretOne: 'my_secret_one_value',
   secretTwo: 'my_secret_two_value',
 }
})
console.log(await store.getSecret('secretOne', 'secretTwo) // outputs: { secretOne: my_secret_one_value, secretTwo: 'my_secret_two_value' }
```
By default, setting/changing and removal of values are disabled.
You can enable it on instance creation:
```

```typescript
const store = new DefaultSecretStore({
 enableGet: true,
 enableRemove: true,
 enableSet: true,
})
```

## Members

### Constructors

- `new constructor(config?: { cacheTtl: number; enableCache: boolean; enableGet: boolean; enableRemove: boolean; enableSet: boolean; logger: Logger; ... })`

### Properties

- `cache: SecretStoreCacheMap` — Optional in-memory cache of secret values.
- `config: { cacheTtl: number; enableCache: boolean; enableGet: boolean; enableRemove: boolean; enableSet: boolean; logger: Logger; ... }` — Store configuration including operation toggles and cache settings.
- `logger: Logger` — Child logger scoped to the store name.
- `name: string` — Store name used in logs and diagnostics.

### Methods

- `destroy(): Promise<void>` — Shutdown hook for store adapters.
- `getSecret<SecretNames>(...secretNames: SecretNames): Promise<ObjectWithKeysFromStringArray<SecretNames, string | undefined>>` — Get one or more secrets by name.
- `getSecretImpl<SecretNames>(...secretNames: SecretNames): Promise<ObjectWithKeysFromStringArray<SecretNames, string | undefined>>` — Adapter-specific secret lookup implementation.
- `removeSecret(secretName: string): Promise<void>` — Remove one secret by name.
- `removeSecretImpl(secretName: string): Promise<void>` — Adapter-specific secret removal implementation.
- `setSecret(secretName: string, secretValue: string): Promise<void>` — Store or replace one secret value.
- `setSecretImpl(secretName: string, secretValue: string): Promise<void>` — Adapter-specific secret write implementation.
