eyaml 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e589d4929a268cf0c2d783b52e67da11a5ddea2a471f826f5d440de02b39f56e
4
- data.tar.gz: 1f94b57be40ec52893b62aea8f16ee0a81a997b69672852c3430553e2aa24f5f
3
+ metadata.gz: 2e61459ec54369ee49ca605cefb648f5cc8851a5d39a06ce8c9178a3d70efdf8
4
+ data.tar.gz: 45c22149cb9105febb7871944e94ed662d407e3cf043132bc0e486b1e95bda82
5
5
  SHA512:
6
- metadata.gz: 6a1ba5c9640edbe938325c02290405c102ba10f7a68f01c7701740944a208cf531abdc95b94f3ed730e9db90ebf89db848eedf6ad45eec7ddf6b39c362b4480f
7
- data.tar.gz: 4e3490d63c5319fa6855a4257fe848663709ecc4e1d54105332f9b2a30352edf0a9221999f58a1a5ba61165721ef0d3627a5c166204a533ac55c6a6c4b6b29c1
6
+ metadata.gz: 2d348c4d42a142d95a8bc4017fbdf083b8254374f47e60c312af21b9790b92d8a06feb3dc43473e14cdcd79d7b2518c5b2a1165ac40918ca58ce00bd5430e5d2
7
+ data.tar.gz: 57319ccb5fff1a29e49624076da3ca9a058fecfb87b47e137e006e89616bda4599d613cdb6b693421940b0483526cc7d528d25b83ea6f31557dbbbe1f164f123
data/.gitignore CHANGED
@@ -9,3 +9,4 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+ *.gem
data/Gemfile.lock CHANGED
@@ -9,7 +9,7 @@ GIT
9
9
  PATH
10
10
  remote: .
11
11
  specs:
12
- eyaml (0.1.0)
12
+ eyaml (0.1.1)
13
13
  rbnacl (~> 7.1)
14
14
  thor (~> 1.1)
15
15
 
data/bin/publish ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ gem build eyaml
6
+ gem push $(ls -t *.gem | head -1)
data/lib/eyaml.rb CHANGED
@@ -26,17 +26,16 @@ module EYAML
26
26
  [public_key, private_key]
27
27
  end
28
28
 
29
- def encrypt(plaindata, keydir: nil)
29
+ def encrypt(plaindata)
30
30
  public_key = load_public_key(plaindata)
31
- private_key = load_private_key_from(public_key: public_key, keydir: keydir)
32
31
 
33
- encryption_manager = EncryptionManager.new(plaindata, public_key, private_key)
32
+ encryption_manager = EncryptionManager.new(plaindata, public_key)
34
33
  encryption_manager.encrypt
35
34
  end
36
35
 
37
- def encrypt_file_in_place(file_path, keydir: nil)
36
+ def encrypt_file_in_place(file_path)
38
37
  plaindata = YAML.load_file(file_path)
39
- cipherdata = encrypt(plaindata, keydir: keydir)
38
+ cipherdata = encrypt(plaindata)
40
39
 
41
40
  eyaml = format_for_file(cipherdata, file_path)
42
41
 
data/lib/eyaml/cli.rb CHANGED
@@ -2,18 +2,13 @@ module EYAML
2
2
  class InvalidFormatError < StandardError; end
3
3
 
4
4
  class CLI < Thor
5
- class_option :keydir, aliases: "-k", type: :string, desc: "Directory containing EYAML keys"
6
-
7
5
  desc "encrypt", "(Re-)encrypt one or more EYAML files"
8
6
  def encrypt(*files)
9
7
  files.each do |file|
10
8
  file_path = Pathname.new(file)
11
9
  next unless file_path.exist?
12
10
 
13
- bytes_written = EYAML.encrypt_file_in_place(
14
- file_path,
15
- keydir: options.fetch(:keydir, nil)
16
- )
11
+ bytes_written = EYAML.encrypt_file_in_place(file_path)
17
12
 
18
13
  puts "Wrote #{bytes_written} bytes to #{file_path}."
19
14
  end
@@ -21,6 +16,7 @@ module EYAML
21
16
 
22
17
  method_option :output, type: :string, desc: "print output to the provided file, rather than stdout", aliases: "-o"
23
18
  method_option :"key-from-stdin", type: :boolean, desc: "read the private key from STDIN", default: false
19
+ method_option :keydir, type: :string, desc: "Directory containing EYAML keys", aliases: "-k"
24
20
  desc "decrypt", "Decrypt an EYAML file"
25
21
  def decrypt(file)
26
22
  file_path = Pathname.new(file)
@@ -48,6 +44,7 @@ module EYAML
48
44
  end
49
45
 
50
46
  method_option :write, type: :boolean, aliases: "-w", desc: "rather than printing both keys, print the public and write the private into the keydir", default: false
47
+ method_option :keydir, type: :string, desc: "Directory containing EYAML keys", aliases: "-k"
51
48
  desc "keygen", "Generate a new EYAML keypair"
52
49
  def keygen
53
50
  public_key, private_key = EYAML.generate_keypair(
@@ -16,10 +16,10 @@ module EYAML
16
16
  end
17
17
  end
18
18
 
19
- def initialize(yaml, public_key, private_key)
19
+ def initialize(yaml, public_key, private_key = nil)
20
20
  @tree = yaml
21
21
  @public_key = EYAML::Util.ensure_binary_encoding(public_key)
22
- @private_key = EYAML::Util.ensure_binary_encoding(private_key)
22
+ @private_key = private_key.nil? ? nil : EYAML::Util.ensure_binary_encoding(private_key)
23
23
  end
24
24
 
25
25
  def decrypt
data/lib/eyaml/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EYAML
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eyaml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emil Stolarsky
@@ -86,6 +86,7 @@ files:
86
86
  - Rakefile
87
87
  - bin/console
88
88
  - bin/eyaml
89
+ - bin/publish
89
90
  - bin/setup
90
91
  - eyaml.gemspec
91
92
  - lib/eyaml.rb