import type { ParsingExtension } from '@app-config/core' ; import { named } from '@app-config/extension-utils' ; import { logger } from '@app-config/logging' ; import { DecryptedSymmetricKey , decryptValue } from './encryption' ; export * from './encryption' ; export * from './secret-agent' ; export * from './secret-agent-tls' ; /** Decrypts inline encrypted values */ export default function encryptedDirective ( symmetricKey ? , shouldShowDeprecationNotice ? ) { return named ( 'encryption' , ( value ) => { if ( typeof value === 'string' && value . startsWith ( 'enc:' ) ) { return async ( parse ) => { if ( shouldShowDeprecationNotice ) { logger . warn ( 'Detected deprecated use of @app-config/encryption parsing extension. Please install @app-config/encryption and add it to your meta file "parsingExtensions".' ) ; } const decrypted = await decryptValue ( value , symmetricKey ) ; return parse ( decrypted , { fromSecrets : true , parsedFromEncryptedValue : true } ) ; } ; } return false ; } ) ; }