ncypher 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b65ff999987a0b7d414107d2910d0e00d5f206fd
4
- data.tar.gz: c82bced9cc0630a9700162fda252abe17922fee3
3
+ metadata.gz: cfd1b3326757bdf0d4c6e574244fef35590c0e82
4
+ data.tar.gz: 256719f1a6f1ae607a368f53f409a1b6c006f4ca
5
5
  SHA512:
6
- metadata.gz: 48e16e07449f59be41db2260df232003fd7d527dba43fca21972d8ed6716e4b7810813eb66a47c64b195820b90822f59351a304e90a3594510d2fec05fbf0b39
7
- data.tar.gz: 7bf1a6aa712ab2c6425d5b240dc9ac344f071ad3b86dd79c1be9de083a7dd3eae0e0c00eddb6b85fb911244181a46b884e23ab6a12ab893fc6618379946ff27c
6
+ metadata.gz: f75236a2af542fa8846200cc32bcd38e84fde0e72f8be468d41d1b03900b19f85795646dce6934a10e903877a1a86c09691aaf5993f39aadd88b799d7854de1e
7
+ data.tar.gz: ae27d9edee23c8ca7f38f69bd9b392f36fa8318fe14ad063a93d5756c5cda0467f9238da36c97fe7e85173223f5c8daecf5c74facdbd008e55593a0d564e3a2a
data/lib/ncypher.rb CHANGED
@@ -8,7 +8,8 @@ module Ncypher
8
8
 
9
9
  class Ncypher
10
10
 
11
- def initialize(key_filename: '.ncypher_key')
11
+ def initialize(key_filename: '.ncypher_key', key: nil)
12
+ @key = key ? Base64.strict_decode64(key.strip) : nil
12
13
  @key_filename = key_filename
13
14
  end
14
15
 
@@ -26,9 +27,11 @@ module Ncypher
26
27
  end
27
28
 
28
29
  def key
29
- saved_key = ENV['NCYPHER_KEY'] || find_keyfile
30
- abort "Can't find .ncypher_key file or NCYPHER_KEY env variable" if saved_key.nil?
31
- Base64.strict_decode64(saved_key.strip)
30
+ @key ||= begin
31
+ saved_key = ENV['NCYPHER_KEY'] || find_keyfile
32
+ abort "Can't find .ncypher_key file or NCYPHER_KEY env variable" if saved_key.nil?
33
+ Base64.strict_decode64(saved_key.strip)
34
+ end
32
35
  end
33
36
 
34
37
  def key_b64
@@ -1,3 +1,3 @@
1
1
  module Ncypher
2
- VERSION = "0.6.1"
2
+ VERSION = "0.6.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ncypher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Hagege
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-24 00:00:00.000000000 Z
11
+ date: 2017-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -121,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
121
  version: '0'
122
122
  requirements: []
123
123
  rubyforge_project:
124
- rubygems_version: 2.4.6
124
+ rubygems_version: 2.6.13
125
125
  signing_key:
126
126
  specification_version: 4
127
127
  summary: Ncypher lets you encrypt/decrypt credentials in a safe and transparent way