Classes · @purista/core

DefaultSecretStore

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

Signature

DefaultSecretStore.ts typescript
class DefaultSecretStore

Examples

example-1.ts 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:
example-2.ts typescript
const store = new DefaultSecretStore({
 enableGet: true,
 enableRemove: true,
 enableSet: true,
})

Constructors

1 entry

constructor

Constructor

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

Properties

4 entries

cache

Property

Source
cache.ts typescript
cache: SecretStoreCacheMap

Optional in-memory cache of secret values.

config

Property

Source
config.ts typescript
config: { cacheTtl: number; enableCache: boolean; enableGet: boolean; enableRemove: boolean; enableSet: boolean; logger: Logger; ... }

Store configuration including operation toggles and cache settings.

logger

Property

Source
logger.ts typescript
logger: Logger

Child logger scoped to the store name.

name

Property

Source
name.ts typescript
name: string

Store name used in logs and diagnostics.

Methods

7 entries

destroy

Method

Source
destroy.ts typescript
destroy(): Promise<void>

Shutdown hook for store adapters.

getSecret

Method

Source
getSecret.ts typescript
getSecret<SecretNames>(...secretNames: SecretNames): Promise<ObjectWithKeysFromStringArray<SecretNames, string | undefined>>

Get one or more secrets by name.

getSecretImpl

Method

Source
getSecretImpl.ts typescript
getSecretImpl<SecretNames>(...secretNames: SecretNames): Promise<ObjectWithKeysFromStringArray<SecretNames, string | undefined>>

Adapter-specific secret lookup implementation.

removeSecret

Method

Source
removeSecret.ts typescript
removeSecret(secretName: string): Promise<void>

Remove one secret by name.

removeSecretImpl

Method

Source
removeSecretImpl.ts typescript
removeSecretImpl(secretName: string): Promise<void>

Adapter-specific secret removal implementation.

setSecret

Method

Source
setSecret.ts typescript
setSecret(secretName: string, secretValue: string): Promise<void>

Store or replace one secret value.

setSecretImpl

Method

Source
setSecretImpl.ts typescript
setSecretImpl(secretName: string, secretValue: string): Promise<void>

Adapter-specific secret write implementation.