`jwtPayload.roomConfiguration` returns null fields for tokens from LiveKit server SDKs
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 78/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
調査の方向性
lib/src/token_source/room_configuration.dartと、現在snake_caseのキーを使っているトークンのroom設定パース用の既存テストを読みます。パーサーがemptyTimeoutやagentNameのようなprotobuf JSONのcamelCaseフィールドをどう扱うか確認します。issueの再現手順には、使用する最小限のトークンが示されています。そのトークンについてパースされた値が300とassistantになり、この形式をカバーするように既存テストが更新または拡張されていれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
TokenSourceResponse.jwtPayload?.roomConfiguration returns a RoomConfiguration whose numeric and boolean fields are null, and whose agents have a null agentName, even when the token sets them. For example, roomConfiguration.agents.first.agentName and roomConfiguration.emptyTimeout are null for a token whose room configuration dispatches an agent and sets an empty timeout. dispatchesAgent() still works because it only checks that the agents list is not empty.
Root cause
RoomConfiguration and RoomAgentDispatch in lib/src/token_source/room_configuration.dart read snake_case keys (agent_name, empty_timeout, max_participants, and so on). Those keys match the token endpoint request format, which uses the same classes. LiveKit tokens write the roomConfig claim as protobuf JSON, which uses camelCase keys:
livekit/protocolauth/grants.go:RoomConfiguration.MarshalJSONcallsprotojson.Marshal.livekit-api(Python):claims["roomConfig"] = MessageToDict(self.room_config).livekit-server-sdk(Node): theRoomConfigurationprotobuf message is serialized with its JSON names.
The existing test builds its token with agent_name, so it passes. This is the same class of bug as #1236, for the roomConfig claim instead of the video claim.
To reproduce
final token = JWT({
'sub': 'alice',
'roomConfig': {
'emptyTimeout': 300,
'agents': [
{'agentName': 'assistant'},
],
},
}).sign(SecretKey('secret'));
final response = TokenSourceResponse(serverUrl: 'wss://example.livekit.cloud', participantToken: token);
final config = response.jwtPayload?.roomConfiguration;
print(config?.emptyTimeout); // null
print(config?.agents?.first.agentName); // null
Expected: 300 and assistant.
Actual: null and null.
Environment
- livekit_client main (2.13.1)
- 主要言語
- Dart
- スター
- 421
- フォーク
- 260
- 平均マージ
- 2日 11時間
- マージ済み PR(30日)
- 21
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
livekit/client-sdk-flutter のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 38/100
livekit/client-sdk-flutter#1265 ·
メンテナーはふだん 1 日以内に返信
-
A full reconnect that is in progress when disconnect() is called reopens the closed engine and retries up to reconnectAttempts対応中かも @hiroshihorie が 3 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 57/100
livekit/client-sdk-flutter#1245 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
livekit/client-sdk-flutter#1227 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
livekit/client-sdk-flutter#1221 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 30/100
livekit/client-sdk-flutter#1219 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
livekit/client-sdk-flutter の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 5 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 4 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 69/100
メンテナーはふだん 3 日以内に返信
-
area-clientside-dartpad
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 2 日以内に返信
-
'图片收藏'功能无法滑动オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
venera-app/venera-prime#50 ·