blobs 0.1.3 → 0.2.0
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 +4 -4
- data/lib/blobs/version.rb +1 -1
- data/lib/blobs.rb +11 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d53539bf655284b05f938f30cd112893ce5627d
|
4
|
+
data.tar.gz: 6ca9959f855c07e07514f123cb71195bfac0ba4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1aea680f816d301d137ab1ed441fe994858391226e791e0760e3cb80186d36542edde54fc796db7ab2f3d494d7a23d9e19336987bc38d5f264cb300e8d6beda5
|
7
|
+
data.tar.gz: 57c9b97e97eb7647fb388c698507e9e199f34ce63b8f5813bc1b565bcd1ec28748735e47826b6cb708ae2e183c58104c6d0e579c20ad55bf9310d0926cc8038e
|
data/lib/blobs/version.rb
CHANGED
data/lib/blobs.rb
CHANGED
@@ -5,6 +5,9 @@ require 'base64'
|
|
5
5
|
require 'securerandom'
|
6
6
|
require 'cgi'
|
7
7
|
|
8
|
+
ENV['BLOB_STORE_API_BASE_URL'] = 'http://localhost:9000'
|
9
|
+
ENV['MASTER_ACCESS_TOKEN'] = '6CU3xfUOtvvVBRPPOe5ShlCOAZ0Ht5k9'
|
10
|
+
|
8
11
|
module Blobs
|
9
12
|
DEBUG = false
|
10
13
|
|
@@ -110,6 +113,10 @@ module Blobs
|
|
110
113
|
decipher.update(Base64.decode64(enc_str).strip) + decipher.final
|
111
114
|
end
|
112
115
|
|
116
|
+
def user_token
|
117
|
+
Base64.decode64(self.current_user['userToken'])
|
118
|
+
end
|
119
|
+
|
113
120
|
def encryption_key
|
114
121
|
return @encryption_key if @encryption_key
|
115
122
|
|
@@ -118,8 +125,8 @@ module Blobs
|
|
118
125
|
if File.file?(key_file)
|
119
126
|
enc_str = File.read(key_file)
|
120
127
|
cipher.decrypt
|
121
|
-
cipher.key =
|
122
|
-
if (json_str = cipher.update(Base64.
|
128
|
+
cipher.key = user_token
|
129
|
+
if (json_str = cipher.update(Base64.strict_decode64(enc_str).strip) + cipher.final)
|
123
130
|
json = JSON.parse(json_str)
|
124
131
|
if json['key'] and json['iv']
|
125
132
|
@iv = Base64.decode64(json['iv']).strip
|
@@ -137,8 +144,8 @@ module Blobs
|
|
137
144
|
key_file_json = { key: Base64.encode64(@encryption_key).strip, iv: Base64.encode64(@iv).strip }
|
138
145
|
File.open(key_file,"w") do |f|
|
139
146
|
cipher.encrypt
|
140
|
-
cipher.key =
|
141
|
-
enc_json = Base64.
|
147
|
+
cipher.key = user_token
|
148
|
+
enc_json = Base64.strict_encode64(cipher.update(key_file_json.to_json) + cipher.final).strip
|
142
149
|
f.write(enc_json)
|
143
150
|
end
|
144
151
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blobs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oliver Kiessler
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|