lolitado 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/box.rb +29 -0
- data/lib/db.rb +1 -1
- data/lib/lolitado.rb +1 -0
- data/lib/version.rb +1 -1
- metadata +16 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c680b69ccfdd2b65f17e34620494d141e94241a9ffbf7b475baf370a323eaa4
|
4
|
+
data.tar.gz: 7f7b4b404ae6d9d8bc6d54c612216f1d125caf3b7c4fd65ad29410c50c61a2da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d522c333a7c845b3bf34f5bb24d331fea0b51cc57d54e2a697619ad98abe682672678a3b0181d0eef5a344d6daf580e0dbdb41216b65c25fdd413c1f27f68744
|
7
|
+
data.tar.gz: edb4a324e9a147514005ee259f50f1a2b25187e6988a5e5824e2c108cb03be32f4d3ad10b57bbaa3a1106bda3d1bcb951d03265114d8bb9832b2791f51bfde07
|
data/lib/box.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'rbnacl'
|
2
|
+
require 'base64'
|
3
|
+
|
4
|
+
class Box
|
5
|
+
|
6
|
+
def initialize key
|
7
|
+
key_env = ENV[key]
|
8
|
+
if key_env.nil?
|
9
|
+
puts "There's no environment variable #{key}..."
|
10
|
+
return
|
11
|
+
end
|
12
|
+
key = Base64.decode64(key_env)
|
13
|
+
@box = RbNaCl::SimpleBox.from_secret_key(key)
|
14
|
+
end
|
15
|
+
|
16
|
+
def file_encrypt file
|
17
|
+
plaintext = File.read(file)
|
18
|
+
ciphertext = @box.encrypt(plaintext)
|
19
|
+
enc_file = file + '.enc'
|
20
|
+
File.write(enc_file, Base64.encode64(ciphertext))
|
21
|
+
end
|
22
|
+
|
23
|
+
def file_decrypt file
|
24
|
+
ciphertext = File.read(file)
|
25
|
+
plaintext = @box.decrypt(Base64.decode64(ciphertext))
|
26
|
+
plain_file = file[0..-5]
|
27
|
+
File.write(plain_file, plaintext)
|
28
|
+
end
|
29
|
+
end
|
data/lib/db.rb
CHANGED
data/lib/lolitado.rb
CHANGED
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lolitado
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dolores Zhang
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0.14'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rbnacl-libsodium
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.0.10
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.0.10
|
69
83
|
description: Lolitado DSL that works with Watir
|
70
84
|
email:
|
71
85
|
- 379808610@qq.com
|
@@ -74,6 +88,7 @@ extensions: []
|
|
74
88
|
extra_rdoc_files: []
|
75
89
|
files:
|
76
90
|
- lib/accessors.rb
|
91
|
+
- lib/box.rb
|
77
92
|
- lib/db.rb
|
78
93
|
- lib/lolitado.rb
|
79
94
|
- lib/pool.rb
|