mixin_bot 3.0.2 → 3.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 520bf980215da4e70c9fa6ae1d9297874fc16fc8264a43bb019a126f0fb0d555
4
- data.tar.gz: 1d5cf99a0e645d4ae110e73148b501bd5f942b3f2c0e9ac0a4338d2d38699a7a
3
+ metadata.gz: f697ecfcd8c410f66ecce281727274b36e90f07df19855862eb0c9b69eb483f1
4
+ data.tar.gz: 365fda6d038a31f77e84ac9b2b11c91a63210fd5f4d6c6918b4c82d0a8042bf6
5
5
  SHA512:
6
- metadata.gz: b73f1bd21043e018410555d93a537b2314f3398a174bf7ce443cce1652b578e425569faa9118d413789607f106863dbf08b1b79ef4da643f28c40fdbad065479
7
- data.tar.gz: 49b66d6300397db22af3f28688eca9999a68ad47f07689a84f94a6c43831d96e0ad42c88d7b95cb3a12f531ab4bf4d5540f84cb0f070508687027f20337ff36a
6
+ metadata.gz: 8a8745b43895e12d86ac46c0687b5125545085bb61b25694753017ced3bff8114dca54943407930ebfd3a710dc11a7db743bf916178db28d5ff1063fe3d8aefc
7
+ data.tar.gz: 463aeec12e34ec91fb79c363f7daa0d1b911a0a8a8fdb76e9d675300af0b627241dcf9bd5114d79e4df18ca8eaa3f447d5e9f4d94a96b678d2b1d730f3d251c4
data/AGENTS.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # AGENTS.md — MixinBot
2
2
 
