Class TurnCredentials
Time-limited TURN credentials from a secret shared by a TURN server and the service that hands them out, such as a Matrix homeserver's /voip/turnServer: the user name is expiry:name, with the expiry in Unix seconds, and the password is the Base64 HMAC-SHA1 of the user name with the secret.
Inherited Members
Namespace: Uniform.Stun.Protocol
Assembly: Uniform.Stun.Protocol.dll
Syntax
public static class TurnCredentials
Remarks
This is the scheme of the TURN REST API draft that coturn's use-auth-secret and most Matrix homeservers use.
Methods
| Edit this page View SourceCreate(string, string, DateTimeOffset)
Return a user name valid until expires and its password.
Declaration
public static (string Username, string Password) Create(string secret, string name, DateTimeOffset expires)
Parameters
| Type | Name | Description |
|---|---|---|
| string | secret | The shared secret. |
| string | name | Who the credentials are for, e.g. a Matrix user ID; may not contain a colon only at its start. |
| DateTimeOffset | expires | When the credentials stop working. |
Returns
| Type | Description |
|---|---|
| (string Username, string Password) |
Expiry(string)
Return when a time-limited user name expires, or null when it does not start with a Unix time.
Declaration
public static DateTimeOffset? Expiry(string username)
Parameters
| Type | Name | Description |
|---|---|---|
| string | username |
Returns
| Type | Description |
|---|---|
| DateTimeOffset? |
Password(string, string)
Return the password of a time-limited username.
Declaration
public static string Password(string secret, string username)
Parameters
| Type | Name | Description |
|---|---|---|
| string | secret | |
| string | username |
Returns
| Type | Description |
|---|---|
| string |