From: Ardis Lu Date: Fri, 24 Jul 2026 07:08:55 +0000 (-0700) Subject: Apply type narrowing to `decrypt` X-Git-Tag: v0.1.4~2 X-Git-Url: https://git.ardis.lu/?a=commitdiff_plain;h=ef7de4ada8fce0bb9ec1cd74e505dec5054136af;p=envpass Apply type narrowing to `decrypt` Same logic applies, just forgot to do this in 8374efadfc751aa2a5db43cff96109ffb230690b --- diff --git a/src/command.js b/src/command.js index 454e06f..b4d4973 100644 --- a/src/command.js +++ b/src/command.js @@ -121,6 +121,7 @@ export async function decrypt(options = {}, { args = [] } = {}) { logger = {} } = options; + /** @type {Record} */ const env = await readFile(inFile, { encoding: 'utf-8' }).then(parseEnv); logger.debug?.('Environment variables read and parsed.'); if (Object.keys(env).length === 0) { @@ -131,12 +132,6 @@ export async function decrypt(options = {}, { args = [] } = {}) { let prf = null; /** @type {Env} */const decryptedEnv = {}; for (const [envVar, value] of Object.entries(env)) { - if (value === undefined) { - logger.info?.(`Environment variable "${envVar}" is unset, skipping decryption.`); - decryptedEnv[envVar] = ''; - continue; - } - const parsedValue = parseEnvpassEncrypted(value); if (parsedValue === null) { decryptedEnv[envVar] = value;