Classes · @purista/core
DefaultSecretStore
Process-local in-memory secret store for development and tests.
Signature
class DefaultSecretStore Examples
const store = new DefaultSecretStore({
config: {
secretOne: 'my_secret_one_value',
secretTwo: 'my_secret_two_value',
}
})
console.log(await store.getSecret('secretOne', 39;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: const store = new DefaultSecretStore({
enableGet: true,
enableRemove: true,
enableSet: true,
}) Constructors
1 entry
constructor
Constructor
new constructor(config?: { cacheTtl: number; enableCache: boolean; enableGet: boolean; enableRemove: boolean; enableSet: boolean; logger: Logger; ... }) Properties
4 entries
cache
Property
cache: SecretStoreCacheMap Optional in-memory cache of secret values.
config
Property
config: { cacheTtl: number; enableCache: boolean; enableGet: boolean; enableRemove: boolean; enableSet: boolean; logger: Logger; ... } Store configuration including operation toggles and cache settings.
logger
Property
logger: Logger Child logger scoped to the store name.
name
Property
name: string Store name used in logs and diagnostics.
Methods
7 entries
destroy
Method
destroy(): Promise<void> Shutdown hook for store adapters.
getSecret
Method
getSecret<SecretNames>(...secretNames: SecretNames): Promise<ObjectWithKeysFromStringArray<SecretNames, string | undefined>> Get one or more secrets by name.
getSecretImpl
Method
getSecretImpl<SecretNames>(...secretNames: SecretNames): Promise<ObjectWithKeysFromStringArray<SecretNames, string | undefined>> Adapter-specific secret lookup implementation.
removeSecret
Method
removeSecret(secretName: string): Promise<void> Remove one secret by name.
removeSecretImpl
Method
removeSecretImpl(secretName: string): Promise<void> Adapter-specific secret removal implementation.
setSecret
Method
setSecret(secretName: string, secretValue: string): Promise<void> Store or replace one secret value.
setSecretImpl
Method
setSecretImpl(secretName: string, secretValue: string): Promise<void> Adapter-specific secret write implementation.