Skip to content

Commit 73bd94c

Browse files
authored
Add token revocation timestamp to RemoveParticipant (#668)
* Add token revocation timestamp to RemoveParticipant User can provide timestamp to invalidate token whose nbf is before this value. * ci * dep
1 parent 7bd5478 commit 73bd94c

5 files changed

Lines changed: 32 additions & 11 deletions

File tree

.changeset/fuzzy-trains-lose.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'livekit-server-sdk': patch
3+
---
4+
5+
Add token revocation timestamp to RemoveParticipant

examples/agent-dispatch/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"dependencies": {
1515
"dotenv": "^16.4.5",
1616
"livekit-server-sdk": "workspace:*",
17-
"@livekit/protocol": "^1.45.6"
17+
"@livekit/protocol": "^1.46.3"
1818
},
1919
"devDependencies": {
2020
"@types/node": "^20.10.4",

packages/livekit-server-sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
},
4545
"dependencies": {
4646
"@bufbuild/protobuf": "^1.10.1",
47-
"@livekit/protocol": "^1.45.6",
47+
"@livekit/protocol": "^1.46.3",
4848
"camelcase-keys": "^9.0.0",
4949
"jose": "^5.1.2"
5050
},

packages/livekit-server-sdk/src/RoomServiceClient.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,13 @@ export type UpdateParticipantOptions = {
108108
name?: string;
109109
};
110110

111+
export type RemoveParticipantOptions = {
112+
/**
113+
* Unix timestamp used to invalidate tokens whose nbf is before this value.
114+
*/
115+
revokeTokenTs?: bigint;
116+
};
117+
111118
const svc = 'RoomService';
112119

113120
/**
@@ -226,12 +233,21 @@ export class RoomServiceClient extends ServiceBase {
226233
* Even after being removed, the participant can still re-join the room.
227234
* @param room -
228235
* @param identity -
236+
* @param options - removal options
229237
*/
230-
async removeParticipant(room: string, identity: string): Promise<void> {
238+
async removeParticipant(
239+
room: string,
240+
identity: string,
241+
options?: RemoveParticipantOptions,
242+
): Promise<void> {
231243
await this.rpc.request(
232244
svc,
233245
'RemoveParticipant',
234-
new RoomParticipantIdentity({ room, identity }).toJson(),
246+
new RoomParticipantIdentity({
247+
room,
248+
identity,
249+
revokeTokenTs: options?.revokeTokenTs,
250+
}).toJson(),
235251
await this.authHeader({ roomAdmin: true, room }),
236252
);
237253
}

pnpm-lock.yaml

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)