duse 0.0.6 → 0.0.7
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/.gitignore +3 -0
- data/.travis.yml +12 -1
- data/README.md +169 -22
- data/lib/duse/cli/command.rb +8 -0
- data/lib/duse/cli/secret_get.rb +1 -0
- data/lib/duse/cli/share_with_user.rb +1 -1
- data/lib/duse/client/namespace.rb +2 -2
- data/lib/duse/client/secret.rb +29 -7
- data/lib/duse/version.rb +1 -1
- data/spec/cli/commands/secret_spec.rb +23 -9
- data/spec/client/secret_spec.rb +8 -6
- data/spec/client/user_spec.rb +10 -10
- data/spec/support/mock_api.rb +52 -14
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OGVhZjcyNzI1NmQ0YmJmMjQ5OGYyMjNiNWY0NDhjZmNkZGQwYWRmMQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YWNmOWEyNTA2ZjM5MTIwOWU1YTQ0Yjg3ODMyNDhlMTQwNmFhOWI3Zg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MDcxZTEzZWI4MzUyZDcwYzZkN2I2ZDc0NTE3Njk3OTJjOGI2NTZjNTg1OGNh
|
10
|
+
MzlmYWJhMThjMWNhYzY0N2QyZTNhOTc5MmM0OTBkMzI3NDIwMDQ1ODdjYzZi
|
11
|
+
NTdhZTFjNDg3YjkzMDEzYjI4NDVjOGRkMDBmYmZhNzgxODZlOTE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
M2YyMmZmODhjYTdhNjg4MzgwOWVmZWIyZjdhOTMxMWJlZDkwMmE0ZjFkMDU1
|
14
|
+
MDhmNGUyMTQ3MjlmMGU3YTk4NjQ4MjQxMGE0MDYwOTk1MjJjOTU1ZjYzYWZk
|
15
|
+
ZWYzYWM5NDQ3OGVjYTc0ODlhMzVjY2FhYjE4Zjg1MmMyMmJjZmY=
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
[](http://badge.fury.io/rb/duse)
|
1
2
|
[](https://travis-ci.org/duse-io/duse.rb)
|
2
3
|
[](https://coveralls.io/r/duse-io/duse.rb?branch=master)
|
3
4
|
[](https://codeclimate.com/github/duse-io/duse.rb)
|
@@ -15,14 +16,47 @@ written in ruby.
|
|
15
16
|
|
16
17
|
This implementation was heavily inspired by [travis-ci/travis.rb](https://github.com/travis-ci/travis.rb)
|
17
18
|
|
18
|
-
|
19
|
-
|
19
|
+
Compatibility
|
20
|
+
-------------
|
21
|
+
|
22
|
+
Tested against
|
23
|
+
|
24
|
+
* Ruby MRI
|
25
|
+
* JRuby
|
26
|
+
|
27
|
+
> Hint: Be sure to install the Java Cryptography Extension (JCE) Unlimited
|
28
|
+
> Strength Jurisdiction Policy Files for this to work on the JVM
|
29
|
+
|
30
|
+
CLI
|
31
|
+
===
|
20
32
|
|
21
33
|
To install the client simply install its ruby gem.
|
22
34
|
|
23
35
|
$ gem install duse
|
24
36
|
|
25
|
-
|
37
|
+
* [help](#help)
|
38
|
+
* [config](#config)
|
39
|
+
* [login](#login)
|
40
|
+
* [register](#register)
|
41
|
+
* [secret](#secret)
|
42
|
+
* [add](#add)
|
43
|
+
* [list](#list)
|
44
|
+
* [get](#get)
|
45
|
+
* [remove](#remove)
|
46
|
+
* [account](#account)
|
47
|
+
* [confirm](#confirm)
|
48
|
+
* [resend-confirmation](#resend-confirmation)
|
49
|
+
* [info](#info)
|
50
|
+
* [update](#update)
|
51
|
+
* [password](#password)
|
52
|
+
* [change](#change)
|
53
|
+
* [reset](#reset)
|
54
|
+
* [version](#version)
|
55
|
+
|
56
|
+
help
|
57
|
+
----
|
58
|
+
|
59
|
+
Explore the CLI via its help texts
|
26
60
|
|
27
61
|
$ duse
|
28
62
|
|
@@ -40,7 +74,7 @@ Then you can explore the client with its help texts
|
|
40
74
|
|
41
75
|
run `duse help COMMAND` for more infos
|
42
76
|
|
43
|
-
When you want to see the help texts for subcommands of e.g.
|
77
|
+
When you want to see the help texts for subcommands of e.g. secret
|
44
78
|
|
45
79
|
$ duse secret
|
46
80
|
|
@@ -58,8 +92,22 @@ When you want to see the help texts for subcommands of e.g. secrets
|
|
58
92
|
|
59
93
|
run `duse help secret COMMAND` for more infos
|
60
94
|
|
61
|
-
|
62
|
-
|
95
|
+
For any command the `-h` flag can be added to receive the help description.
|
96
|
+
|
97
|
+
$ duse secret add -h
|
98
|
+
Interactively create a new secret, or set values via options.
|
99
|
+
|
100
|
+
Usage: duse secret add [OPTIONS]
|
101
|
+
-h, --help Display help
|
102
|
+
-t, --title [TITLE] The title for the secret to save
|
103
|
+
-s, --secret [SECRET] The secret to save
|
104
|
+
-g, --generate-secret Automatically generate the secret
|
105
|
+
-f, --file [FILE] Read the secret to save from this file
|
106
|
+
|
107
|
+
config
|
108
|
+
------
|
109
|
+
|
110
|
+
The CLI tells you when it needs to be configured
|
63
111
|
|
64
112
|
$ duse login
|
65
113
|
client not configured, run `duse config`
|
@@ -67,7 +115,27 @@ example when it needs to be configured and you are trying to login.
|
|
67
115
|
So configure it
|
68
116
|
|
69
117
|
$ duse config
|
70
|
-
Uri to the duse instance you want to use: https://myserver.
|
118
|
+
Uri to the duse instance you want to use: https://myserver.com/
|
119
|
+
|
120
|
+
login
|
121
|
+
-----
|
122
|
+
|
123
|
+
When it works
|
124
|
+
|
125
|
+
$ duse login
|
126
|
+
Username: flower-pot
|
127
|
+
Password: xxxxxxxx
|
128
|
+
Successfully logged in!
|
129
|
+
|
130
|
+
When it fails
|
131
|
+
|
132
|
+
$ duse login
|
133
|
+
Username: flower-pot
|
134
|
+
Password: xxxxxxxx
|
135
|
+
Wrong username or password!
|
136
|
+
|
137
|
+
register
|
138
|
+
--------
|
71
139
|
|
72
140
|
Let's register
|
73
141
|
|
@@ -76,20 +144,17 @@ Let's register
|
|
76
144
|
Email: fbranczyk@gmail.com
|
77
145
|
Password: xxxxxxxx
|
78
146
|
Confirm password: xxxxxxxx
|
79
|
-
1. /Users/fredericbranczyk/.ssh/
|
80
|
-
2.
|
81
|
-
3.
|
82
|
-
4. Let me choose it myself
|
147
|
+
1. /Users/fredericbranczyk/.ssh/id_rsa
|
148
|
+
2. Generate a new one
|
149
|
+
3. Let me choose it myself
|
83
150
|
Which private ssh-key do you want to use?
|
84
|
-
|
151
|
+
2
|
85
152
|
Successfully created your account! An email to confirm it has been sent. Once confirmed you can login with "duse login"
|
86
153
|
|
87
|
-
|
154
|
+
secret
|
155
|
+
------
|
88
156
|
|
89
|
-
|
90
|
-
Username: flower-pot
|
91
|
-
Password: xxxxxxxx
|
92
|
-
Successfully logged in!
|
157
|
+
###add
|
93
158
|
|
94
159
|
Now that the client is configured and you're logged in the first secret can be
|
95
160
|
created
|
@@ -100,24 +165,107 @@ created
|
|
100
165
|
Do you want to share this secret?[Y/n] n
|
101
166
|
Secret successfully created!
|
102
167
|
|
103
|
-
|
168
|
+
###list
|
169
|
+
|
170
|
+
List your secrets
|
104
171
|
|
105
172
|
$ duse secret list
|
106
173
|
1: First Secret
|
107
174
|
|
175
|
+
###get
|
176
|
+
|
177
|
+
Retrieve a secret interactively
|
178
|
+
|
179
|
+
$ duse secret get
|
180
|
+
1: First secret
|
181
|
+
|
182
|
+
Select the id of the secret to retrieve: 1
|
183
|
+
|
184
|
+
Name: First secret
|
185
|
+
Secret: test-secret
|
186
|
+
Access: flower-pot
|
187
|
+
|
108
188
|
Retrieve a secret
|
109
189
|
|
110
190
|
$ duse secret get 1
|
111
191
|
|
112
192
|
Name: First Secret
|
113
193
|
Secret: test-secret
|
114
|
-
Access: flower-pot
|
194
|
+
Access: flower-pot
|
115
195
|
|
116
196
|
Or plain
|
117
197
|
|
118
|
-
$ duse secret get 1
|
198
|
+
$ duse secret get 1 --plain
|
119
199
|
test-secret
|
120
200
|
|
201
|
+
###remove
|
202
|
+
|
203
|
+
Delete a secret
|
204
|
+
|
205
|
+
$ duse secret remove 1
|
206
|
+
Successfully deleted
|
207
|
+
|
208
|
+
Or interactively
|
209
|
+
|
210
|
+
$ duse secret remove
|
211
|
+
Secret to delete: 1
|
212
|
+
Successfully deleted
|
213
|
+
|
214
|
+
account
|
215
|
+
-------
|
216
|
+
|
217
|
+
###confirm
|
218
|
+
|
219
|
+
Confirm the account
|
220
|
+
|
221
|
+
$ duse account confirm <token>
|
222
|
+
Account successfully confirmed.
|
223
|
+
|
224
|
+
###resend-confirmation
|
225
|
+
|
226
|
+
Make the request the server to resend the confirmation email.
|
227
|
+
|
228
|
+
Confirm the account
|
229
|
+
|
230
|
+
$ duse account resend-confirmation
|
231
|
+
Your email: fbranczyk@gmail.com
|
232
|
+
New confirmation process started.
|
233
|
+
|
234
|
+
###info
|
235
|
+
|
236
|
+
Retrieve and print information about your account.
|
237
|
+
|
238
|
+
$ duse account info
|
239
|
+
Username: flower-pot
|
240
|
+
Email: fbranczyk@gmail.com
|
241
|
+
|
242
|
+
###update
|
243
|
+
|
244
|
+
Update your account
|
245
|
+
|
246
|
+
$ duse account update
|
247
|
+
|
248
|
+
###password
|
249
|
+
####change
|
250
|
+
|
251
|
+
Change your password
|
252
|
+
|
253
|
+
$ duse account password change
|
254
|
+
|
255
|
+
####reset
|
256
|
+
|
257
|
+
Request your password to be reset
|
258
|
+
|
259
|
+
$ duse account password reset
|
260
|
+
|
261
|
+
version
|
262
|
+
-------
|
263
|
+
|
264
|
+
Print the version of the gem.
|
265
|
+
|
266
|
+
$ duse secret remove
|
267
|
+
0.0.6
|
268
|
+
|
121
269
|
The Library
|
122
270
|
===========
|
123
271
|
|
@@ -140,8 +288,7 @@ Usage
|
|
140
288
|
-----
|
141
289
|
|
142
290
|
require 'duse'
|
143
|
-
Duse.
|
144
|
-
Duse.token = 'token'
|
291
|
+
Duse.config = Duse::Client::Config.new(token: 'token', uri: 'https://example.org/')
|
145
292
|
user = Duse::User.get 'me'
|
146
293
|
p user
|
147
294
|
=> #<Duse::Client::User:0x0000000140acd0 @attributes={"id"=>2, "username"=>"flower-pot", "public_key"=>"-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCtaAORZpFJ037AN1Drm88TLYyZ\ny+vLyVZr9XKPfMUF/KCHEsT1gJfQYFRI7t/gHjL3VouKM10671f/g8s5t1hWHF6Y\nOvaFTd3yDXAkf86x5jrPBrIH6M3M5WOwwqwW9aRF22CFzlBoCoV4GQt4KhRzqrG2\nkRJULsBuT9TiHCKEPwIDAQAB\n-----END PUBLIC KEY-----\n"}, @curry=#<Duse::Client::Namespace::Curry:0x0000000149fbf0>>
|
data/lib/duse/cli/command.rb
CHANGED
@@ -217,6 +217,14 @@ module Duse
|
|
217
217
|
say help
|
218
218
|
end
|
219
219
|
end
|
220
|
+
|
221
|
+
def format(data, format = nil, style = nil)
|
222
|
+
style ||= :important
|
223
|
+
data = format % color(data, style) if format and interactive?
|
224
|
+
data = data.gsub(/<\[\[/, '<%=').gsub(/\]\]>/, '%>')
|
225
|
+
data.encode! 'utf-8' if data.respond_to? :encode!
|
226
|
+
data
|
227
|
+
end
|
220
228
|
end
|
221
229
|
end
|
222
230
|
end
|
data/lib/duse/cli/secret_get.rb
CHANGED
@@ -40,6 +40,7 @@ module Duse
|
|
40
40
|
Secret: #{plain_secret}
|
41
41
|
Access: #{secret.users.delete_if(&:server?).map(&:username).join(', ')}
|
42
42
|
".gsub(/^( |\t)+/, "")
|
43
|
+
error "Signatures could not be verified!\nEither a user is changing her keypair\nor there is an attacker.\n" if !secret.signatures_valid?
|
43
44
|
end
|
44
45
|
end
|
45
46
|
end
|
@@ -32,7 +32,7 @@ module Duse
|
|
32
32
|
|
33
33
|
def select_from_list(subjects, method = :to_s)
|
34
34
|
print_list(subjects, method)
|
35
|
-
selection = terminal.ask
|
35
|
+
selection = terminal.ask "Type the ids of the users you want to share with (separate with commas to select multiple)\n"
|
36
36
|
CommaSeparatedIntegerList.new(selection).map do |i|
|
37
37
|
fail InvalidSelection if subjects[i-1].nil?
|
38
38
|
subjects[i-1]
|
@@ -70,11 +70,11 @@ module Duse
|
|
70
70
|
end
|
71
71
|
|
72
72
|
def forgot_password(email)
|
73
|
-
session.post('/users/forgot_password', { email:
|
73
|
+
session.post('/users/forgot_password', { email: email })
|
74
74
|
end
|
75
75
|
|
76
76
|
def resend_confirmation(email)
|
77
|
-
session.post('/users/confirm', { email:
|
77
|
+
session.post('/users/confirm', { email: email })
|
78
78
|
end
|
79
79
|
end
|
80
80
|
end
|
data/lib/duse/client/secret.rb
CHANGED
@@ -5,11 +5,6 @@ require 'secret_sharing'
|
|
5
5
|
module Duse
|
6
6
|
module Client
|
7
7
|
class UpdateSecret
|
8
|
-
# Possible Scenarios
|
9
|
-
# ------------------
|
10
|
-
# change title
|
11
|
-
# change secret -> changes cipher + shares
|
12
|
-
# change users -> changes shares
|
13
8
|
def initialize(secret, values_to_update)
|
14
9
|
@secret = secret
|
15
10
|
@values = values_to_update
|
@@ -20,6 +15,11 @@ module Duse
|
|
20
15
|
self
|
21
16
|
end
|
22
17
|
|
18
|
+
# Possible Scenarios
|
19
|
+
# ------------------
|
20
|
+
# change title
|
21
|
+
# change secret -> changes cipher + shares
|
22
|
+
# change users -> changes shares
|
23
23
|
def build
|
24
24
|
result = {}
|
25
25
|
result[:title] = @values[:title] if @values[:title]
|
@@ -30,7 +30,8 @@ module Duse
|
|
30
30
|
result[:shares] = shares
|
31
31
|
end
|
32
32
|
if @values[:secret_text].nil? && @values[:users]
|
33
|
-
|
33
|
+
shares = @secret.shares.map(&:content)
|
34
|
+
symmetric_key = Encryption.decrypt_symmetric_key(shares, @private_key)
|
34
35
|
result[:shares] = Encryption.encrypt_symmetric_key(symmetric_key, @values[:users], @private_key)
|
35
36
|
end
|
36
37
|
result
|
@@ -90,7 +91,28 @@ module Duse
|
|
90
91
|
# require shares to be set (real shares object in the future)
|
91
92
|
# require cipher_text to be set
|
92
93
|
|
93
|
-
|
94
|
+
shares = self.shares.map(&:content)
|
95
|
+
Encryption.decrypt(self.cipher_text, shares, private_key)
|
96
|
+
end
|
97
|
+
|
98
|
+
def signatures_valid?
|
99
|
+
self.shares.each do |s|
|
100
|
+
return false if !s.valid_signature?
|
101
|
+
end
|
102
|
+
true
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
class Share < Entity
|
107
|
+
attributes :id, :content, :signature, :last_edited_by_id
|
108
|
+
|
109
|
+
id_field :id
|
110
|
+
one :share
|
111
|
+
many :shares
|
112
|
+
|
113
|
+
def valid_signature?
|
114
|
+
user = Duse::User.find(self.last_edited_by_id)
|
115
|
+
Encryption::Asymmetric.verify(user.public_key, self.signature, self.content)
|
94
116
|
end
|
95
117
|
end
|
96
118
|
end
|
data/lib/duse/version.rb
CHANGED
@@ -17,11 +17,24 @@ RSpec.describe 'duse secret' do
|
|
17
17
|
stub_secret_get
|
18
18
|
stub_user_me_get
|
19
19
|
stub_server_user_get
|
20
|
+
stub_user_get1
|
21
|
+
stub_user_get2
|
20
22
|
expect(run_cli('secret', 'get', '1').out).to eq(
|
21
23
|
"\nName: test\nSecret: test\nAccess: flower-pot\n"
|
22
24
|
)
|
23
25
|
end
|
24
26
|
|
27
|
+
it 'takes the secrets id from the cli call and does not ask for it' do
|
28
|
+
stub_secret_get
|
29
|
+
stub_user_me_get
|
30
|
+
stub_secret_get_broken_signature
|
31
|
+
stub_user_get1
|
32
|
+
stub_user_get2
|
33
|
+
expect(run_cli('secret', 'get', '2').err).to eq(
|
34
|
+
"Signatures could not be verified!\nEither a user is changing her keypair\nor there is an attacker.\n"
|
35
|
+
)
|
36
|
+
end
|
37
|
+
|
25
38
|
it 'outputs the secret content plaintext when using the plain flag' do
|
26
39
|
stub_secret_get
|
27
40
|
stub_user_me_get
|
@@ -48,9 +61,15 @@ RSpec.describe 'duse secret' do
|
|
48
61
|
stub_secret_get
|
49
62
|
stub_user_me_get
|
50
63
|
stub_server_user_get
|
51
|
-
|
52
|
-
|
64
|
+
stub_user_get1
|
65
|
+
stub_user_get2
|
66
|
+
|
67
|
+
run_cli('secret', 'get') { |i| i.puts('1') }
|
68
|
+
|
69
|
+
expect(last_run.out).to match(
|
70
|
+
"1: test\n\nSelect the id of the secret to retrieve: (1\n)?\nName: test\nSecret: test\nAccess: flower-pot\n"
|
53
71
|
)
|
72
|
+
expect(last_run.err).to be_empty
|
54
73
|
end
|
55
74
|
end
|
56
75
|
end
|
@@ -106,13 +125,8 @@ RSpec.describe 'duse secret' do
|
|
106
125
|
i.puts '1'
|
107
126
|
end.success?).to be true
|
108
127
|
|
109
|
-
expect(last_run.out).to
|
110
|
-
|
111
|
-
"Secret to save: " +
|
112
|
-
"Do you want to share this secret?[y/n] " +
|
113
|
-
"Who do you want to share this secret with?\n" +
|
114
|
-
"1: adracus\n" +
|
115
|
-
"Type the ids of the users you want to share with (separate with commas to select multiple)\n"
|
128
|
+
expect(last_run.out).to match(
|
129
|
+
/What do you want to call this secret\? (test\n)?Secret to save: (test\n)?Do you want to share this secret\?\[y\/n\] (y\n)?Who do you want to share this secret with\?\n1: adracus\nType the ids of the users you want to share with \(separate with commas to select multiple\)\n(1\n)?/
|
116
130
|
)
|
117
131
|
end
|
118
132
|
end
|
data/spec/client/secret_spec.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
1
3
|
RSpec.describe Duse::Client::Secret do
|
2
4
|
before :each do
|
3
5
|
Duse.config = Duse::CLIConfig.new({ 'uri' => 'https://example.com/'})
|
@@ -94,9 +96,9 @@ RSpec.describe Duse::Client::Secret do
|
|
94
96
|
users: [current_user, server_user]
|
95
97
|
).sign_with(current_user_private_key).build
|
96
98
|
|
97
|
-
shares = secret[:shares].map { |s| s
|
98
|
-
server_share = Duse::Encryption::Asymmetric.decrypt(server_user_private_key, shares[1])
|
99
|
-
shares[1], _ = Duse::Encryption::Asymmetric.encrypt(current_user_private_key, current_user_public_key, server_share)
|
99
|
+
shares = secret[:shares].map { |s| Duse::Client::Share.new(s) }
|
100
|
+
server_share = Duse::Encryption::Asymmetric.decrypt(server_user_private_key, shares[1].content)
|
101
|
+
shares[1].content, _ = Duse::Encryption::Asymmetric.encrypt(current_user_private_key, current_user_public_key, server_share)
|
100
102
|
|
101
103
|
secret = Duse::Client::Secret.new shares: shares, cipher_text: secret[:cipher_text]
|
102
104
|
decrypted_secret = secret.decrypt(current_user_private_key)
|
@@ -137,9 +139,9 @@ RSpec.describe Duse::Client::Secret do
|
|
137
139
|
{ users: [current_user, server_user] }
|
138
140
|
).encrypt_with(current_user_private_key).build
|
139
141
|
|
140
|
-
shares = secret_hash[:shares].map { |s| s
|
141
|
-
server_share = Duse::Encryption::Asymmetric.decrypt(server_user_private_key, shares[1])
|
142
|
-
shares[1], _ = Duse::Encryption::Asymmetric.encrypt(current_user_private_key, current_user_public_key, server_share)
|
142
|
+
shares = secret_hash[:shares].map { |s| Duse::Client::Share.new(s) }
|
143
|
+
server_share = Duse::Encryption::Asymmetric.decrypt(server_user_private_key, shares[1].content)
|
144
|
+
shares[1].content, _ = Duse::Encryption::Asymmetric.encrypt(current_user_private_key, current_user_public_key, server_share)
|
143
145
|
|
144
146
|
new_secret = Duse::Client::Secret.new shares: shares, cipher_text: secret.cipher_text
|
145
147
|
decrypted_secret = new_secret.decrypt(current_user_private_key)
|
data/spec/client/user_spec.rb
CHANGED
@@ -33,19 +33,19 @@ RSpec.describe Duse::Client::User do
|
|
33
33
|
describe '.create' do
|
34
34
|
it 'creates correct user entity from json create response' do
|
35
35
|
stub_create_user
|
36
|
-
public_key = "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCftZvHkB6uKWVDvrIzmy2p496H\nv9PD/hhRk+DSXcE/CPtRmvYZzbWbbBup9hkvhyH/P1O5EF8KSZm4Cdnz6p37idTe\nNdlaH9cRFV2wc2A/hbg2kaISxrDxUqRbywBE9NOBSjXu2wRpy0TMo85eM2A0E2ET\n2XM6tZcuwFULX6bl8QIDAQAB\n-----END PUBLIC KEY-----\n"
|
36
|
+
public_key = OpenSSL::PKey::RSA.new("-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCftZvHkB6uKWVDvrIzmy2p496H\nv9PD/hhRk+DSXcE/CPtRmvYZzbWbbBup9hkvhyH/P1O5EF8KSZm4Cdnz6p37idTe\nNdlaH9cRFV2wc2A/hbg2kaISxrDxUqRbywBE9NOBSjXu2wRpy0TMo85eM2A0E2ET\n2XM6tZcuwFULX6bl8QIDAQAB\n-----END PUBLIC KEY-----\n")
|
37
37
|
|
38
38
|
user = Duse::User.create(
|
39
39
|
username: 'flower-pot',
|
40
40
|
email: 'flower-pot@example.org',
|
41
41
|
password: 'Passw0rd!',
|
42
42
|
password_confirmation: 'Passw0rd!',
|
43
|
-
public_key: public_key
|
43
|
+
public_key: public_key.to_s
|
44
44
|
)
|
45
45
|
|
46
46
|
expect(user.username).to eq 'flower-pot'
|
47
47
|
expect(user.email).to eq 'flower-pot@example.org'
|
48
|
-
expect(user.public_key.to_s).to eq public_key
|
48
|
+
expect(user.public_key.to_s).to eq public_key.to_s
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -53,39 +53,39 @@ RSpec.describe Duse::Client::User do
|
|
53
53
|
context 'own user' do
|
54
54
|
it 'creates the correct entity when requesting own user' do
|
55
55
|
stub_user_me_get
|
56
|
-
public_key = "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmMm3Ovh7gU0rLHK4NiHh\nWaYRrV9PH6XtHqV0GoiHH7awrjVkT1aZiS+nlBxckfuvuQjRXakVCZh18UdQadVQ\n7FLTWMZNoZ/uh41g4Iv17Wh1I3Fgqihdm83cSWvJ81qQCVGBaKeVitSa49zT/Mmo\noBvYFwulaqJjhqFc3862Rl3WowzGVqGf+OiYhFrBbnIqXijDmVKsbqkG5AILGo1n\nng06HIAvMqUcGMebgoju9SuKaR+C46KT0K5sPpNw/tNcDEZqZAd25QjAroGnpRHS\nI9hTEuPopPSyRqz/EVQfbhi0LbkdDW9S5ECw7GfFPFpRp2239fjl/9ybL6TkeZL7\nAwIDAQAB\n-----END PUBLIC KEY-----\n"
|
56
|
+
public_key = OpenSSL::PKey::RSA.new("-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmMm3Ovh7gU0rLHK4NiHh\nWaYRrV9PH6XtHqV0GoiHH7awrjVkT1aZiS+nlBxckfuvuQjRXakVCZh18UdQadVQ\n7FLTWMZNoZ/uh41g4Iv17Wh1I3Fgqihdm83cSWvJ81qQCVGBaKeVitSa49zT/Mmo\noBvYFwulaqJjhqFc3862Rl3WowzGVqGf+OiYhFrBbnIqXijDmVKsbqkG5AILGo1n\nng06HIAvMqUcGMebgoju9SuKaR+C46KT0K5sPpNw/tNcDEZqZAd25QjAroGnpRHS\nI9hTEuPopPSyRqz/EVQfbhi0LbkdDW9S5ECw7GfFPFpRp2239fjl/9ybL6TkeZL7\nAwIDAQAB\n-----END PUBLIC KEY-----\n")
|
57
57
|
|
58
58
|
user = Duse::User.find 'me'
|
59
59
|
|
60
60
|
expect(user.username).to eq 'flower-pot'
|
61
61
|
expect(user.email).to eq 'flower-pot@example.org'
|
62
|
-
expect(user.public_key.to_s).to eq public_key
|
62
|
+
expect(user.public_key.to_s).to eq public_key.to_s
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
66
|
context 'server user' do
|
67
67
|
it 'creates the correct entity when requesting the server user' do
|
68
68
|
stub_server_user_get
|
69
|
-
public_key = "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvyvyAf7lnVx9eQcAS7JL\nYRHrqJJe51rAdanaUiiy8eek2Iyh6JG551EK7x4n9/Y7r0fW2sNmy+Bp3FpL8E/p\ncxutggTWCnUQUvXmEEm5qZ1KOIIlEQNp5glToAenJ7pxotJsTMlVw4tizsKScenc\n8w+02wpcmWuzWKjoY/G5KV33UDz/LxVo1RJdJp94JiL/OinIl+uk+Vf7VZj/E8g/\n7DyXIuiBosVpj9E9T4kpxs3/7RmUfDzUisVq0UvgflRjvP1V+1KdpNnjVB+H08mb\nSVO6yf2YOcrPDRa3pgz7PIr225QJ+HmVjPTg5VAy7rUxhCK+q+HNd2oz35zA70SO\npQIDAQAB\n-----END PUBLIC KEY-----\n"
|
69
|
+
public_key = OpenSSL::PKey::RSA.new("-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvyvyAf7lnVx9eQcAS7JL\nYRHrqJJe51rAdanaUiiy8eek2Iyh6JG551EK7x4n9/Y7r0fW2sNmy+Bp3FpL8E/p\ncxutggTWCnUQUvXmEEm5qZ1KOIIlEQNp5glToAenJ7pxotJsTMlVw4tizsKScenc\n8w+02wpcmWuzWKjoY/G5KV33UDz/LxVo1RJdJp94JiL/OinIl+uk+Vf7VZj/E8g/\n7DyXIuiBosVpj9E9T4kpxs3/7RmUfDzUisVq0UvgflRjvP1V+1KdpNnjVB+H08mb\nSVO6yf2YOcrPDRa3pgz7PIr225QJ+HmVjPTg5VAy7rUxhCK+q+HNd2oz35zA70SO\npQIDAQAB\n-----END PUBLIC KEY-----\n")
|
70
70
|
|
71
71
|
user = Duse::User.find 'server'
|
72
72
|
|
73
73
|
expect(user.username).to eq 'server'
|
74
74
|
expect(user.email).to eq 'server@localhost'
|
75
|
-
expect(user.public_key.to_s).to eq public_key
|
75
|
+
expect(user.public_key.to_s).to eq public_key.to_s
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
79
|
context 'any user' do
|
80
80
|
it 'creates the correct entity when requesting a specific user' do
|
81
81
|
stub_get_other_user
|
82
|
-
public_key = "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0Y1b9awjW0nshQXk64uO\n1v+GYliBH8ogu6QjQDn0eoLIfcOibrotbhJuSS0G46yOhboOCZQWrwyqi4MYtTMB\nH3ITTmNkhzOkdRXLJGJXXv3OCYR0J+PdCXbrtfYkvqOgyJE4RAR6YBEO/XcQk0Em\nE4IDFq22Aar7MxSjrLk17LX9mTifdzg1xdxX5myX4NrXGVWTWKeS5klLWCe9AigQ\n35b8c2Zyehx6jxHk+jt5CguMC9VqSyJobKdu926W4k2AgzWRdZh0EvCg2wWjlYjc\nhJEnrpHLeJxGMEThPoGqgQWiG5BBYIl9kx1vg1QZmS2biS6djGpGIn8l8PN30+QS\n5QIDAQAB\n-----END PUBLIC KEY-----\n"
|
82
|
+
public_key = OpenSSL::PKey::RSA.new("-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0Y1b9awjW0nshQXk64uO\n1v+GYliBH8ogu6QjQDn0eoLIfcOibrotbhJuSS0G46yOhboOCZQWrwyqi4MYtTMB\nH3ITTmNkhzOkdRXLJGJXXv3OCYR0J+PdCXbrtfYkvqOgyJE4RAR6YBEO/XcQk0Em\nE4IDFq22Aar7MxSjrLk17LX9mTifdzg1xdxX5myX4NrXGVWTWKeS5klLWCe9AigQ\n35b8c2Zyehx6jxHk+jt5CguMC9VqSyJobKdu926W4k2AgzWRdZh0EvCg2wWjlYjc\nhJEnrpHLeJxGMEThPoGqgQWiG5BBYIl9kx1vg1QZmS2biS6djGpGIn8l8PN30+QS\n5QIDAQAB\n-----END PUBLIC KEY-----\n")
|
83
83
|
|
84
84
|
user = Duse::User.find 3
|
85
85
|
|
86
86
|
expect(user.username).to eq 'adracus'
|
87
87
|
expect(user.email).to eq 'adracus@example.org'
|
88
|
-
expect(user.public_key.to_s).to eq public_key
|
88
|
+
expect(user.public_key.to_s).to eq public_key.to_s
|
89
89
|
end
|
90
90
|
end
|
91
91
|
end
|
@@ -100,6 +100,6 @@ RSpec.describe Duse::Client::User do
|
|
100
100
|
expect(user.attributes['public_key']).to be nil
|
101
101
|
expect(user.username).to eq 'adracus'
|
102
102
|
expect(user.email).to eq 'adracus@example.org'
|
103
|
-
expect(user.public_key.to_s).to eq "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0Y1b9awjW0nshQXk64uO\n1v+GYliBH8ogu6QjQDn0eoLIfcOibrotbhJuSS0G46yOhboOCZQWrwyqi4MYtTMB\nH3ITTmNkhzOkdRXLJGJXXv3OCYR0J+PdCXbrtfYkvqOgyJE4RAR6YBEO/XcQk0Em\nE4IDFq22Aar7MxSjrLk17LX9mTifdzg1xdxX5myX4NrXGVWTWKeS5klLWCe9AigQ\n35b8c2Zyehx6jxHk+jt5CguMC9VqSyJobKdu926W4k2AgzWRdZh0EvCg2wWjlYjc\nhJEnrpHLeJxGMEThPoGqgQWiG5BBYIl9kx1vg1QZmS2biS6djGpGIn8l8PN30+QS\n5QIDAQAB\n-----END PUBLIC KEY-----\n"
|
103
|
+
expect(user.public_key.to_s).to eq OpenSSL::PKey::RSA.new("-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0Y1b9awjW0nshQXk64uO\n1v+GYliBH8ogu6QjQDn0eoLIfcOibrotbhJuSS0G46yOhboOCZQWrwyqi4MYtTMB\nH3ITTmNkhzOkdRXLJGJXXv3OCYR0J+PdCXbrtfYkvqOgyJE4RAR6YBEO/XcQk0Em\nE4IDFq22Aar7MxSjrLk17LX9mTifdzg1xdxX5myX4NrXGVWTWKeS5klLWCe9AigQ\n35b8c2Zyehx6jxHk+jt5CguMC9VqSyJobKdu926W4k2AgzWRdZh0EvCg2wWjlYjc\nhJEnrpHLeJxGMEThPoGqgQWiG5BBYIl9kx1vg1QZmS2biS6djGpGIn8l8PN30+QS\n5QIDAQAB\n-----END PUBLIC KEY-----\n").to_s
|
104
104
|
end
|
105
105
|
end
|
data/spec/support/mock_api.rb
CHANGED
@@ -25,6 +25,10 @@ module MockAPI
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def stub_user_me_get
|
28
|
+
stub_user_get2('me')
|
29
|
+
end
|
30
|
+
|
31
|
+
def stub_user_get2(id = 2)
|
28
32
|
payload = {
|
29
33
|
'id' => 2,
|
30
34
|
'username' => 'flower-pot',
|
@@ -33,23 +37,27 @@ module MockAPI
|
|
33
37
|
'url' => 'https://example.com/users/2'
|
34
38
|
}.to_json
|
35
39
|
|
36
|
-
stub_request(:get, "https://example.com/users
|
40
|
+
stub_request(:get, "https://example.com/users/#{id}").
|
37
41
|
with(headers: {'Accept'=>'application/vnd.duse.1+json'}).
|
38
42
|
to_return(status: 200, body: payload)
|
39
43
|
end
|
40
44
|
|
41
|
-
def
|
45
|
+
def stub_user_get1(id = 1)
|
42
46
|
payload = {
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
47
|
+
'id' => 1,
|
48
|
+
'username' => 'server',
|
49
|
+
'email' => 'server@localhost',
|
50
|
+
'public_key' => "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvyvyAf7lnVx9eQcAS7JL\nYRHrqJJe51rAdanaUiiy8eek2Iyh6JG551EK7x4n9/Y7r0fW2sNmy+Bp3FpL8E/p\ncxutggTWCnUQUvXmEEm5qZ1KOIIlEQNp5glToAenJ7pxotJsTMlVw4tizsKScenc\n8w+02wpcmWuzWKjoY/G5KV33UDz/LxVo1RJdJp94JiL/OinIl+uk+Vf7VZj/E8g/\n7DyXIuiBosVpj9E9T4kpxs3/7RmUfDzUisVq0UvgflRjvP1V+1KdpNnjVB+H08mb\nSVO6yf2YOcrPDRa3pgz7PIr225QJ+HmVjPTg5VAy7rUxhCK+q+HNd2oz35zA70SO\npQIDAQAB\n-----END PUBLIC KEY-----\n",
|
51
|
+
'url' => 'https://example.com/users/1'
|
48
52
|
}.to_json
|
49
53
|
|
50
|
-
stub_request(:get, "https://example.com/users
|
51
|
-
|
52
|
-
|
54
|
+
stub_request(:get, "https://example.com/users/#{id}").
|
55
|
+
with(headers: {'Accept'=>'application/vnd.duse.1+json'}).
|
56
|
+
to_return(status: 200, body: payload)
|
57
|
+
end
|
58
|
+
|
59
|
+
def stub_server_user_get
|
60
|
+
stub_user_get1('server')
|
53
61
|
end
|
54
62
|
|
55
63
|
# private key for documentation is: "-----BEGIN RSA PRIVATE KEY-----\nMIIEpQIBAAKCAQEA0Y1b9awjW0nshQXk64uO1v+GYliBH8ogu6QjQDn0eoLIfcOi\nbrotbhJuSS0G46yOhboOCZQWrwyqi4MYtTMBH3ITTmNkhzOkdRXLJGJXXv3OCYR0\nJ+PdCXbrtfYkvqOgyJE4RAR6YBEO/XcQk0EmE4IDFq22Aar7MxSjrLk17LX9mTif\ndzg1xdxX5myX4NrXGVWTWKeS5klLWCe9AigQ35b8c2Zyehx6jxHk+jt5CguMC9Vq\nSyJobKdu926W4k2AgzWRdZh0EvCg2wWjlYjchJEnrpHLeJxGMEThPoGqgQWiG5BB\nYIl9kx1vg1QZmS2biS6djGpGIn8l8PN30+QS5QIDAQABAoIBAQC3pXYRMOHvkDKr\nRcYgs7bkLx47tCq9jGvxZmDKWcArWdCRf1EsTxefXqGumbpu73wcMDk7JcBXevc/\nuw19R4zVXSkUSsEASD75qbbVVSYTBsV5y83sY6MEN2dNmcEMHeS7waEY4v/Ij0qe\n0akCFFdlQ0ynpGdcwNbTJmRm7A4ZOrLMoVTJaI/enRJcQSEzBkQ/oHpMlcDBoFJq\nIB61tfm5JD6IPM2BKlXvSOpV8ItPpJYG4PJxUDT7YEhrXy0vGHKyjaKoE04EdLvI\nvfEkP67if9BTR0tMP+dxaeZ8c9ydGCHC9p1rDJMdpGoS4gwBLueEkDxNEchtrf5p\nM+fPan5lAoGBAPR6YLODhK6YIl6M1EMxbXlytnwAwr5vJvMmRBiVyXLnXKoVFI8V\nHkPsjO6wUH8OjZjEflteoo7Co2pawvfUuPhtHPrWVpW8tAdIELGfazOnsdxvcIAJ\nTUB7tHSS/WeWEcsloCAOTb+6wjZdah9CDly95madbI1IYtz9s0Z/TPMXAoGBANtt\nmhAIxNs/8X9lDWbkbQRWdIr/sb6LCQcBN/Jc5mdz9Kp3sXu2Ag4aRsSPbbtu+XBY\nkl+aSIIYWlHJJE1kKKMDJ+cEpCdx8+kdhz/NIfAdbo3RsZ3cDy7ZM28iHNO4LVRX\ndu/VlBrm4CXCBdlug4+GhZK7on1YnPtrqldV7RdjAoGBALb6nUPejMEMdrTjnL8J\n0JEUjYZ0H03e7X0RR+hKu7L3fUCDdJa+zJ8z/itr5WOjZdFQR+5k/y/wd9TTR5es\nLCErsYQARl/eE7RbeLsowVixC4scEUyTKbG4pNCXb3hHNtwgNh+n9QMqac+8zP/G\nNe+t5jMpYiTAZ9ZVQAfkoZhTAoGAezIG7Hev5pT5Bph6tMkM+AF+P0gdyCgRcnBZ\ns+Y6qdytgkPfTuC6OKbCErugVTqSK2RfEfPyP7BijUaL7jOMqTEtZwPxEgBle/1L\nISQPqNstZcxUl5ekop3pxbx2SNw//vl4WmEkXRJAyJItbI0iqiNRvTdBnHRy9qnV\nImGo0pcCgYEA5SJk+Fx/9bJXyKEJIp/Q+Zjq5Oc/4Th9b8ydSBCeksoz9qF+5pWq\nWpDXCa1fdLUxXK+cG39VxF3w2pok5NASeTgF+0myUofc8z/+K/qCDCn8wbojCZpi\nJwB1XlU0M+ZV9emAI1L1DGtoz7i8LT0uG8U5wWFZNljI3GXhfOYpWD4=\n-----END RSA PRIVATE KEY-----\n"
|
@@ -77,14 +85,44 @@ module MockAPI
|
|
77
85
|
to_return(status: 200, body: payload)
|
78
86
|
end
|
79
87
|
|
88
|
+
def stub_secret_get_broken_signature
|
89
|
+
payload = {
|
90
|
+
'id' => 2,
|
91
|
+
'title' => 'test',
|
92
|
+
'cipher_text' => "DZTJUbyBLTtJ2TFETHfbvw==\n",
|
93
|
+
'shares' => [
|
94
|
+
{ 'last_edited_by_id' => 1, 'signature' => "blabla123", 'content' => "JmmvpdzT3umPfU8eFmCLY35GYTjHwjTjaUKT2wTUgyRojFnYbjO3l1gQF0gZ\nspBGK2rlb5q8Ak18XIl+eOsIDmjtPS4a+9Uk/hcCgHmAZ5u5TRHjtEE0X1Ih\nKkF8iXN/PomOW4WCFEseK0VeRTcPzQZ6CtMWjb0Cgr95KpiAqIoPMSlSU8JD\nXbcKsaKeAXspXgjpN+wxyiI+dQIrU+hYhErYOa28AIZkFgtqiP8ZcgiNXqbm\nS6n211M4NCaqD2inZ3dpbDS6MLAG737kSbL5puclArSuyp71Q1a25s5YTmeI\nCAf30zcV3RwPOWjYLfi+Pb8vskN3bxblS3nJxJ4WbQ==\n" },
|
95
|
+
{ 'last_edited_by_id' => 2, 'signature' => "blabla123", 'content' => "IkiK8njWLinkWku7B5dltlMiyOzjDU2N+/2J+ZAUADcfOzA2xlRi6XhKg8BY\n3g792iWyzPpKzj17FywQf4MDL2h12KtC6nvBenlmZx49hg6fIcHCuUoSflwJ\n4Mz5+Ud3N3KP3Zak1WGR4wjVmjkvkFj/KWqMaTMfkc3dTArO15/9ld+J5kfS\n1XjSa8T+NDPBuwdE2VOLiwyJVLTBQuvjRimZ5QgGPoTnD6CQ5jvohyiDHCob\noSbH/TfhVbKlv/ZkSCyVsaWmMUbGvNNxRGjJRPyNZ6R5y74U9UQlO60J/Cur\nXQlBqTRBPf7cZPl/bRgicPabc61S17u8jQU1U4BDxQ==\n" }
|
96
|
+
],
|
97
|
+
'users' => [{
|
98
|
+
'id' => 1,
|
99
|
+
'username' => 'server',
|
100
|
+
'email' => 'server@localhost',
|
101
|
+
'public_key' => "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvyvyAf7lnVx9eQcAS7JL\nYRHrqJJe51rAdanaUiiy8eek2Iyh6JG551EK7x4n9/Y7r0fW2sNmy+Bp3FpL8E/p\ncxutggTWCnUQUvXmEEm5qZ1KOIIlEQNp5glToAenJ7pxotJsTMlVw4tizsKScenc\n8w+02wpcmWuzWKjoY/G5KV33UDz/LxVo1RJdJp94JiL/OinIl+uk+Vf7VZj/E8g/\n7DyXIuiBosVpj9E9T4kpxs3/7RmUfDzUisVq0UvgflRjvP1V+1KdpNnjVB+H08mb\nSVO6yf2YOcrPDRa3pgz7PIr225QJ+HmVjPTg5VAy7rUxhCK+q+HNd2oz35zA70SO\npQIDAQAB\n-----END PUBLIC KEY-----\n",
|
102
|
+
'url' => 'https://example.com/users/1'
|
103
|
+
}, {
|
104
|
+
'id' => 2,
|
105
|
+
'username' => 'flower-pot',
|
106
|
+
'email' => 'flower-pot@example.org',
|
107
|
+
'public_key' => "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmMm3Ovh7gU0rLHK4NiHh\nWaYRrV9PH6XtHqV0GoiHH7awrjVkT1aZiS+nlBxckfuvuQjRXakVCZh18UdQadVQ\n7FLTWMZNoZ/uh41g4Iv17Wh1I3Fgqihdm83cSWvJ81qQCVGBaKeVitSa49zT/Mmo\noBvYFwulaqJjhqFc3862Rl3WowzGVqGf+OiYhFrBbnIqXijDmVKsbqkG5AILGo1n\nng06HIAvMqUcGMebgoju9SuKaR+C46KT0K5sPpNw/tNcDEZqZAd25QjAroGnpRHS\nI9hTEuPopPSyRqz/EVQfbhi0LbkdDW9S5ECw7GfFPFpRp2239fjl/9ybL6TkeZL7\nAwIDAQAB\n-----END PUBLIC KEY-----\n",
|
108
|
+
'url' => 'https://example.com/users/2'
|
109
|
+
}],
|
110
|
+
'url' => 'http://example.com/secrets/1'
|
111
|
+
}.to_json
|
112
|
+
|
113
|
+
stub_request(:get, "https://example.com/secrets/2").
|
114
|
+
with(headers: {'Accept'=>'application/vnd.duse.1+json'}).
|
115
|
+
to_return(status: 200, body: payload)
|
116
|
+
end
|
117
|
+
|
80
118
|
def stub_secret_get
|
81
119
|
payload = {
|
82
120
|
'id' => 1,
|
83
121
|
'title' => 'test',
|
84
122
|
'cipher_text' => "DZTJUbyBLTtJ2TFETHfbvw==\n",
|
85
123
|
'shares' => [
|
86
|
-
"
|
87
|
-
"
|
124
|
+
{ 'last_edited_by_id' => 1, 'signature' => "mWecJ8ni+yVsRmN4rOfE+i36s0efYkJcazLTE9d57fX7sV4yRujMrbaYCpzi\n90puFKHJex25CjrHEhDmb8i8YMNIX96DBymbb2yvyCSsBQ1e8LLE3tXlQ7SM\nRr2Q5mkqoLWcfaNhszw6gLTXElASdtUdd0lmcMX9kKwNmOmdv6eZcWphI4Ti\nVBdylYnMrq3zb+9FOqB2ONl9Gn/HiKItxCZw2dcyGhrwAVrGFisxVHHrMfKt\nF90vwLkfRKfoz4aKgS4x4FC2fSI8xIA5K1hHENMrEviNeC0nCMt1DnafR7Cb\nEVoTamNU9jSgMNrJxsQTOgsblqPpfV/JgGTx3iEyTg==\n", 'content' => "JmmvpdzT3umPfU8eFmCLY35GYTjHwjTjaUKT2wTUgyRojFnYbjO3l1gQF0gZ\nspBGK2rlb5q8Ak18XIl+eOsIDmjtPS4a+9Uk/hcCgHmAZ5u5TRHjtEE0X1Ih\nKkF8iXN/PomOW4WCFEseK0VeRTcPzQZ6CtMWjb0Cgr95KpiAqIoPMSlSU8JD\nXbcKsaKeAXspXgjpN+wxyiI+dQIrU+hYhErYOa28AIZkFgtqiP8ZcgiNXqbm\nS6n211M4NCaqD2inZ3dpbDS6MLAG737kSbL5puclArSuyp71Q1a25s5YTmeI\nCAf30zcV3RwPOWjYLfi+Pb8vskN3bxblS3nJxJ4WbQ==\n" },
|
125
|
+
{ 'last_edited_by_id' => 2, 'signature' => "fMB7PImowpcNBdgdeVRJtSGXtd5krI1wI/a/VbKRgPV4LiRxzoeuFrkhBrFq\n7L7/sXCdRsu5LyJGgxC8P/mSihv64e1jy/uXX9+HkhKfE7KQeSZKOvfIh4Hj\n7mKaAIQvAaASf54MKQFl5WHuXyUXUYECNS5uBHSSeFIjbIsaUuTXSrrvabBK\nk4VjHjz6C5yZ8uCHTP3Wsh8kg6kUqJcWV0cUSAo4eUxhrRnn7lGUTUp+HtVl\n0iTSJGrDXh1qiz6xO0FipWNyJEtZwxm005t0QhsA2E9hGgGMS2kvEFFNtvG0\ncz0b1WBrkZHum+Ol0xRC/u8jVmkxu4/TEiy0mfMbPg==\n", 'content' => "IkiK8njWLinkWku7B5dltlMiyOzjDU2N+/2J+ZAUADcfOzA2xlRi6XhKg8BY\n3g792iWyzPpKzj17FywQf4MDL2h12KtC6nvBenlmZx49hg6fIcHCuUoSflwJ\n4Mz5+Ud3N3KP3Zak1WGR4wjVmjkvkFj/KWqMaTMfkc3dTArO15/9ld+J5kfS\n1XjSa8T+NDPBuwdE2VOLiwyJVLTBQuvjRimZ5QgGPoTnD6CQ5jvohyiDHCob\noSbH/TfhVbKlv/ZkSCyVsaWmMUbGvNNxRGjJRPyNZ6R5y74U9UQlO60J/Cur\nXQlBqTRBPf7cZPl/bRgicPabc61S17u8jQU1U4BDxQ==\n" }
|
88
126
|
],
|
89
127
|
'users' => [{
|
90
128
|
'id' => 1,
|
@@ -119,8 +157,8 @@ module MockAPI
|
|
119
157
|
'title' => 'test',
|
120
158
|
'cipher_text' => "DZTJUbyBLTtJ2TFETHfbvw==\n",
|
121
159
|
'shares' => [
|
122
|
-
"
|
123
|
-
"
|
160
|
+
{ 'last_edited_by_id' => 1, 'signature' => "mWecJ8ni+yVsRmN4rOfE+i36s0efYkJcazLTE9d57fX7sV4yRujMrbaYCpzi\n90puFKHJex25CjrHEhDmb8i8YMNIX96DBymbb2yvyCSsBQ1e8LLE3tXlQ7SM\nRr2Q5mkqoLWcfaNhszw6gLTXElASdtUdd0lmcMX9kKwNmOmdv6eZcWphI4Ti\nVBdylYnMrq3zb+9FOqB2ONl9Gn/HiKItxCZw2dcyGhrwAVrGFisxVHHrMfKt\nF90vwLkfRKfoz4aKgS4x4FC2fSI8xIA5K1hHENMrEviNeC0nCMt1DnafR7Cb\nEVoTamNU9jSgMNrJxsQTOgsblqPpfV/JgGTx3iEyTg==\n", 'content' => "JmmvpdzT3umPfU8eFmCLY35GYTjHwjTjaUKT2wTUgyRojFnYbjO3l1gQF0gZ\nspBGK2rlb5q8Ak18XIl+eOsIDmjtPS4a+9Uk/hcCgHmAZ5u5TRHjtEE0X1Ih\nKkF8iXN/PomOW4WCFEseK0VeRTcPzQZ6CtMWjb0Cgr95KpiAqIoPMSlSU8JD\nXbcKsaKeAXspXgjpN+wxyiI+dQIrU+hYhErYOa28AIZkFgtqiP8ZcgiNXqbm\nS6n211M4NCaqD2inZ3dpbDS6MLAG737kSbL5puclArSuyp71Q1a25s5YTmeI\nCAf30zcV3RwPOWjYLfi+Pb8vskN3bxblS3nJxJ4WbQ==\n" },
|
161
|
+
{ 'last_edited_by_id' => 2, 'signature' => "fMB7PImowpcNBdgdeVRJtSGXtd5krI1wI/a/VbKRgPV4LiRxzoeuFrkhBrFq\n7L7/sXCdRsu5LyJGgxC8P/mSihv64e1jy/uXX9+HkhKfE7KQeSZKOvfIh4Hj\n7mKaAIQvAaASf54MKQFl5WHuXyUXUYECNS5uBHSSeFIjbIsaUuTXSrrvabBK\nk4VjHjz6C5yZ8uCHTP3Wsh8kg6kUqJcWV0cUSAo4eUxhrRnn7lGUTUp+HtVl\n0iTSJGrDXh1qiz6xO0FipWNyJEtZwxm005t0QhsA2E9hGgGMS2kvEFFNtvG0\ncz0b1WBrkZHum+Ol0xRC/u8jVmkxu4/TEiy0mfMbPg==\n", 'content' => "IkiK8njWLinkWku7B5dltlMiyOzjDU2N+/2J+ZAUADcfOzA2xlRi6XhKg8BY\n3g792iWyzPpKzj17FywQf4MDL2h12KtC6nvBenlmZx49hg6fIcHCuUoSflwJ\n4Mz5+Ud3N3KP3Zak1WGR4wjVmjkvkFj/KWqMaTMfkc3dTArO15/9ld+J5kfS\n1XjSa8T+NDPBuwdE2VOLiwyJVLTBQuvjRimZ5QgGPoTnD6CQ5jvohyiDHCob\noSbH/TfhVbKlv/ZkSCyVsaWmMUbGvNNxRGjJRPyNZ6R5y74U9UQlO60J/Cur\nXQlBqTRBPf7cZPl/bRgicPabc61S17u8jQU1U4BDxQ==\n" }
|
124
162
|
],
|
125
163
|
'users' => [{
|
126
164
|
'id' => 1,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: duse
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Frederic Branczyk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: highline
|