Developer Documentation

OdinAccessKey

public class OdinAccessKey

Class to handle ODIN access keys.

An access key is a 44 character long Base64-String, which consists of a version, random bytes and a checksum.

Properties

rawValue

public let rawValue: String

The underlying access key as a string.

id

public var id: String

The key ID of the access key. This is included in room tokens, making it possible to identify which public key must be used for verification.

publicKey

public var publicKey: String

The public key of the access key. The public key is based on the Ed25519 curve and must be submitted to 4Players so that a generated room token can be verified.

secretKey

public var secretKey: String

The secret key of the access key. The secret key is based on the Ed25519 curve and used to sign a generated room token to access the ODIN network.

Methods

init()

public convenience init()

Initializes a new access key instance.

init(_:)

public init(_ string: String?) throws

Initializes an access key instance using an existing access key string.

deinit

deinit

Destroys the underlying token generator instance.

generateToken(roomId:userId:)

public func generateToken(roomId: String, userId: String? = "") throws -> OdinToken

Uses the internal token generator to create a signed JWT based of this access key, which can be used by a client to join a room.