Skip to content

PURISTA API / Modules / @purista/core / DefaultSecretStore

Class: DefaultSecretStore

@purista/core.DefaultSecretStore

The DefaultSecretStore is a placeholder which offers all needed methods. Getters and setters will throw a UnhandledError with status Unauthorized, when a disabled operation is called.

For development and testing purpose, you can initiate the store with values.

Example

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' }

Per default, setting/changing and removal of values are disabled. You can enable it on instance creation:

Example

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

Hierarchy

Implements

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new DefaultSecretStore(config?): DefaultSecretStore

Parameters

NameTypeDescription
config?Object-
config.cacheTtl?numberCache time to live in ms
config.enableCache?booleanEnable cache
config.enableGet?booleanEnable generally get method
config.enableRemove?booleanEnable generally remove method
config.enableSet?booleanEnable generally set method
config.logLevel?LogLevelNameA log level for new logger if logger is not set
config.logger?LoggerA logger instance

Returns

DefaultSecretStore

Overrides

SecretStoreBaseClass.constructor

Defined in

DefaultSecretStore/DefaultSecretStore.impl.ts:39

Properties

cache

cache: SecretStoreCacheMap

Inherited from

SecretStoreBaseClass.cache

Defined in

core/SecretStore/SecretStoreBaseClass.impl.ts:26


config

config: Object

Type declaration

NameTypeDescription
cacheTtl?numberCache time to live in ms
enableCache?booleanEnable cache
enableGet?booleanEnable generally get method
enableRemove?booleanEnable generally remove method
enableSet?booleanEnable generally set method
logLevel?LogLevelNameA log level for new logger if logger is not set
logger?LoggerA logger instance

Inherited from

SecretStoreBaseClass.config

Defined in

core/SecretStore/SecretStoreBaseClass.impl.ts:22


logger

logger: Logger

Inherited from

SecretStoreBaseClass.logger

Defined in

core/SecretStore/SecretStoreBaseClass.impl.ts:21


map

Private map: Map<string, string>

Defined in

DefaultSecretStore/DefaultSecretStore.impl.ts:38


name

name: string

name of store

Implementation of

SecretStore.name

Inherited from

SecretStoreBaseClass.name

Defined in

core/SecretStore/SecretStoreBaseClass.impl.ts:24

Methods

destroy

destroy(): Promise<void>

disconnects and shuts down the secret store

Returns

Promise<void>

Implementation of

SecretStore.destroy

Inherited from

SecretStoreBaseClass.destroy

Defined in

core/SecretStore/SecretStoreBaseClass.impl.ts:136


getSecret

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

Type parameters

NameType
SecretNamesextends string[]

Parameters

NameType
...secretNamesSecretNames

Returns

Promise<ObjectWithKeysFromStringArray<SecretNames, undefined | string>>

Implementation of

SecretStore.getSecret

Inherited from

SecretStoreBaseClass.getSecret

Defined in

core/SecretStore/SecretStoreBaseClass.impl.ts:48


getSecretImpl

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

Type parameters

NameType
SecretNamesextends string[]

Parameters

NameType
...secretNamesSecretNames

Returns

Promise<ObjectWithKeysFromStringArray<SecretNames, undefined | string>>

Overrides

SecretStoreBaseClass.getSecretImpl

Defined in

DefaultSecretStore/DefaultSecretStore.impl.ts:49


removeSecret

removeSecret(secretName): Promise<void>

Parameters

NameType
secretNamestring

Returns

Promise<void>

Implementation of

SecretStore.removeSecret

Inherited from

SecretStoreBaseClass.removeSecret

Defined in

core/SecretStore/SecretStoreBaseClass.impl.ts:104


removeSecretImpl

removeSecretImpl(secretName): Promise<void>

Parameters

NameType
secretNamestring

Returns

Promise<void>

Overrides

SecretStoreBaseClass.removeSecretImpl

Defined in

DefaultSecretStore/DefaultSecretStore.impl.ts:63


setSecret

setSecret(secretName, secretValue): Promise<void>

Parameters

NameType
secretNamestring
secretValuestring

Returns

Promise<void>

Implementation of

SecretStore.setSecret

Inherited from

SecretStoreBaseClass.setSecret

Defined in

core/SecretStore/SecretStoreBaseClass.impl.ts:120


setSecretImpl

setSecretImpl(secretName, secretValue): Promise<void>

Parameters

NameType
secretNamestring
secretValuestring

Returns

Promise<void>

Overrides

SecretStoreBaseClass.setSecretImpl

Defined in

DefaultSecretStore/DefaultSecretStore.impl.ts:59