PURISTA API / @purista/core / DefaultSecretStore
Class: DefaultSecretStore
Defined in: packages/core/src/DefaultSecretStore/DefaultSecretStore.impl.ts:37
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.
Examples
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:
const store = new DefaultSecretStore({
enableGet: true,
enableRemove: true,
enableSet: true,
})
Extends
Implements
Constructors
new DefaultSecretStore()
new DefaultSecretStore(
config
?):DefaultSecretStore
Defined in: packages/core/src/DefaultSecretStore/DefaultSecretStore.impl.ts:39
Parameters
config?
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
logger?
A logger instance
logLevel?
A log level for new logger if logger is not set
Returns
Overrides
SecretStoreBaseClass
.constructor
Properties
cache
cache:
SecretStoreCacheMap
Defined in: packages/core/src/core/SecretStore/SecretStoreBaseClass.impl.ts:26
Inherited from
config
config:
object
Defined in: packages/core/src/core/SecretStore/SecretStoreBaseClass.impl.ts:22
Index Signature
[key
: string
]: unknown
cacheTtl?
optional
cacheTtl:number
Cache time to live in ms
enableCache?
optional
enableCache:boolean
Enable cache
enableGet?
optional
enableGet:boolean
Enable generally get method
enableRemove?
optional
enableRemove:boolean
Enable generally remove method
enableSet?
optional
enableSet:boolean
Enable generally set method
logger?
optional
logger:Logger
A logger instance
logLevel?
optional
logLevel:LogLevelName
A log level for new logger if logger is not set
Inherited from
logger
logger:
Logger
Defined in: packages/core/src/core/SecretStore/SecretStoreBaseClass.impl.ts:21
Inherited from
name
name:
string
Defined in: packages/core/src/core/SecretStore/SecretStoreBaseClass.impl.ts:24
name of store
Implementation of
Inherited from
Methods
destroy()
destroy():
Promise
<void
>
Defined in: packages/core/src/core/SecretStore/SecretStoreBaseClass.impl.ts:136
disconnects and shuts down the secret store
Returns
Promise
<void
>
Implementation of
Inherited from
getSecret()
getSecret<
SecretNames
>(...secretNames
):Promise
<ObjectWithKeysFromStringArray
<SecretNames
,undefined
|string
>>
Defined in: packages/core/src/core/SecretStore/SecretStoreBaseClass.impl.ts:48
get a secret
Type Parameters
• SecretNames extends string
[]
Parameters
secretNames
...SecretNames
Returns
Promise
<ObjectWithKeysFromStringArray
<SecretNames
, undefined
| string
>>
Param
name of secret
Throws
UnhandledError
Implementation of
SecretStore.getSecret
Inherited from
SecretStoreBaseClass
.getSecret
getSecretImpl()
protected
getSecretImpl<SecretNames
>(...secretNames
):Promise
<ObjectWithKeysFromStringArray
<SecretNames
,undefined
|string
>>
Defined in: packages/core/src/DefaultSecretStore/DefaultSecretStore.impl.ts:49
Type Parameters
• SecretNames extends string
[]
Parameters
secretNames
...SecretNames
Returns
Promise
<ObjectWithKeysFromStringArray
<SecretNames
, undefined
| string
>>
Overrides
SecretStoreBaseClass
.getSecretImpl
removeSecret()
removeSecret(
secretName
):Promise
<void
>
Defined in: packages/core/src/core/SecretStore/SecretStoreBaseClass.impl.ts:104
delete a secret
Parameters
secretName
string
Returns
Promise
<void
>
Param
name of secret
Throws
UnhandledError
Implementation of
SecretStore.removeSecret
Inherited from
SecretStoreBaseClass
.removeSecret
removeSecretImpl()
protected
removeSecretImpl(secretName
):Promise
<void
>
Defined in: packages/core/src/DefaultSecretStore/DefaultSecretStore.impl.ts:64
Parameters
secretName
string
Returns
Promise
<void
>
Overrides
SecretStoreBaseClass
.removeSecretImpl
setSecret()
setSecret(
secretName
,secretValue
):Promise
<void
>
Defined in: packages/core/src/core/SecretStore/SecretStoreBaseClass.impl.ts:120
set a secret
Parameters
secretName
string
secretValue
string
Returns
Promise
<void
>
Param
name of secret
Param
value of secret
Throws
UnhandledError
Implementation of
SecretStore.setSecret
Inherited from
SecretStoreBaseClass
.setSecret
setSecretImpl()
protected
setSecretImpl(secretName
,secretValue
):Promise
<void
>
Defined in: packages/core/src/DefaultSecretStore/DefaultSecretStore.impl.ts:60
Parameters
secretName
string
secretValue
string
Returns
Promise
<void
>