ncipher 0.3.3 → 0.3.4
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 +8 -8
- data/exe/ncipher +1 -1
- data/lib/ncipher.rb +10 -2
- data/lib/ncipher/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OTNmYWU4NWZkZWZlZGJkYzNkMTUyODVmZDBlMjFlYjM4ODc0NmJkYw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MGU2MDE2Mjg0NWE3MThjNzllM2RiOTFiZTdkMmVlMTM0ODFlZTdmMw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NDhkYjIxZGFkMWM4MTA2NjExZDMxMGZiZGJjYjBhYTQ1MDJiM2I3ZTcyMTlh
|
10
|
+
N2FkNTM1ZjZmNWExM2FkNWRiODNjOTFjMDlhZmZiMzYxZTg2NzEwZDljNmIz
|
11
|
+
MWEwZTFmYTE1M2Y3ZjkyNTU3ZjE0ZGNiYmIyNTg3MmMxM2RlZmY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NDE5YzZjYzJkNDZhMDViNmZhYjU1YWNjZDE1ZGQ0MmYzMTk4ZGUyNjkxZjU0
|
14
|
+
MzkwNWQxYTI1YzcyMjgzZTYyZWM2OTI2YTQ1ZmU0ZmE5M2RlMzNiODY3ZmNm
|
15
|
+
NWU1Y2YxMGFmYTRlMWY1NjI5Yzk2NjRkYjUzOWMxMDdjY2U4NmI=
|
data/exe/ncipher
CHANGED
@@ -17,7 +17,7 @@ case cmd
|
|
17
17
|
when "generate_key"
|
18
18
|
puts Ncipher::Ncipher.new.generate_key
|
19
19
|
when "key"
|
20
|
-
puts
|
20
|
+
puts Ncipher::Ncipher.new.key_b64
|
21
21
|
when "encrypt"
|
22
22
|
if text = ARGV.shift
|
23
23
|
puts Ncipher::Ncipher.new.encrypt(text)
|
data/lib/ncipher.rb
CHANGED
@@ -13,7 +13,7 @@ module Ncipher
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def decrypt(ciphertext_b64)
|
16
|
-
box.decrypt(Base64.strict_decode64(ciphertext_b64))
|
16
|
+
box.decrypt(Base64.strict_decode64(ciphertext_b64.strip))
|
17
17
|
end
|
18
18
|
|
19
19
|
def encrypt(plaintext)
|
@@ -28,7 +28,11 @@ module Ncipher
|
|
28
28
|
def key
|
29
29
|
saved_key = ENV['NCIPHER_KEY'] || find_keyfile
|
30
30
|
abort "Can't find .ncipher_key file or NCIPHER_KEY env variable" if saved_key.nil?
|
31
|
-
Base64.
|
31
|
+
Base64.strict_decode64(saved_key.strip)
|
32
|
+
end
|
33
|
+
|
34
|
+
def key_b64
|
35
|
+
Base64.strict_encode64 key
|
32
36
|
end
|
33
37
|
|
34
38
|
def self.decrypt(cyphertext_b64)
|
@@ -47,6 +51,10 @@ module Ncipher
|
|
47
51
|
Ncipher.new.key
|
48
52
|
end
|
49
53
|
|
54
|
+
def self.key_b64
|
55
|
+
Ncipher.new.key_b64
|
56
|
+
end
|
57
|
+
|
50
58
|
private
|
51
59
|
def box
|
52
60
|
RbNaCl::SimpleBox.from_secret_key(key)
|
data/lib/ncipher/version.rb
CHANGED