https://github.com/4players/odin-tokens
Lightweight module to generate access keys and room tokens used by 4Players ODIN
https://github.com/4players/odin-tokens
authentication ed25519 javascript jwt nodejs npm typescript
Last synced: 5 months ago
JSON representation
Lightweight module to generate access keys and room tokens used by 4Players ODIN
- Host: GitHub
- URL: https://github.com/4players/odin-tokens
- Owner: 4Players
- License: other
- Created: 2021-09-06T10:07:19.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-06-07T10:56:58.000Z (almost 2 years ago)
- Last Synced: 2024-03-30T12:40:45.959Z (about 1 year ago)
- Topics: authentication, ed25519, javascript, jwt, nodejs, npm, typescript
- Language: TypeScript
- Homepage:
- Size: 466 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @4players/odin-tokens
[][npm-badge-url]
[][license-url]
[][npm-badge-url]This is a lightweight module to generate API keys and tokens used by 4Players ODIN.
4Players ODIN is a cross-platform software development kit (SDK) that enables developers to integrate voice and video chat technology into multiplayer games.
## Flowchart
```mermaid
graph TB
RandomBytes[Random Bytes] --> AccessKey;
AccessKey --> PublicKey;
AccessKey --> SecretKey;
PublicKey --> KeyId;
```## Example
```typescript
import { TokenGenerator } from "@4players/odin-tokens";const accessKey = "";
const generator = new TokenGenerator(accessKey);
const token = generator.createToken("my room", "john doe");console.log(`generated a new token: ${token}`);
```## Terminology
| Term | Description |
| --------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| AccessKey | Gives access to the ODIN network for a customer. It is a 44 character long Base64-String, which consists of a version, random bytes and a checksum. |
| SecretKey | Generated from the AccessKey, it is based on the Ed25519-Curve and used to sign a Token generated by the customer. |
| PublicKey | Generated from the AccessKey, it is based on the Ed25519-Curve and must be uploaded to 4Players so that a generated Token can be verified. |
| KeyId | A shortened PublicKey, included in Token, making it possible to identify what PublicKey must be used to verify the Token. |
| Token | A [JWT] given to the game clients that allows them to connect to a voice/video chat room in the ODIN network. |[jwt]: https://en.wikipedia.org/wiki/JSON_Web_Token
[npm-badge-url]: https://www.npmjs.com/package/@4players/odin-tokens
[license-url]: https://github.com/4Players/odin-tokens/blob/master/LICENSE