Skip to content
This repository was archived by the owner on Jan 31, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions src/elements/pages/dev/game/pages/game-tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,31 @@ export default class DevGameTokens extends LitElement {
}
}

async createServiceToken() {
try {
let createRes = await global.api.cloud.games.namespaces.createGameNamespaceTokenService(
this.game.gameId,
this.namespace.namespaceId,
{
ttl: 365 * 24 * 60 * 60 * 1000
}
);

showAlert(
'Namespace Service Token Creation',
html`
<span>
Copy this token to your clipboard. You will not be able to access this token again.<br />
Expires in 365 days.
</span>
<rvt-copy-area confidential value=${createRes.token}></rvt-copy-area>
`
);
} catch (err) {
logging.error('Failed to create public token', err);
}
}

downloadEnvFile(token: string) {
utils.downloadData('_env', `RIVET_TOKEN=${token}`);
}
Expand Down Expand Up @@ -84,6 +109,17 @@ export default class DevGameTokens extends LitElement {
</div>
`;
}
},
{
name: 'Service Token',
url: 'https://rivet.gg/docs/general/concepts/handling-game-tokens#public-namespace-tokens',
description:
'Service tokens are used from private API servers. These should never be shared.',
render: () => {
return html`<rvt-button @click=${this.createServiceToken.bind(this)}>
Generate
</rvt-button>`;
}
}
];

Expand Down