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 +4 -4
- data/AGENTS.md +1 -1
- data/CHANGELOG.md +10 -0
- data/lib/mixin_bot/api/auth.rb +1 -1
- data/lib/mixin_bot/api/session.rb +1 -1
- data/lib/mixin_bot/api.rb +2 -2
- data/lib/mixin_bot/client.rb +5 -5
- data/lib/mixin_bot/utils/crypto.rb +4 -4
- data/lib/mixin_bot/version.rb +1 -1
- data/llms.txt +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f697ecfcd8c410f66ecce281727274b36e90f07df19855862eb0c9b69eb483f1
|
|
4
|
+
data.tar.gz: 365fda6d038a31f77e84ac9b2b11c91a63210fd5f4d6c6918b4c82d0a8042bf6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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.
|
|
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
|
data/lib/mixin_bot/api/auth.rb
CHANGED
|
@@ -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:
|
|
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 (
|
|
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) ||
|
|
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,
|
data/lib/mixin_bot/client.rb
CHANGED
|
@@ -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) ||
|
|
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) ||
|
|
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:
|
|
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:
|
|
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:
|
|
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 (
|
|
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
|
-
|
|
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?
|
data/lib/mixin_bot/version.rb
CHANGED
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.
|
|
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
|
|