MCPcopy Index your code
hub / github.com/FlowiseAI/Flowise / getEncryptionKey

Function getEncryptionKey

packages/components/src/utils.ts:578–596  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

576 * @returns {Promise<string>}
577 */
578const getEncryptionKey = async (): Promise<string> => {
579 if (process.env.FLOWISE_SECRETKEY_OVERWRITE !== undefined && process.env.FLOWISE_SECRETKEY_OVERWRITE !== '') {
580 return process.env.FLOWISE_SECRETKEY_OVERWRITE
581 }
582 try {
583 if (USE_AWS_SECRETS_MANAGER && secretsManagerClient) {
584 const secretId = process.env.SECRETKEY_AWS_NAME || 'FlowiseEncryptionKey'
585 const command = new GetSecretValueCommand({ SecretId: secretId })
586 const response = await secretsManagerClient.send(command)
587
588 if (response.SecretString) {
589 return response.SecretString
590 }
591 }
592 return await fs.promises.readFile(getEncryptionKeyPath(), 'utf8')
593 } catch (error) {
594 throw new Error(error)
595 }
596}
597
598/**
599 * Decrypt credential data

Callers 1

decryptCredentialDataFunction · 0.70

Calls 1

getEncryptionKeyPathFunction · 0.85

Tested by

no test coverage detected