You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

env-sops

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

env-sops - npm Package Compare versions

Comparing version

to
0.0.0-20240306070710

9

bin/env-sops.js
#!/usr/bin/env node
import { join, resolve } from 'path'

@@ -6,5 +7,5 @@ import yargs from 'yargs'

import { decryptWithEnv } from '../lib/decrypt-with-env.js'
import { decryptWithFile } from '../lib/decrypt-with-file.js'
import { encryptWithEnv } from '../lib/encrypt-with-env.js'
import { encryptWithFile } from '../lib/encrypt-with-file.js'
import { decryptWithFile } from '../lib/decrypt-with-file.js'
import { printEncryptInfo } from '../lib/print-info.js'

@@ -43,8 +44,4 @@ import { verifyEnviroment } from '../lib/verify-environment.js'

const destPath = join(resolve(process.cwd(), argv?.destFolder), '.env')
console.info({
srcPath,
destPath
})
if (status.agePrivateKey) {
console.log('decryptWithEnv')
decryptWithEnv(srcPath, destPath)

@@ -51,0 +48,0 @@ } else if (status.sopsAgeKeyFile) {

import { execSync } from "child_process";
import { readFileSync } from "fs";
export const decryptWithEnv = async (srcPath, destPath, SOPS_COMMAND = "sops") => {
try {
console.info(`export SOPS_AGE_KEY="${process?.env?.AGE_PRIVATE_KEY}" && unset SOPS_AGE_KEY_FILE && ${SOPS_COMMAND} --decrypt ${srcPath} > ${destPath}`)
execSync(`export SOPS_AGE_KEY="${process?.env?.AGE_PRIVATE_KEY}" && unset SOPS_AGE_KEY_FILE && ${SOPS_COMMAND} --decrypt ${srcPath} > ${destPath}`);
console.log(`Decrypted file: ${destPath}`, readFileSync(destPath, { encoding: 'utf-8' }));
return true;

@@ -10,0 +7,0 @@ } catch (error) {

{
"name": "env-sops",
"version": "0.0.0-20240306065803",
"version": "0.0.0-20240306070710",
"description": "Package to help encrypt/decrypt ENV files",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.