inline_encryption 1.0.3 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +2 -1
- data/.travis.yml +3 -3
- data/CHANGELOG.md +14 -0
- data/Gemfile +11 -5
- data/inline_encryption.gemspec +3 -2
- data/lib/inline_encryption/base.rb +2 -0
- data/lib/inline_encryption/config.rb +2 -0
- data/lib/inline_encryption/version.rb +1 -1
- data/spec/inline_encryption/base_spec.rb +8 -8
- data/spec/inline_encryption/cli_spec.rb +2 -2
- data/spec/inline_encryption/config_spec.rb +8 -8
- data/spec/inline_encryption_spec.rb +1 -1
- data/spec/spec_helper.rb +6 -15
- metadata +30 -22
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3945645882492ab5d98521dcf24460df516bd5e1
|
4
|
+
data.tar.gz: b2343ccfb92b8749e1092fa2c48d48a31f9694d6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b0c1c77c4a8da69d8ce2eb0baf00770a1220fc3ab87caf6e9836a5dd275bda223aaf6a8522364672864d47fc445876a32526a0bf7b85991f47b602cd320adafb
|
7
|
+
data.tar.gz: bbe79c8df90b2a82e85a3a87f6f6dfd3ca2222cd1bebfbb5dec3ba9c268e21a3980cf66575d4845f73e53a3387e70146cd68146b12fa40f8e8734835fc862394
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# 1.0.5
|
2
|
+
- updated gem groups, updated travis to run without debugger and development groups
|
3
|
+
# 1.0.4
|
4
|
+
- update version of Bundler to floor 1.7
|
5
|
+
- swapped byebug for debugger
|
6
|
+
- fixed a few style violations (single/double quotes)
|
7
|
+
- added Thor to runtime dependencies
|
8
|
+
- added explicit require for hashie/dash and hashie/extensions/dash/indifferent_access in config.rb
|
9
|
+
I think this is probably unnecessary but was getting unresolved name errors in some rubies
|
10
|
+
- added explicit require for base64 in base.rb ([Issue #2](https://github.com/rubyisbeautiful/inline_encryption/issues/2))
|
11
|
+
- drop 1.9.x and 2.0.x in travis testing
|
12
|
+
- updated to rspec 3 syntax
|
13
|
+
|
14
|
+
# 1.0.3
|
data/Gemfile
CHANGED
@@ -2,19 +2,25 @@ source 'https://rubygems.org'
|
|
2
2
|
|
3
3
|
gemspec
|
4
4
|
|
5
|
-
gem 'bundler', '~> 1.
|
5
|
+
gem 'bundler', '~> 1.7'
|
6
6
|
gem 'hashie'
|
7
7
|
gem 'i18n'
|
8
8
|
gem 'thor'
|
9
9
|
|
10
|
-
group :
|
11
|
-
gem '
|
10
|
+
group :debugger do
|
11
|
+
gem 'byebug'
|
12
|
+
end
|
13
|
+
|
14
|
+
group :development do
|
12
15
|
gem 'guard'
|
13
16
|
gem 'guard-rspec'
|
14
|
-
|
17
|
+
end
|
18
|
+
|
19
|
+
group :development, :test do
|
15
20
|
gem 'rake'
|
16
21
|
gem 'redcarpet'
|
17
22
|
gem 'rspec'
|
18
23
|
gem 'simplecov', require: false
|
19
24
|
gem 'yard'
|
20
|
-
end
|
25
|
+
end
|
26
|
+
|
data/inline_encryption.gemspec
CHANGED
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
5
|
require 'inline_encryption/version'
|
6
6
|
|
7
7
|
Gem::Specification.new do |spec|
|
8
|
-
spec.name =
|
8
|
+
spec.name = 'inline_encryption'
|
9
9
|
spec.version = InlineEncryption::VERSION
|
10
10
|
spec.authors = ['rubyisbeautiful']
|
11
11
|
spec.email = ['YmNwdGF5bG9yQGdtYWlsLmNvbQ==\n'].collect{ |foo| Base64.decode64(foo) }
|
@@ -17,13 +17,14 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.files = `git ls-files`.split($/)
|
18
18
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
-
spec.require_paths = [
|
20
|
+
spec.require_paths = ['lib']
|
21
21
|
spec.required_ruby_version = '>= 1.9.3'
|
22
22
|
|
23
23
|
spec.executables = ['inline_encryption']
|
24
24
|
|
25
25
|
spec.add_runtime_dependency 'hashie'
|
26
26
|
spec.add_runtime_dependency 'i18n'
|
27
|
+
spec.add_runtime_dependency 'thor'
|
27
28
|
|
28
29
|
|
29
30
|
end
|
@@ -16,17 +16,17 @@ describe InlineEncryption::Base do
|
|
16
16
|
let(:str){ 'foo' }
|
17
17
|
|
18
18
|
it 'should encrypt' do
|
19
|
-
InlineEncryption.encrypt(str).
|
19
|
+
expect(InlineEncryption.encrypt(str)).to eq(Base64.encode64(@default_key.private_encrypt(str)))
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'should fail to encrpyt and return the target' do
|
23
23
|
InlineEncryption.config[:key] = OpenSSL::PKey::RSA.generate(32)
|
24
|
-
InlineEncryption.encrypt(str*2).
|
24
|
+
expect(InlineEncryption.encrypt(str*2)).to eq(str*2)
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'should fail to encrypt and return the fail_text' do
|
28
28
|
InlineEncryption.config[:key] = OpenSSL::PKey::RSA.generate(32)
|
29
|
-
InlineEncryption.encrypt(str*2, 'chunky').
|
29
|
+
expect(InlineEncryption.encrypt(str*2, 'chunky')).to eq('chunky')
|
30
30
|
end
|
31
31
|
|
32
32
|
end
|
@@ -35,7 +35,7 @@ describe InlineEncryption::Base do
|
|
35
35
|
let(:str){ 'foo' }
|
36
36
|
|
37
37
|
it 'should encrypt' do
|
38
|
-
InlineEncryption.encrypt!(str).
|
38
|
+
expect(InlineEncryption.encrypt!(str)).to eq(Base64.encode64(@default_key.private_encrypt(str)))
|
39
39
|
end
|
40
40
|
|
41
41
|
it 'should fail to encrpyt and raise' do
|
@@ -52,17 +52,17 @@ describe InlineEncryption::Base do
|
|
52
52
|
end
|
53
53
|
|
54
54
|
it 'should decrypt' do
|
55
|
-
InlineEncryption.decrypt(@str).
|
55
|
+
expect(InlineEncryption.decrypt(@str)).to eq('chunky')
|
56
56
|
end
|
57
57
|
|
58
58
|
it 'should fail to decrypt and return the target' do
|
59
59
|
InlineEncryption.config[:key] = OpenSSL::PKey::RSA.generate(32)
|
60
|
-
InlineEncryption.decrypt(@str).
|
60
|
+
expect(InlineEncryption.decrypt(@str)).to eq(@str)
|
61
61
|
end
|
62
62
|
|
63
63
|
it 'should fail to decrypt and return the fail_text' do
|
64
64
|
InlineEncryption.config[:key] = OpenSSL::PKey::RSA.generate(32)
|
65
|
-
InlineEncryption.decrypt(@str, 'chunky').
|
65
|
+
expect(InlineEncryption.decrypt(@str, 'chunky')).to eq('chunky')
|
66
66
|
end
|
67
67
|
|
68
68
|
end
|
@@ -74,7 +74,7 @@ describe InlineEncryption::Base do
|
|
74
74
|
end
|
75
75
|
|
76
76
|
it 'should decrypt' do
|
77
|
-
InlineEncryption.decrypt!(@str).
|
77
|
+
expect(InlineEncryption.decrypt!(@str)).to eq('chunky')
|
78
78
|
end
|
79
79
|
|
80
80
|
it 'should fail to decrpyt and raise' do
|
@@ -18,7 +18,7 @@ describe InlineEncryption::CLI do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'should encrypt' do
|
21
|
-
InlineEncryption.
|
21
|
+
expect(InlineEncryption).to receive(:encrypt).with('hello')
|
22
22
|
|
23
23
|
subject.encrypt('hello')
|
24
24
|
end
|
@@ -26,7 +26,7 @@ describe InlineEncryption::CLI do
|
|
26
26
|
it 'should require a file if passed' do
|
27
27
|
subject = InlineEncryption::CLI.new(['foo'], [ '-r', 'foo.rb' ], {})
|
28
28
|
|
29
|
-
subject.
|
29
|
+
expect(subject).to receive(:load_environment).with('foo.rb')
|
30
30
|
|
31
31
|
subject.encrypt('foo')
|
32
32
|
end
|
@@ -23,14 +23,14 @@ describe InlineEncryption::Config do
|
|
23
23
|
it 'should return nil if key is NilClass' do
|
24
24
|
subject[:key] = nil
|
25
25
|
|
26
|
-
subject.real_key.
|
26
|
+
expect(subject.real_key).to be_nil
|
27
27
|
end
|
28
28
|
|
29
29
|
it 'should return the key value if key is an OpenSSL::PKey::RSA key' do
|
30
30
|
key = OpenSSL::PKey::RSA.new(128)
|
31
31
|
subject[:key] = key
|
32
32
|
|
33
|
-
subject.real_key.
|
33
|
+
expect(subject.real_key).to eq(key)
|
34
34
|
end
|
35
35
|
|
36
36
|
it 'should return an OpenSSL::PKey::RSA key from the given String' do
|
@@ -38,19 +38,19 @@ describe InlineEncryption::Config do
|
|
38
38
|
key = temp_key.to_s
|
39
39
|
subject[:key] = key
|
40
40
|
|
41
|
-
subject.real_key.to_s.
|
42
|
-
subject.real_key.
|
41
|
+
expect(subject.real_key.to_s).to eq(temp_key.to_s)
|
42
|
+
expect(subject.real_key).to be_an_instance_of OpenSSL::PKey::RSA
|
43
43
|
end
|
44
44
|
|
45
45
|
it 'should load the contents of the given file if exists and use as key' do
|
46
46
|
temp_key = OpenSSL::PKey::RSA.generate(32)
|
47
47
|
key = 'foo'
|
48
48
|
subject[:key] = key
|
49
|
-
File.
|
50
|
-
File.
|
49
|
+
allow(File).to receive(:exists?).with('foo').and_return(true)
|
50
|
+
allow(File).to receive(:read).with('foo').and_return(temp_key.to_s)
|
51
51
|
|
52
|
-
subject.real_key.to_s.
|
53
|
-
subject.real_key.
|
52
|
+
expect(subject.real_key.to_s).to eq(temp_key.to_s)
|
53
|
+
expect(subject.real_key).to be_an_instance_of OpenSSL::PKey::RSA
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
data/spec/spec_helper.rb
CHANGED
@@ -1,20 +1,11 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
require 'spork'
|
3
|
-
#uncomment the following line to use spork with the debugger
|
4
|
-
#require 'spork/ext/ruby-debug'
|
5
2
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
add_filter "/spec/"
|
10
|
-
end
|
11
|
-
|
12
|
-
require 'rspec'
|
13
|
-
|
14
|
-
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
15
|
-
require 'inline_encryption'
|
3
|
+
require 'simplecov'
|
4
|
+
SimpleCov.start do
|
5
|
+
add_filter "/spec/"
|
16
6
|
end
|
17
7
|
|
18
|
-
|
8
|
+
require 'rspec'
|
19
9
|
|
20
|
-
|
10
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
11
|
+
require 'inline_encryption'
|
metadata
CHANGED
@@ -1,59 +1,68 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inline_encryption
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.5
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- rubyisbeautiful
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2016-06-16 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: hashie
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: i18n
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ">="
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - ">="
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
|
-
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: thor
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: " A simple encryption tool based on common convention "
|
47
56
|
email:
|
48
|
-
-
|
49
|
-
YmNwdGF5bG9yQGdtYWlsLmNvbQ==
|
57
|
+
- bcptaylor@gmail.com
|
50
58
|
executables:
|
51
59
|
- inline_encryption
|
52
60
|
extensions: []
|
53
61
|
extra_rdoc_files: []
|
54
62
|
files:
|
55
|
-
- .gitignore
|
56
|
-
- .travis.yml
|
63
|
+
- ".gitignore"
|
64
|
+
- ".travis.yml"
|
65
|
+
- CHANGELOG.md
|
57
66
|
- Gemfile
|
58
67
|
- Guardfile
|
59
68
|
- LICENSE.txt
|
@@ -126,27 +135,26 @@ files:
|
|
126
135
|
homepage: http://github.com/rubyisbeautiful/inline_encryption
|
127
136
|
licenses:
|
128
137
|
- MIT
|
138
|
+
metadata: {}
|
129
139
|
post_install_message:
|
130
140
|
rdoc_options: []
|
131
141
|
require_paths:
|
132
142
|
- lib
|
133
143
|
required_ruby_version: !ruby/object:Gem::Requirement
|
134
|
-
none: false
|
135
144
|
requirements:
|
136
|
-
- -
|
145
|
+
- - ">="
|
137
146
|
- !ruby/object:Gem::Version
|
138
147
|
version: 1.9.3
|
139
148
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
|
-
none: false
|
141
149
|
requirements:
|
142
|
-
- -
|
150
|
+
- - ">="
|
143
151
|
- !ruby/object:Gem::Version
|
144
152
|
version: '0'
|
145
153
|
requirements: []
|
146
154
|
rubyforge_project:
|
147
|
-
rubygems_version:
|
155
|
+
rubygems_version: 2.2.2
|
148
156
|
signing_key:
|
149
|
-
specification_version:
|
157
|
+
specification_version: 4
|
150
158
|
summary: A simple encryption tool based on common convention and designed as a drop
|
151
159
|
in for Stringish things
|
152
160
|
test_files:
|