https://github.com/4players/odin-tokens-php
Lightweight package to generate access keys and room tokens used by 4Players ODIN
https://github.com/4players/odin-tokens-php
authentication ed25519 jwt php
Last synced: about 2 months ago
JSON representation
Lightweight package to generate access keys and room tokens used by 4Players ODIN
- Host: GitHub
- URL: https://github.com/4players/odin-tokens-php
- Owner: 4Players
- License: other
- Created: 2022-06-09T13:22:37.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2023-06-07T11:01:21.000Z (about 3 years ago)
- Last Synced: 2025-02-09T19:28:37.395Z (over 1 year ago)
- Topics: authentication, ed25519, jwt, php
- Language: PHP
- Homepage:
- Size: 15.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 4players/odin-tokens
This is a lightweight package to generate API keys and tokens used for ODIN Voice by 4Players.
[ODIN Voice](https://odin.4players.io/voice-chat/) by [4Players GmbH](https://www.4players.io/company/about_us/) is a cross-platform software development kit (SDK)
that enables developers to integrate voice and video chat technology into multiplayer games, apps and websites.
Check out our [full online documentation](https://docs.4players.io/voice/)!
## Flowchart
```mermaid
graph TB
RandomBytes[Random Bytes] --> AccessKey;
AccessKey --> PublicKey;
AccessKey --> SecretKey;
PublicKey --> KeyId;
```
## Example
```php
use FourPlayers\Odin\TokenGenerator;
$accessKey = "";
$generator = new TokenGenerator($accessKey);
$token = $generator->createToken("my room", "john doe");
echo "generated a new token: $token\n"
```
## 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