Table of Contents

Class TokenVerifier

Namespace
Livekit.Server.Sdk.Dotnet
Assembly
LivekitApi.dll

Helper to verify the integrity of a token.

public class TokenVerifier
Inheritance
TokenVerifier
Derived
Inherited Members

Constructors

TokenVerifier(string, string, TimeSpan?)

Creates a verifier for tokens signed with the given API key and secret.

public TokenVerifier(string apiKey = null, string apiSecret = null, TimeSpan? leeway = null)

Parameters

apiKey string

API key the tokens must be issued by; the LIVEKIT_API_KEY environment variable when omitted.

apiSecret string

API secret the tokens must be signed with; the LIVEKIT_API_SECRET environment variable when omitted.

leeway TimeSpan?

Clock tolerance applied to the token lifetime; DefaultLeeway when omitted.

Exceptions

ArgumentException

The key or the secret is missing, or the secret is shorter than 32 bytes.

Methods

Verify(string)

Validates the signature, the issuer and the lifetime of a token and returns its claims.

public ClaimsModel Verify(string token)

Parameters

token string

The JWT to verify.

Returns

ClaimsModel

The claims of the token.

Exceptions

SecurityTokenException

The token has a wrong signature or issuer, is expired or is not valid yet.

ArgumentException

The token is not a well-formed JWT (SecurityTokenMalformedException).