Skip to content

Extract livekit-token from livekit-api - #1344

Open
1egoman wants to merge 6 commits into
mainfrom
break-apart-livekit-api
Open

Extract livekit-token from livekit-api#1344
1egoman wants to merge 6 commits into
mainfrom
break-apart-livekit-api

Conversation

@1egoman

@1egoman 1egoman commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Project Overview

Right now, livekit-api is a crate that is an amalgamation of many things:

  • Signaling code
  • Server focused apis which allow users to issue commands via twirp / etc
  • Access token generation
  • Webhook management / smaller server focused utilities / etc

We've discussed on the client team that it would be good to start to split this up. Larger, monolithic crates are harder to build and require larger numbers of features (which can interact in unexpected ways) than smaller ones, and ideally once this migration is complete, livekit will be able to depend on the smaller constituent crates rather than the monolithic livekit-api.

Description

This initial pull request is focused on extracting out a new livekit-token crate from livekit-api. This new crate will contain all access token generation code and be depended on by livekit-uniffi (for exposing via uniffi) and livekit-api (so it can be re-exported under its old path for downstream consumption).

This should NOT be a breaking change and is largely scoped as a lift and shift effort right now. The expectation is that from this point forward, all livekit packages will consume livekit-token directly, and any external packages will be expected to consume livekit-api.

TODO

  • Publish initial livekit-token to crates.io

@github-actions

github-actions Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Changeset ✓

This PR includes a changeset covering all affected packages:

Package Bump
livekit patch
livekit-api patch
livekit-ffi patch
livekit-token patch
livekit-uniffi patch

@1egoman
1egoman force-pushed the break-apart-livekit-api branch from bf1d1e6 to b041fc7 Compare August 21, 2026 19:14
@1egoman 1egoman changed the title Extract livekit-token (and an unexpected side effect, livekit-region) from livekit-api Extract livekit-token from livekit-api Aug 21, 2026
@1egoman
1egoman force-pushed the break-apart-livekit-api branch from 24adcc4 to 58887f0 Compare August 21, 2026 19:18
@1egoman
1egoman marked this pull request as ready for review August 21, 2026 19:38
@1egoman
1egoman requested a review from ladvoc as a code owner August 21, 2026 19:38

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

Moves access_token.rs, jwt_provider.rs and the test_token.txt fixture,
plus the get_env_keys helper, into a new livekit-token crate. livekit-api
re-exports it as `access_token`, which stays the documented path, so no
consumer changes.

Also fixes services-tokio and services-async, which used the access-token
types without declaring the access-token feature: building with
--no-default-features --features services-tokio failed to compile. The
extraction forces the fix, since services/ can no longer reach the types
any other way.

Adds livekit-api/tests/backcompat_paths.rs, a compile-only guard on the
re-export paths, since nothing else in the workspace imports them.

Also records in the implementation plan that test_token.txt has to move
with the token code; the plan had missed it, and cargo test -p
livekit-token fails without it.
The test suites in livekit and livekit-ffi were the last places reaching
access tokens through livekit-api. Both now use livekit-token directly.

livekit takes livekit-token as a dev-dependency rather than livekit-api:
a member-level default-features override is ignored for an inherited
workspace dep, so a livekit-api dev-dep would pull reqwest and the whole
Twirp stack into test builds.

No functional change; livekit_api::access_token is a re-export of these
same types.
@1egoman
1egoman force-pushed the break-apart-livekit-api branch from 202290c to d7ac776 Compare August 24, 2026 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant