Skip to main content
Home
Works with
This package works with Node.js, Deno, BrowsersIt is unknown whether this package works with Cloudflare Workers, Bun
It is unknown whether this package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
It is unknown whether this package works with Bun
This package works with Browsers
JSR Score100%
Downloads3/wk
Published9 months ago (2.2.0)

Generate API keys and tokens used by 4Players ODIN.

class TokenGenerator

Generates tokens that can be used to access the ODIN network.

Constructors

new
TokenGenerator(accessKey: string)

Creates a TokenGenerator.

new
TokenGenerator(key: SecretKey)

Creates a TokenGenerator.

new
TokenGenerator(credentials: string | SecretKey)

Properties

private
readonly
keyId: Promise<string>
private
readonly
secretKey: Promise<SecretKey>

Methods

createToken(
roomId: string | string[],
userId: string,
options?: TokenOptions,
): Promise<string>

Creates a signed JWT to grant access to an ODIN room using the EdDSA signature scheme.

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@4players/odin-tokens

Import symbol

import { TokenGenerator } from "@4players/odin-tokens";
or

Import directly with a jsr specifier

import { TokenGenerator } from "jsr:@4players/odin-tokens";

Add Package

pnpm i jsr:@4players/odin-tokens
or (using pnpm 10.8 or older)
pnpm dlx jsr add @4players/odin-tokens

Import symbol

import { TokenGenerator } from "@4players/odin-tokens";

Add Package

yarn add jsr:@4players/odin-tokens
or (using Yarn 4.8 or older)
yarn dlx jsr add @4players/odin-tokens

Import symbol

import { TokenGenerator } from "@4players/odin-tokens";

Add Package

vlt install jsr:@4players/odin-tokens

Import symbol

import { TokenGenerator } from "@4players/odin-tokens";

Add Package

npx jsr add @4players/odin-tokens

Import symbol

import { TokenGenerator } from "@4players/odin-tokens";

Add Package

bunx jsr add @4players/odin-tokens

Import symbol

import { TokenGenerator } from "@4players/odin-tokens";