Class AccessToken
The claims of a LiveKit access token: a JWT signed with HS256 by an API secret, whose issuer is the API key.
Assembly: Uniform.LiveKit.Protocol.dll
public sealed record AccessToken : IEquatable<AccessToken>
Properties
|
Edit this page
View Source
End of validity, in Unix seconds.
Declaration
[JsonPropertyName("exp")]
public long Expires { get; init; }
Property Value
|
Edit this page
View Source
The participant's identity, unique in a room.
Declaration
[JsonPropertyName("sub")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Identity { get; init; }
Property Value
|
Edit this page
View Source
The API key, which tells LiveKit which secret signed the token.
Declaration
[JsonPropertyName("iss")]
public string Issuer { get; init; }
Property Value
|
Edit this page
View Source
Shown name of the participant.
Declaration
[JsonPropertyName("name")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string? Name { get; init; }
Property Value
|
Edit this page
View Source
Start of validity, in Unix seconds.
Declaration
[JsonPropertyName("nbf")]
public long NotBefore { get; init; }
Property Value
|
Edit this page
View Source
Declaration
[JsonPropertyName("video")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public VideoGrant? Video { get; init; }
Property Value
Methods
|
Edit this page
View Source
Create claims for identity valid from now for lifetime.
Declaration
public static AccessToken Create(string apiKey, string? identity, VideoGrant video, DateTimeOffset now, TimeSpan lifetime)
Parameters
Returns
|
Edit this page
View Source
Return the claims as a JWT signed with apiSecret.
Declaration
public string Sign(string apiSecret)
Parameters
| Type |
Name |
Description |
| string |
apiSecret |
|
Returns
|
Edit this page
View Source
Read a JWT signed with HS256 by apiSecret and valid at now; return false for a bad signature, format or time.
Declaration
public static bool TryRead(string token, string apiSecret, DateTimeOffset now, out AccessToken? claims)
Parameters
Returns
Implements