Skip to content

Commit c5a0f83

Browse files
MaxHeimbrockclaude
andcommitted
docs(token-source): fix stale TokenSource:: factory references, scrub sandbox id
These belong to the base token-source work rather than the caching layer: README and doc links updated for the free-function factories, the README example fixed to the current endpoint() signature, a stale camelCase-alias comment removed, and the real sandbox id scrubbed from the example. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent fcdb84b commit c5a0f83

5 files changed

Lines changed: 13 additions & 14 deletions

File tree

examples/token_source/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ async fn main() {
4646

4747
// The remaining sources query LiveKit's development token server, which
4848
// requires the ID of a sandbox created in your LiveKit Cloud project.
49-
let sandbox_id = "test1-xqsb8v".to_string();
49+
let sandbox_id = "your sandbox id".to_string();
5050

5151
let options = TokenSourceFetchOptions::new()
5252
.with_room_name("example-room")

livekit-token-source/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@
33
Token sources for the LiveKit Rust SDK. A token source procures the credentials — server URL and
44
participant token — needed to join a LiveKit room.
55

6-
Three sources ship with the crate, constructed via the `TokenSource` factory functions:
6+
Three sources ship with the crate, constructed via factory functions:
77

8-
- `TokenSource::literal` — a fixed set of pre-provisioned credentials.
9-
- `TokenSource::endpoint` — fetches credentials from a token endpoint implementing the
8+
- `literal` — a fixed set of pre-provisioned credentials.
9+
- `endpoint` — fetches credentials from a token endpoint implementing the
1010
[standard format](https://docs.livekit.io/frontends/build/authentication/endpoint/).
11-
- `TokenSource::development_token_server` — queries a LiveKit
11+
- `development_token_server` — queries a LiveKit
1212
[development token server](https://docs.livekit.io/frontends/build/authentication/sandbox-token-server/)
1313
for prototyping. **Not for production use.**
1414

1515
Custom credential backends can implement the `TokenSourceFixed` or `TokenSourceConfigurable`
1616
traits.
1717

1818
```rust
19-
use livekit_token_source::{TokenSource, TokenSourceConfigurable, TokenSourceFetchOptions};
19+
use livekit_token_source::{TokenSourceConfigurable, TokenSourceFetchOptions};
2020

21-
let source = TokenSource::endpoint("https://example.com/api/token", vec![]);
21+
let source = livekit_token_source::endpoint("https://example.com/api/token");
2222
let options = TokenSourceFetchOptions::new()
2323
.with_room_name("my-room")
2424
.with_participant_identity("user-123");

livekit-token-source/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
//!
1717
//! A token source procures the credentials — server URL and participant
1818
//! token — needed to join a LiveKit room. Construct one via the
19-
//! [`TokenSource`] factory functions, or implement [`TokenSourceFixed`] /
20-
//! [`TokenSourceConfigurable`] to plug in a custom credential backend.
19+
//! [`literal`] / [`endpoint`] / [`development_token_server`] factory
20+
//! functions, or implement [`TokenSourceFixed`] / [`TokenSourceConfigurable`]
21+
//! to plug in a custom credential backend.
2122
2223
mod error;
2324
mod request;

livekit-token-source/src/response.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ use crate::error::TokenSourceError;
1818
/// the participant token to authenticate with.
1919
#[derive(Debug, Clone, serde::Deserialize)]
2020
pub struct TokenSourceResponse {
21-
// The documented endpoint contract is snake_case; the camelCase aliases
22-
// match the leniency of the JS SDK, which parses via proto3 fromJson.
2321
pub server_url: String,
2422
pub participant_token: String,
2523
}

livekit-token-source/src/token_source.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub trait TokenSourceFixed {
3131
async fn fetch(&self) -> TokenSourceResult<TokenSourceResponse>;
3232
}
3333

34-
/// The return type of [`TokenSource::literal`].
34+
/// The return type of [`literal`].
3535
pub struct TokenSourceLiteral {
3636
response: TokenSourceResponse,
3737
}
@@ -71,7 +71,7 @@ pub trait TokenSourceConfigurable {
7171
) -> TokenSourceResult<TokenSourceResponse>;
7272
}
7373

74-
/// The return type of [`TokenSource::endpoint`].
74+
/// The return type of [`endpoint`].
7575
pub struct TokenSourceEndpoint {
7676
endpoint_url: String,
7777
headers: HashMap<String, String>,
@@ -141,7 +141,7 @@ impl TokenSourceEndpoint {
141141
}
142142
}
143143

144-
/// The return type of [`TokenSource::development_token_server`].
144+
/// The return type of [`development_token_server`].
145145
pub struct TokenSourceDevelopmentTokenServer {
146146
token_source_endpoint: TokenSourceEndpoint,
147147
}

0 commit comments

Comments
 (0)