eyaml 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile.lock +1 -1
- data/bin/publish +6 -0
- data/lib/eyaml.rb +4 -5
- data/lib/eyaml/cli.rb +3 -6
- data/lib/eyaml/encryption_manager.rb +2 -2
- data/lib/eyaml/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e61459ec54369ee49ca605cefb648f5cc8851a5d39a06ce8c9178a3d70efdf8
|
4
|
+
data.tar.gz: 45c22149cb9105febb7871944e94ed662d407e3cf043132bc0e486b1e95bda82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d348c4d42a142d95a8bc4017fbdf083b8254374f47e60c312af21b9790b92d8a06feb3dc43473e14cdcd79d7b2518c5b2a1165ac40918ca58ce00bd5430e5d2
|
7
|
+
data.tar.gz: 57319ccb5fff1a29e49624076da3ca9a058fecfb87b47e137e006e89616bda4599d613cdb6b693421940b0483526cc7d528d25b83ea6f31557dbbbe1f164f123
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
data/bin/publish
ADDED
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
|
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
|
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
|
36
|
+
def encrypt_file_in_place(file_path)
|
38
37
|
plaindata = YAML.load_file(file_path)
|
39
|
-
cipherdata = encrypt(plaindata
|
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
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.
|
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
|