API keys
When you've received your Beam accounts API key, you're received three different keys:
- a publishable key - this key can be used in both server side as well as client environments
- a secret key - this key allows you to read and manage data, please only use this in a secure environment
- a regenerate key - this allows you to regenerate your api keys
The regenerate key is reserved for one specific action - to invalidate, and re-create the API keys we provided to you. This could come in handy if you are looking to implement a rotating key solution where you would like to invalidate the API key being used in your backend every x hours/days.
Note that, as soon as you regenerate the keys, your existing keys will be invalidated as soon as you retrieve your new keys. When you use the method, the response will contain a new set of three keys - store them securely!
Below you'll find an example on how to regenerate your API keys.
import { Beam } from "@onbeam/automation-api-client";
const beam = new Beam("x-regenerate-api-key");
const keys = beam.game.regenerateApiKeys();
// {
// "id": "string",
// "createdAt": "string",
// "updatedAt": "string",
// "name": "string",
// "description": "string",
// "coverImageUrl": "string",
// "logoImageUrl": "string",
// "chainIds": [
// 0
// ],
// "apiKeys": [
// {
// "type": "Secret",
// "createdAt": "string",
// "apiKey": "string",
// },
// {
// "type": "Publishable",
// "createdAt": "string",
// "apiKey": "string",
// }
// {
// "type": "Regenerate",
// "createdAt": "string",
// "apiKey": "string",
// }
// ]
// }