Skip to content

Add encryption to use session#1317

Open
1egoman wants to merge 6 commits intomainfrom
add-encryption-to-use-session
Open

Add encryption to use session#1317
1egoman wants to merge 6 commits intomainfrom
add-encryption-to-use-session

Conversation

@1egoman
Copy link
Copy Markdown
Contributor

@1egoman 1egoman commented Apr 10, 2026

Adds the ability to pass an encryption parameter to useSession which allows for an easier path for configuring e2ee on a room.

const worker = new Worker(new URL('livekit-client/e2ee-worker', import.meta.url));

const session = useSession(tokenSource, {
  agentName: appConfig.agentName,
  encryption: {
    enabled: true,
    key: "...",
    worker,
  },
});

I have updated examples/nextjs/pages/e2ee.tsx to use this new encryption parameter.

Additionally, while fixing this, I discovered a small bug introduced as part of #1309 - session.start was no longer a stable reference, so unfortunately because of this most of the examples were stuck in an infinite connect / disconnect loop 😬 . I converted the associated state value into a ref (which looks to be safe in this case) and now makes session.startreference stable, making the examples all work again.

Todo

  • Get the api extractor ci check to pass. It passes for me locally, but doesn't pass in ci... I don't get it.

1egoman added 2 commits April 10, 2026 12:02
This makes setting up e2ee much more straightforward.
…ble again

Adding this new state in
#1309 seems to have made
session.start no longer stable, which broke all the examples...
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 10, 2026

🦋 Changeset detected

Latest commit: 06630ba

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@livekit/components-react Patch
@agents-ui Patch
@livekit/component-example-next Patch
@livekit/components-js-docs Patch
@livekit/component-docs-storybook Patch
@livekit/components-docs-gen Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@1egoman 1egoman requested review from davidzhao and lukasIO April 10, 2026 16:19
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
components-js-storybook-5kld Ready Ready Preview, Comment Apr 13, 2026 6:40pm

Request Review

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 10, 2026

size-limit report 📦

Path Size
LiveKitRoom only 6.01 KB (0%)
LiveKitRoom with VideoConference 32.24 KB (0%)
All exports 43.26 KB (+0.45% 🔺)

@1egoman
Copy link
Copy Markdown
Contributor Author

1egoman commented Apr 14, 2026

@lukasIO Given your updates, would you say this is now in a mergable state?

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.

2 participants