uhide 0.0.21 → 0.0.26

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/uhide +0 -1
  3. data/lib/uhide/main.rb +29 -26
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ae69cf865742e93673851fa04f7fca43fec7e2af753824fd5d31ff0cfb69d097
4
- data.tar.gz: 1cd33679f137c290c72a13bdf0ab654b1218d8f3d5dfbfa373494269e44184af
3
+ metadata.gz: a4a06d744fe8a6c1f74e8fd848e74af96ba37d5c377ee3d6b33599f0d38d30c1
4
+ data.tar.gz: 94cf1b71fbe3255fa896e25a53fd474e0bdb0e69677a6ef644944972cc452f0a
5
5
  SHA512:
6
- metadata.gz: b2abac04d66bc299574ed33c1327f8f79fb808054d801e6417120a63e7513bd4a26951415c2a020d654f9b1bd6dad0b9d4c80565e6c4e93b5263462e1fcbe4f4
7
- data.tar.gz: df68ceee9ccacfe9247809376b3ecce3bb9dd4ad6a4cb38b67cbd4c6008e4e9aeb0daa25ceb8266a4df83b5778dac3b2a95b49f5c0cda2c6b761dcef3aaf9be6
6
+ metadata.gz: 8d6f4416ab7af95df3e132b6651408be6d684847fc2b3740d44e89f28ca717959af688c8043c33782e4fe2dc2142d41121da0bd7f05bb93da47d8bf396fad2da
7
+ data.tar.gz: fb0c709b806ce2cef94508141e21dd062c845db86886657ea63e7a4572431bc962126c7d4f3873ec76cf677d594c28930b49dcaa41697e1362ed4ba99bac8d19
data/bin/uhide CHANGED
@@ -20,7 +20,6 @@ Get Started:
20
20
  Commands and Optional Arguments:
21
21
  - get [key-name]
22
22
  - set [key-name] [key-value]
23
-
24
23
  HELP
25
24
  exit!
26
25
  end
data/lib/uhide/main.rb CHANGED
@@ -2,56 +2,57 @@ $☔ = " ☔ > "
2
2
  $🔑 = " 🔑 > "
3
3
  $🧂 = -> { 🗃️ '🧂', SecureRandom.random_bytes }
4
4
  $📏 = -> { 🗃️ '📏', ActiveSupport::MessageEncryptor.key_len }
5
- INVALID_KEY = 'invalid key'.colorize(:red)
6
- $cache = {}
7
-
8
- def password?
9
- 🧼 STDIN.noecho(&:gets)
10
- end
5
+ INVALID_KEY = 'invalid key'.colorize(:magenta)
6
+ UNSUPPORTED_👾 = 'unsupported'.colorize(:magenta) + ' 👾'
7
+ $🗄️ = {}
11
8
 
12
9
  def 🚽
13
10
  print "\r"
14
11
  $stdout.flush
15
12
  end
16
13
 
14
+ def 🧼 🗑️
15
+ 🗑️.chomp
16
+ end
17
+
17
18
  def ❓ 🔑, simple: true
18
19
  print 🔑
19
- password = password?
20
- $password = password if simple
20
+ ✍️ = 🧼 STDIN.noecho(&:gets)
21
+ $✍️ = ✍️ if simple
21
22
  🚽
22
- return password
23
- end
24
-
25
- def 🧼 🗑️
26
- 🗑️.chomp
23
+ return ✍️
27
24
  end
28
25
 
29
26
  def 🔓 🏷️: nil
30
27
  if 🏷️.nil?
31
- puts $cache['ddllv']
28
+ puts $🗄️['ddllv']
32
29
  else
33
- puts $cache['ddllv'][🏷️]
30
+ puts $🗄️['ddllv'][🏷️]
34
31
  end
35
32
 
36
33
  📕 = File.read './🧂'
37
34
  if 📕.empty?
38
35
  🔀 = SecureRandom.random_bytes $📏.call
39
36
  File.write './🧂', Marshal.dump(🔀)
40
- return $cache['🧂'] = 🔀
37
+ return $🗄️['🧂'] = 🔀
41
38
  else
42
- return $cache['🧂'] = Marshal.load(File.read './🧂')
39
+ return $🗄️['🧂'] = Marshal.load(File.read './🧂')
43
40
  end
44
41
 
45
42
  end
46
43
 
47
44
  def 🔒 🏷️, 💎
48
- $cache['ddllv'][🏷️] = 💎
45
+ $🗄️['ddllv'][🏷️] = 💎
49
46
  💾
50
47
  end
51
48
 
52
49
  def 🤖 🗣️
53
50
  👾, 🏷️, 💎 = 🗣️.split
54
51
 
52
+ if 👾.nil?
53
+ return
54
+ end
55
+
55
56
  case 👾.to_sym
56
57
  when :get
57
58
  if 🏷️
@@ -67,23 +68,25 @@ def 🤖 🗣️
67
68
  exit!
68
69
 
69
70
  when :reset
70
- if ❓($🔑, simple: false) == $password
71
+ if ❓($🔑, simple: false) == $✍️
71
72
  ['ddllv', '🧂', '📏'].each_entry{ |item| File.delete "./#{item}" }
72
73
  exit!
73
74
  else
74
75
  puts INVALID_KEY
75
76
  end
76
77
 
78
+ else
79
+ puts UNSUPPORTED_👾
77
80
  end
78
81
 
79
82
  end
80
83
 
81
84
  def 💾
82
85
  ⚛️ = ActiveSupport::MessageEncryptor.new(
83
- ActiveSupport::KeyGenerator.new($password).generate_key($🧂.call, $📏.call)
86
+ ActiveSupport::KeyGenerator.new($✍️).generate_key($🧂.call, $📏.call)
84
87
  )
85
88
 
86
- was_bootstrapped = !(not $cache['ddllv'])
89
+ was_bootstrapped = !(not $🗄️['ddllv'])
87
90
  📖 = 🗃️ 'ddllv', {}, ⚛️: ⚛️
88
91
  📀 'ddllv', 📖, ⚛️: ⚛️ if was_bootstrapped
89
92
  end
@@ -100,15 +103,15 @@ def 📀 🗂️, 📖, ⚛️: false
100
103
  return 📕
101
104
  end
102
105
 
103
- def 🗃️ 🗂️, 🔀, ⚛️: false
104
- if $cache[🗂️]
105
- return $cache[🗂️]
106
+ def 🗃️ 🗂️, 💎, ⚛️: false
107
+ if $🗄️[🗂️]
108
+ return $🗄️[🗂️]
106
109
  end
107
110
 
108
111
  begin
109
112
  📕 = File.read "./#{🗂️}"
110
113
  rescue Errno::ENOENT
111
- 📕 = 📀 🗂️, 🔀, ⚛️: ⚛️
114
+ 📕 = 📀 🗂️, 💎, ⚛️: ⚛️
112
115
  end
113
116
 
114
117
  if not 📕.empty?
@@ -128,7 +131,7 @@ def 🗃️ 🗂️, 🔀, ⚛️: false
128
131
 
129
132
  end
130
133
 
131
- return $cache[🗂️] = 📖
134
+ return $🗄️[🗂️] = 📖
132
135
  end
133
136
 
134
137
  class Uhide::Main
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uhide
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.21
4
+ version: 0.0.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Keen