3
- Ruby gem (v3.0.2): Mixin Network REST SDK + `mixinbot` CLI. Parity targets: [bot-api-go-client](https://github.com/MixinNetwork/bot-api-go-client), [bot-api-nodejs-client](https://github.com/MixinNetwork/bot-api-nodejs-client).
3
+ Ruby gem (v3.0.3): Mixin Network REST SDK + `mixinbot` CLI. Parity targets: [bot-api-go-client](https://github.com/MixinNetwork/bot-api-go-client), [bot-api-nodejs-client](https://github.com/MixinNetwork/bot-api-nodejs-client).
4
4
 
5
5
  ## Commands
6
6
 
data/CHANGELOG.md CHANGED
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [3.0.3] - 2026-11-20
9
+
10
+ ### Changed
11
+
12
+ - **Default JWT `exp_in` lowered from 600s to 300s (5 minutes).** The Mixin API now rejects tokens whose validity exceeds 5 minutes (parity: bot-api-go-client `jwtValidDuration = 5 * time.Minute`, bot-api-nodejs-client `exp = iat + 300`). The new default applies to every token-signing path — `MixinBot.utils.access_token`, `Client#get`/`post`/`fetch_get`/`fetch_post`/`fetch_post_array`, `API#access_token`, `API#sign_oauth_access_token`, and `API#fetch_user_sessions`. Explicit `exp_in:` arguments are still honored; only callers relying on the implicit 600s default are affected. Tokens are minted per request, so no behavior changes beyond the shorter validity window.
13
+
14
+ ### Fixed
15
+
16
+ - **`MixinBot.utils.unique_uuid` now honors its documented order-independence.** The variadic method called `uuids.sort` but discarded the result (`Array#sort` returns a new array without mutating), so calls with 3+ UUIDs produced different IDs depending on argument order. It now sorts before folding. Two-argument calls and all in-gem callers (conversation IDs, group conversation IDs) are unchanged; only direct callers passing 3+ UUIDs in non-sorted order see a different derived ID. The 3-argument golden test value and its order-independence assertions are updated accordingly.
17
+
8
18
  ## [3.0.2] - 2026-09-24
9
19
 
10
20
  ### Added
@@ -8,7 +8,7 @@ module MixinBot
8
8
  method,
9
9
  uri,
10
10
  body,
11
- exp_in: kwargs[:exp_in] || 600,
11
+ exp_in: kwargs[:exp_in] || 300,
12
12
  scp: scope,
13
13
  app_id: kwargs[:app_id] || config.app_id,
14
14
  session_id: kwargs[:session_id] || config.session_id,
@@ -3,7 +3,7 @@
3
3
  module MixinBot
4
4
  class API
5
5
  module Session
6
- def fetch_user_sessions(user_ids, access_token: nil, exp_in: 600, scp: 'FULL')
6
+ def fetch_user_sessions(user_ids, access_token: nil, exp_in: 300, scp: 'FULL')
7
7
  raise ArgumentError, 'user_ids required' if user_ids.blank?
8
8
 
9
9
  client.fetch_post_array '/sessions/fetch', Array(user_ids), access_token:, exp_in:, scp:
data/lib/mixin_bot/api.rb CHANGED
@@ -218,7 +218,7 @@ module MixinBot
218
218
  # @param uri [String] the request URI path
219
219
  # @param body [String] the request body
220
220
  # @param kwargs [Hash] additional options
221
- # @option kwargs [Integer] :exp_in (600) token expiration time in seconds
221
+ # @option kwargs [Integer] :exp_in (300) token expiration time in seconds
222
222
  # @option kwargs [String] :scp ('FULL') token scope
223
223
  #
224
224
  # @return [String] the JWT access token
@@ -231,7 +231,7 @@ module MixinBot
231
231
  method,
232
232
  uri,
233
233
  body,
234
- exp_in: kwargs.delete(:exp_in) || 600,
234
+ exp_in: kwargs.delete(:exp_in) || 300,
235
235
  scp: kwargs.delete(:scp) || 'FULL',
236
236
  app_id: config.app_id,
237
237
  session_id: config.session_id,
@@ -37,7 +37,7 @@ module MixinBot
37
37
  #
38
38
  def get(path, **kwargs)
39
39
  access_token = kwargs.delete(:access_token)
40
- exp_in = kwargs.delete(:exp_in) || 600
40
+ exp_in = kwargs.delete(:exp_in) || 300
41
41
  scp = kwargs.delete(:scp) || 'FULL'
42
42
 
43
43
  kwargs.compact!
@@ -56,7 +56,7 @@ module MixinBot
56
56
  #
57
57
  def post(path, *args, **kwargs)
58
58
  access_token = kwargs.delete(:access_token)
59
- exp_in = kwargs.delete(:exp_in) || 600
59
+ exp_in = kwargs.delete(:exp_in) || 300
60
60
  scp = kwargs.delete(:scp) || 'FULL'
61
61
 
62
62
  body =
@@ -74,7 +74,7 @@ module MixinBot
74
74
  ##
75
75
  # Explicit query-string GET (preferred for new code).
76
76
  #
77
- def fetch_get(path, query: nil, access_token: nil, exp_in: 600, scp: 'FULL')
77
+ def fetch_get(path, query: nil, access_token: nil, exp_in: 300, scp: 'FULL')
78
78
  q = (query || {}).dup
79
79
  q.compact!
80
80
  body = ''
@@ -87,7 +87,7 @@ module MixinBot
87
87
  ##
88
88
  # Explicit JSON-object POST (preferred for new code).
89
89
  #
90
- def fetch_post(path, body:, access_token: nil, exp_in: 600, scp: 'FULL')
90
+ def fetch_post(path, body:, access_token: nil, exp_in: 300, scp: 'FULL')
91
91
  payload = body.is_a?(String) ? body : body.compact.to_json
92
92
  token = access_token.presence || sign_token('POST', path, payload, exp_in:, scp:)
93
93
  response = @conn.post(path, payload, authorization_headers(token))
@@ -97,7 +97,7 @@ module MixinBot
97
97
  ##
98
98
  # Explicit JSON-array POST (e.g. +/users/fetch+, +/safe/keys+).
99
99
  #
100
- def fetch_post_array(path, array_body, access_token: nil, exp_in: 600, scp: 'FULL')
100
+ def fetch_post_array(path, array_body, access_token: nil, exp_in: 300, scp: 'FULL')
101
101
  payload = array_body.to_json
102
102
  token = access_token.presence || sign_token('POST', path, payload, exp_in:, scp:)
103
103
  response = @conn.post(path, payload, authorization_headers(token))
@@ -47,7 +47,7 @@ module MixinBot
47
47
  # @param uri [String] request URI path
48
48
  # @param body [String] request body (empty for GET)
49
49
  # @param kwargs [Hash] additional options
50
- # @option kwargs [Integer] :exp_in (600) token lifetime in seconds
50
+ # @option kwargs [Integer] :exp_in (300) token lifetime in seconds
51
51
  # @option kwargs [String] :scp ('FULL') token scope
52
52
  # @option kwargs [String] :app_id bot application ID
53
53
  # @option kwargs [String] :session_id session ID
@@ -64,7 +64,8 @@ module MixinBot
64
64
  def access_token(method, uri, body = '', **kwargs)
65
65
  sig = Digest::SHA256.hexdigest(method + uri + body.to_s)
66
66
  iat = Time.now.utc.to_i
67
- exp = (Time.now.utc + (kwargs[:exp_in] || 600)).to_i
67
+ # Mixin API rejects JWT tokens with a validity longer than 5 minutes.
68
+ exp = (Time.now.utc + (kwargs[:exp_in] || 300)).to_i
68
69
  scp = kwargs[:scp] || 'FULL'
69
70
  jti = SecureRandom.uuid
70
71
  uid = kwargs[:app_id] || MixinBot.config.app_id
@@ -237,8 +238,7 @@ module MixinBot
237
238
  # puts uuid # Always the same for these inputs
238
239
  #
239
240
  def unique_uuid(*uuids)
240
- uuids = uuids.flatten.compact
241
- uuids.sort
241
+ uuids = uuids.flatten.compact.sort
242
242
  r = uuids.first
243
243
  uuids.each_with_index do |uuid, i|
244
244
  r = generate_unique_uuid(r, uuid) if i.positive?
@@ -11,5 +11,5 @@ module MixinBot
11
11
  #
12
12
  # @see https://semver.org/
13
13
  #
14
- VERSION = '3.0.2'
14
+ VERSION = '3.0.3'
15
15
  end
data/llms.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  # MixinBot
2
2
 
3
- > Ruby SDK and CLI for Mixin Network: Safe UTXO transfers, REST API, Blaze messaging, transaction crypto, optional MVM helpers. Ruby >= 4.0. Gem version 3.0.2.
3
+ > Ruby SDK and CLI for Mixin Network: Safe UTXO transfers, REST API, Blaze messaging, transaction crypto, optional MVM helpers. Ruby >= 4.0. Gem version 3.0.3.
4
4
 
5
5
  Important notes:
6
6
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mixin_bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - an-lee