diff --git a/dist/index.js b/dist/index.js index 2daa75c..689c0ba 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1110,7 +1110,7 @@ const fs = __importStar(__webpack_require__(747)); const path = __importStar(__webpack_require__(622)); const os = __importStar(__webpack_require__(87)); const exec = __importStar(__webpack_require__(807)); -exports.agentConfig = `default-cache-ttl 1 +exports.agentConfig = `default-cache-ttl 7200 max-cache-ttl 31536000 allow-preset-passphrase`; exports.getVersion = () => __awaiter(void 0, void 0, void 0, function* () { @@ -1199,7 +1199,10 @@ exports.getKeygrip = (fingerprint) => __awaiter(void 0, void 0, void 0, function }); }); exports.configureAgent = (config) => __awaiter(void 0, void 0, void 0, function* () { - const { homedir: homedir } = yield exports.getDirs(); + let homedir = path.join(process.env.HOME || '', '.gnupg'); + if (os.platform() == 'win32') { + homedir = path.join(process.env.USERPROFILE || '', '.gnupg'); + } const gpgAgentConf = path.join(homedir, 'gpg-agent.conf'); yield fs.writeFile(gpgAgentConf, config, function (err) { if (err) diff --git a/src/gpg.ts b/src/gpg.ts index c81065e..8fa9c9d 100644 --- a/src/gpg.ts +++ b/src/gpg.ts @@ -3,7 +3,7 @@ import * as path from 'path'; import * as os from 'os'; import * as exec from './exec'; -export const agentConfig = `default-cache-ttl 1 +export const agentConfig = `default-cache-ttl 7200 max-cache-ttl 31536000 allow-preset-passphrase`; @@ -111,11 +111,16 @@ export const getKeygrip = async (fingerprint: string): Promise => { }; export const configureAgent = async (config: string): Promise => { - const {homedir: homedir} = await getDirs(); + let homedir: string = path.join(process.env.HOME || '', '.gnupg'); + if (os.platform() == 'win32') { + homedir = path.join(process.env.USERPROFILE || '', '.gnupg'); + } + const gpgAgentConf = path.join(homedir, 'gpg-agent.conf'); await fs.writeFile(gpgAgentConf, config, function (err) { if (err) throw err; }); + await exec.exec(`gpg-connect-agent "RELOADAGENT" /bye`, [], true).then(res => { if (res.stderr != '' && !res.success) { throw new Error(res.stderr);