Connection With Omega
This commit is contained in:
parent
4d8c07a7e4
commit
504e5ff015
20 changed files with 880 additions and 320 deletions
|
|
@ -2,7 +2,11 @@ use livekit_api::access_token;
|
|||
use std::env;
|
||||
use uuid::Uuid;
|
||||
|
||||
pub fn create_token(user_id: i64, call_id: Uuid) -> Result<String, access_token::AccessTokenError> {
|
||||
pub fn create_token(
|
||||
user_id: i64,
|
||||
call_id: Uuid,
|
||||
has_admin: bool,
|
||||
) -> Result<String, access_token::AccessTokenError> {
|
||||
let api_key = env::var("LIVEKIT_API_KEY").expect("LIVEKIT_API_KEY is not set");
|
||||
let api_secret = env::var("LIVEKIT_API_SECRET").expect("LIVEKIT_API_SECRET is not set");
|
||||
|
||||
|
|
@ -11,9 +15,11 @@ pub fn create_token(user_id: i64, call_id: Uuid) -> Result<String, access_token:
|
|||
.with_grants(access_token::VideoGrants {
|
||||
can_update_own_metadata: true,
|
||||
room_join: true,
|
||||
room_admin: has_admin,
|
||||
room: call_id.to_string(),
|
||||
..Default::default()
|
||||
})
|
||||
.with_metadata(&format!("{{\"isAdmin\":{}}}", has_admin))
|
||||
.to_jwt();
|
||||
return token;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue