@@ -29,7 +29,7 @@ public class TokenGenerator {
2929 public var ttl : TimeInterval
3030 public var name : String ?
3131 public var metadata : String ?
32- public var videoGrant : LiveKitJWTPayload . VideoGrant ?
32+ public var videoGrants : VideoGrants ?
3333
3434 public init ( apiKey: String ,
3535 apiSecret: String ,
@@ -43,40 +43,19 @@ public class TokenGenerator {
4343 }
4444
4545 public func sign( ) throws -> String {
46- var ffiVideoGrants : VideoGrants ?
47- if let grant = videoGrant {
48- ffiVideoGrants = VideoGrants (
49- roomCreate: grant. roomCreate ?? false ,
50- roomList: grant. roomList ?? false ,
51- roomRecord: grant. roomRecord ?? false ,
52- roomAdmin: grant. roomAdmin ?? false ,
53- roomJoin: grant. roomJoin ?? false ,
54- room: grant. room ?? " " ,
55- destinationRoom: " " ,
56- canPublish: grant. canPublish ?? false ,
57- canSubscribe: grant. canSubscribe ?? false ,
58- canPublishData: grant. canPublishData ?? false ,
59- canPublishSources: grant. canPublishSources ?? [ ] ,
60- canUpdateOwnMetadata: false ,
61- ingressAdmin: false ,
62- hidden: grant. hidden ?? false ,
63- recorder: grant. recorder ?? false
64- )
65- }
66-
6746 let credentials = ApiCredentials ( key: apiKey, secret: apiSecret)
6847 let options = TokenOptions (
6948 ttl: ttl,
70- videoGrants: ffiVideoGrants ,
49+ videoGrants: videoGrants ,
7150 sipGrants: nil ,
7251 identity: identity,
7352 name: name,
7453 metadata: metadata,
7554 attributes: nil ,
7655 sha256: nil ,
77- roomName: videoGrant ? . room
56+ roomName: videoGrants ? . room
7857 )
7958
80- return try generateToken ( options: options, credentials: credentials)
59+ return try tokenGenerate ( options: options, credentials: credentials)
8160 }
8261}
0 commit comments