stream-chat-ruby 2.8.0 → 2.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6bd69ddcd8703b0afb1c93208ed7c42112f3daaa6b61e2d80ab86606be615151
4
- data.tar.gz: acd7af4d4b43ed330b6bd7f95a73b4aff60593d52cf9133032e9e1b4adc66736
3
+ metadata.gz: 31e7de9bf8ce95a2bf565ac99b5a686deb0195bb3ec20f2004ec784f84d00ff0
4
+ data.tar.gz: '0959555927fa04219edc014cac1247cbca8942387360b2099080138ddbd22664'
5
5
  SHA512:
6
- metadata.gz: 765c5deea378177673be188e11eefb4da985597459922b6043df2c6701f8637312f2c9c77848ab2b07f77747840ca586032a8eda442ded7b043616419e2f39d0
7
- data.tar.gz: fc9300507e09e346b7bdaacf0dd0754f5ecf3c054140ed1409082eb009dec5efba880675ef1c464ce3450f8d5a15ff5cec2ba6223db63dce376417b1c5119379
6
+ metadata.gz: 70608f85204fb4a1c9451fed4f27281579d23c5e558aea25d752735309b62409cdd15986ad6cb1550e65a5e9072fde29b1792fbf16c2dc5fc1c8b020f1f68b96
7
+ data.tar.gz: 4907cdf3f110e825a47c45f0759684e9bf3ae4449f74ff8546238d60f39e92c611f1f3e8b3fd855dfe2bf06846432968ee7fa56ee46f3cc946b03af63885b121
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## May 31st, 2021 - 2.9.0
2
+
3
+ - Add support for app and user level token revoke
4
+
1
5
  ## May 21st, 2021 - 2.8.0
2
6
 
3
7
  - Add query message flags support
@@ -4,6 +4,7 @@
4
4
  require 'open-uri'
5
5
  require 'faraday'
6
6
  require 'jwt'
7
+ require 'time'
7
8
  require 'stream-chat/channel'
8
9
  require 'stream-chat/errors'
9
10
  require 'stream-chat/version'
@@ -45,9 +46,10 @@ module StreamChat
45
46
  end
46
47
  end
47
48
 
48
- def create_token(user_id, exp = nil)
49
+ def create_token(user_id, exp = nil, iat = nil)
49
50
  payload = { user_id: user_id }
50
51
  payload['exp'] = exp unless exp.nil?
52
+ payload['iat'] = iat unless iat.nil?
51
53
  JWT.encode(payload, @api_secret, 'HS256')
52
54
  end
53
55
 
@@ -283,6 +285,30 @@ module StreamChat
283
285
  get("export_channels/#{task_id}")
284
286
  end
285
287
 
288
+ def revoke_tokens(before)
289
+ before = before.rfc3339 if before.instance_of?(DateTime)
290
+ update_app_settings({ 'revoke_tokens_issued_before' => before })
291
+ end
292
+
293
+ def revoke_user_token(user_id, before)
294
+ revoke_users_token([user_id], before)
295
+ end
296
+
297
+ def revoke_users_token(user_ids, before)
298
+ before = before.rfc3339 if before.instance_of?(DateTime)
299
+
300
+ updates = []
301
+ user_ids.each do |user_id|
302
+ updates.push({
303
+ 'id' => user_id,
304
+ 'set' => {
305
+ 'revoke_tokens_issued_before' => before
306
+ }
307
+ })
308
+ end
309
+ update_users_partial(updates)
310
+ end
311
+
286
312
  def put(relative_url, params: nil, data: nil)
287
313
  make_http_request(:put, relative_url, params: params, data: data)
288
314
  end
@@ -3,5 +3,5 @@
3
3
  # lib/version.rb
4
4
 
5
5
  module StreamChat
6
- VERSION = '2.8.0'
6
+ VERSION = '2.9.0'
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stream-chat-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.0
4
+ version: 2.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mircea Cosbuc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-21 00:00:00.000000000 Z
11
+ date: 2021-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday