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
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
const store = new DefaultSecretStore({
enableGet: true,
enableRemove: true,
enableSet: true,
})
Hierarchy
SecretStoreBaseClass
<DefaultSecretStoreConfig
>↳
DefaultSecretStore
Implements
Table of contents
Constructors
Properties
Methods
Constructors
constructor
• new DefaultSecretStore(config?
): DefaultSecretStore
Parameters
Name | Type | Description |
---|---|---|
config? | Object | - |
config.cacheTtl? | number | Cache time to live in ms |
config.enableCache? | boolean | Enable cache |
config.enableGet? | boolean | Enable generally get method |
config.enableRemove? | boolean | Enable generally remove method |
config.enableSet? | boolean | Enable generally set method |
config.logLevel? | LogLevelName | A log level for new logger if logger is not set |
config.logger? | Logger | A logger instance |
Returns
Overrides
SecretStoreBaseClass.constructor
Defined in
DefaultSecretStore/DefaultSecretStore.impl.ts:39
Properties
cache
• cache: SecretStoreCacheMap
Inherited from
Defined in
core/SecretStore/SecretStoreBaseClass.impl.ts:26
config
• config: Object
Type declaration
Name | Type | Description |
---|---|---|
cacheTtl? | number | Cache time to live in ms |
enableCache? | boolean | Enable cache |
enableGet? | boolean | Enable generally get method |
enableRemove? | boolean | Enable generally remove method |
enableSet? | boolean | Enable generally set method |
logLevel? | LogLevelName | A log level for new logger if logger is not set |
logger? | Logger | A logger instance |
Inherited from
Defined in
core/SecretStore/SecretStoreBaseClass.impl.ts:22
logger
• logger: Logger
Inherited from
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
Inherited from
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
Inherited from
Defined in
core/SecretStore/SecretStoreBaseClass.impl.ts:136
getSecret
▸ getSecret<SecretNames
>(...secretNames
): Promise
<ObjectWithKeysFromStringArray
<SecretNames
, undefined
| string
>>
Type parameters
Name | Type |
---|---|
SecretNames | extends string [] |
Parameters
Name | Type |
---|---|
...secretNames | SecretNames |
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
Name | Type |
---|---|
SecretNames | extends string [] |
Parameters
Name | Type |
---|---|
...secretNames | SecretNames |
Returns
Promise
<ObjectWithKeysFromStringArray
<SecretNames
, undefined
| string
>>
Overrides
SecretStoreBaseClass.getSecretImpl
Defined in
DefaultSecretStore/DefaultSecretStore.impl.ts:49
removeSecret
▸ removeSecret(secretName
): Promise
<void
>
Parameters
Name | Type |
---|---|
secretName | string |
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
Name | Type |
---|---|
secretName | string |
Returns
Promise
<void
>
Overrides
SecretStoreBaseClass.removeSecretImpl
Defined in
DefaultSecretStore/DefaultSecretStore.impl.ts:63
setSecret
▸ setSecret(secretName
, secretValue
): Promise
<void
>
Parameters
Name | Type |
---|---|
secretName | string |
secretValue | string |
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
Name | Type |
---|---|
secretName | string |
secretValue | string |
Returns
Promise
<void
>
Overrides
SecretStoreBaseClass.setSecretImpl