Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

yaml-crypt

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yaml-crypt - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

.travis.yml

6

bin/yaml-crypt-cli.js

@@ -233,3 +233,3 @@ #!/usr/bin/env node

for (const file of args.file) {
editFile(file, keys, args);
editFile(file, keys, args, config);
}

@@ -417,3 +417,3 @@ } else if (args.file.length) {

function editFile(file, keys, args) {
function editFile(file, keys, args, config) {
let content;

@@ -432,3 +432,3 @@ try {

const editor = process.env['EDITOR'] || 'vim';
const editor = config['editor'] || process.env['EDITOR'] || 'vim';

@@ -435,0 +435,0 @@ const opts = { 'base64': args.base64 };

{
"name": "yaml-crypt",
"version": "0.1.1",
"version": "0.1.2",
"description": "Encrypt and decrypt YAML documents",

@@ -26,9 +26,12 @@ "license": "MIT",

"lint": "eslint .",
"test": "mocha --recursive"
"test": "nyc mocha --timeout=8000 --check-leaks",
"coverage": "nyc report --reporter=text-lcov | coveralls"
},
"devDependencies": {
"chai": "^4.1.2",
"coveralls": "^3.0.0",
"eslint": "^4.10.0",
"mocha": "^4.0.1"
"mocha": "^4.0.1",
"nyc": "^11.3.0"
}
}
# yaml-crypt
[![Build Status](https://img.shields.io/travis/pascalgn/yaml-crypt.svg?style=flat-square)](https://travis-ci.org/pascalgn/yaml-crypt) [![Coverage status](https://img.shields.io/coveralls/github/pascalgn/yaml-crypt.svg?style=flat-square)](https://coveralls.io/github/pascalgn/yaml-crypt) [![NPM version](https://img.shields.io/npm/v/yaml-crypt.svg?style=flat-square)](https://www.npmjs.org/package/yaml-crypt)
Command line utility to encrypt and decrypt YAML documents.

@@ -9,7 +11,12 @@

$ yarn global add yaml-crypt
$ yaml-crypt --help
You can also install the package locally:
$ mkdir yaml-crypt && cd yaml-crypt
$ yarn init --yes
$ yarn add yaml-crypt
$ ./node_modules/yaml-crypt/bin/yaml-crypt.js --help
$ ./node_modules/.bin/yaml-crypt --help
You can also install the package globally: `yarn global add yaml-crypt`
## Usage

@@ -16,0 +23,0 @@

@@ -37,2 +37,7 @@ const fs = require('fs');

it('should throw an error when passing directory without --dir', () => {
const out = new stream.Writable();
expect(() => yamlcryptcli.run(['.'], {}, { 'stdout': out })).to.throw();
});
it('should encrypt the given YAML file', () => {

@@ -62,5 +67,25 @@ const keyFile = tmp.fileSync();

it('should decrypt the given input', () => {
const config = {
'keys': [
{ 'key': 'aehae5Ui0Eechaeghau9Yoh9jufiep7H' }
]
};
const options = {
'stdin': fs.readFileSync('./test/test-2.yaml-crypt'),
'stdout': new Out()
};
yamlcryptcli.run(['-d'], config, options);
const expected = fs.readFileSync('./test/test-2.yaml').toString();
expect(options.stdout.str).to.equal(expected);
});
it('should encrypt the whole input when using --raw', () => {
const keyFile = tmp.fileSync();
fs.writeSync(keyFile.fd, 'aehae5Ui0Eechaeghau9Yoh9jufiep7H');
const config = {
'keys': [
{ 'file': keyFile.name }
]
};
const options = {

@@ -70,6 +95,20 @@ 'stdin': 'Hello, world!',

};
yamlcryptcli.run(['-e', '-k', keyFile.name, '--raw'], {}, options);
yamlcryptcli.run(['-e', '--raw'], config, options);
const expected = 'gAAAAAAAAAABAAECAwQFBgcICQoLDA0OD7nQ_JQsjDx78n7mQ9bW3T-rgiTN7WX3Uq66EDA0qxZDNQppXL6WaOAIW4x8ElmcRg==\n';
expect(options.stdout.str).to.equal(expected);
});
it('should return the same YAML file when using --edit and not changing anything', () => {
const keyFile = tmp.fileSync();
fs.writeSync(keyFile.fd, 'aehae5Ui0Eechaeghau9Yoh9jufiep7H');
const input = tmp.fileSync({ 'postfix': '.yaml-crypt' });
fs.copyFileSync('./test/test-2.yaml-crypt', input.name);
yamlcryptcli.run(['-k', keyFile.name, '--edit', input.name], { 'editor': 'touch' }, {});
const output = fs.readFileSync(input.name);
const expected = fs.readFileSync('./test/test-2.yaml-crypt');
expect(output.toString('utf8')).to.equal(expected.toString('utf8'));
});
});

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc