Add a TokenSource crate to the Rust SDKs #1274
Conversation
No changeset foundThis PR modifies versioned packages but doesn't include a changeset. The following packages require a version bump:
A package must be bumped when its own files change, and whenever a package it depends on is bumped (so downstream consumers get a matching release). Click here to create a changeset for the missing packages The link pre-populates a changeset file with If this change doesn't require a version bump, add the |
ladvoc
left a comment
There was a problem hiding this comment.
Left some initial comments, will return for a more thorough review when this is taken out of draft.
| readme = "README.md" | ||
|
|
||
| [dependencies] | ||
| reqwest = { workspace = true, features = ["rustls-tls-native-roots"] } |
There was a problem hiding this comment.
issue: Before merging, this should be updated to align with #1258.
There was a problem hiding this comment.
You mean the choice of http client? I had a discussion with Claude about this and settled on using reqwest just to unblock myself, but that is one of the todos I wanted to ask others about.
There was a problem hiding this comment.
from sync: See the new livekit-net crate @jhugman just merged.
1egoman
left a comment
There was a problem hiding this comment.
I saw you opened this so I left some initial thoughts, feel free to ignore them for now if it's still early and not yet ready for a review.
| .with_agent_name("Church"); | ||
|
|
||
| // ======================================================= | ||
| let sandbox = TokenSourceSandbox::new("test1-xqsb8v".to_string()); |
There was a problem hiding this comment.
Since we sunset the sandbox concept and name, this should probably named ProjectTokenSource or something else.
We write: "API fields such as sandboxId and token server URLs still use sandbox naming for compatibility."
We can deprecate existing SDK mentions of SandboxTokenSource and forward to the new name.
There was a problem hiding this comment.
Let's discuss this maybe with #devex
There was a problem hiding this comment.
Or rather talk to the #ocd
|
Potential follow up: Mint tokens based on API secret |
Before you submit your PR
Make sure the following is true before submitting your PR:
PR description
This PR adds the Token Source concept as an independent crate.
Testing
Ideally, unit test the code you add, but ensure you're not repeating existing test cases. Use as many already written scaffolding, utilities as possible; write your own, when needed. If external services, APIs, tokens are required (e.g., running an LK server instance), provide the necessary information. Make sure your tests perform useful, context-aware assertions and do not simply emulate "happy paths".
Async
We want the project to be runtime-agnostic, so please reuse what's already in livekit-runtime and feel free to add anything missing. It's ok to use Tokio directly, when writing unit tests, if necessary. When testing, do not use artificial delays for the state to "catch up"; instead, respect the event flow and subscribe properly using channels or other mechanisms.