Class

VaultSecrets

VaultSecrets()

Vault-backed secrets that are loaded after Vault initialization

Constructor

# new VaultSecrets()

View Source config/vault-secrets.js, line 8

Classes

VaultSecrets

Members

# instance

The instance of the VaultSecrets class

View Source config/vault-secrets.js, line 13

# secretsConfig

The dynamic configuration for secrets to load

View Source config/vault-secrets.js, line 20

Methods

# addISecretConfig(config) → {void}

Add a new secret configuration dynamically

Parameters:
Name Type Description
config ISecretConfig

The configuration for the secrets to add

View Source config/vault-secrets.js, line 289

A promise that resolves when the secrets are added

void

# get(key) → {string|undefined}

Get a secret value

Parameters:
Name Type Description
key string

The key of the secret to get

View Source config/vault-secrets.js, line 259

The value of the secret

string | undefined

# getConfiguredSecrets() → {Array.<string>}

Get all configured secret keys

View Source config/vault-secrets.js, line 297

An array of all configured secret keys

Array.<string>

# getISecretConfig(secretName) → {ISecretKey|undefined}

Get configuration for a specific secret

Parameters:
Name Type Description
secretName string

The name of the secret to get the configuration for

View Source config/vault-secrets.js, line 312

The configuration for the secret, or undefined if not found

ISecretKey | undefined

# getLoadedKeys() → {Array.<string>}

Get all loaded secret keys (for debugging)

View Source config/vault-secrets.js, line 350

An array of all loaded secret keys

Array.<string>

# getVaultConfig(secretName) → {ISecretConfig|undefined}

Get vault configuration for a specific secret

Parameters:
Name Type Description
secretName string

The name of the secret to get the vault configuration for

View Source config/vault-secrets.js, line 327

The vault configuration for the secret, or undefined if not found

ISecretConfig | undefined

# handleSecretKeyFallback(secretKey, results) → {void}

Handle fallback for a single secret key

Parameters:
Name Type Description
secretKey ISecretKey

The secret key to handle the fallback for

results object

The results of the loading process

success number

The number of secrets that were loaded successfully

failed number

The number of secrets that failed to load

fallbacks number

The number of secrets that were loaded from fallback values

View Source config/vault-secrets.js, line 183

A promise that resolves when the secrets are loaded

void

# handleVaultFallback(config, results) → {void}

Handle fallback for all keys in a vault configuration

Parameters:
Name Type Description
config ISecretConfig

The configuration for the secrets to load

results object

The results of the loading process

success number

The number of secrets that were loaded successfully

failed number

The number of secrets that failed to load

fallbacks number

The number of secrets that were loaded from fallback values

View Source config/vault-secrets.js, line 213

A promise that resolves when the secrets are loaded

void

# has(key) → {boolean}

Check if a secret exists in memory

Parameters:
Name Type Description
key string

The key of the secret to check

View Source config/vault-secrets.js, line 342

True if the secret exists in memory, false otherwise

boolean

# isSecretsLoaded() → {boolean}

Check if secrets are loaded

View Source config/vault-secrets.js, line 280

True if the secrets are loaded, false otherwise

boolean

# loadAllFallbacks()

Load all fallback values (emergency fallback)

View Source config/vault-secrets.js, line 237

# async loadSecrets()

Load secrets from Vault dynamically based on configuration

View Source config/vault-secrets.js, line 73

# async loadVaultSecrets(config, results) → {Promise.<void>}

Load secrets from a vault key based on its configuration

Parameters:
Name Type Description
config ISecretConfig

The configuration for the secrets to load

results object

The results of the loading process

success number

The number of secrets that were loaded successfully

failed number

The number of secrets that failed to load

fallbacks number

The number of secrets that were loaded from fallback values

View Source config/vault-secrets.js, line 123

A promise that resolves when the secrets are loaded

Promise.<void>

# validateRequiredSecrets()

Validate that all required secrets were loaded

View Source config/vault-secrets.js, line 221

# static getInstance() → {VaultSecrets}

Get the instance of the VaultSecrets class

View Source config/vault-secrets.js, line 64

The instance of the VaultSecrets class

VaultSecrets