This commit is contained in:
2025-08-25 06:28:42 +02:00
parent 5f683ec4a8
commit 836c87fbec
44 changed files with 891 additions and 942 deletions

View File

@@ -5,33 +5,33 @@ import time
pub struct AccessToken {
pub mut:
api_key string
api_secret string
identity string
name string
ttl int
api_key string
api_secret string
identity string
name string
ttl int
video_grant VideoGrant
}
pub struct VideoGrant {
pub mut:
room_create bool
room_admin bool
room_join bool
room_list bool
can_publish bool
can_subscribe bool
room_create bool
room_admin bool
room_join bool
room_list bool
can_publish bool
can_subscribe bool
can_publish_data bool
room string
room string
}
pub fn (mut c LivekitClient) new_access_token(identity string, name string, ttl int) !AccessToken {
return AccessToken{
api_key: c.api_key
api_key: c.api_key
api_secret: c.api_secret
identity: identity
name: name
ttl: ttl
identity: identity
name: name
ttl: ttl
}
}
@@ -49,4 +49,4 @@ pub fn (t AccessToken) to_jwt() !string {
claims.name = t.name
claims.video = t.video_grant
return jwt.encode(claims, t.api_secret, .hs256)
}
}