
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
@relaybox/rest
Advanced tools
RelayBox REST Services SDK. Enables seemless integration between server-side applications and RelayBox's authentication and realtime services. It provides robust functionality for generating authentication tokens, publishing events, and interacting effici
Find the full technical documention here
Welcome to RelayBox.
In order to use this library, you need to create a free account and API key. Find more details here.
If you find any issues, please report them here or contact support@relaybox.net.
To install the REST services library, ensure that npm is installed on the host machine, then run the following command:
npm install @relaybox/rest
Once you have successfully installed the library, the following API reference applies.
Instantiate a new RelayBox object to enable usage of the server-side SDK.
const relayBox = new RelayBox();
class RelayBox {
constructor(opts: RelayBoxOptions);
generateTokenResponse(params: TokenResponseParams): TokenResponse;
publish(roomId: string | string[], event: string, data: any): Promise<PublishResponseData>;
}
RelayBox class constructor options:
interface RelayBoxOptions {
apiKey?: string;
}
interface TokenResponseParams {
clientId?: string | string[];
expiresIn?: number;
permissions?: Permission[] | Permissions;
}
interface TokenResponse {
token: string;
expiresIn: number;
}
const allowedPermissions: readonly ['subscribe', 'publish', 'presence', 'metrics', 'history', '*'];
type Permission = (typeof allowedPermissions)[number];
interface Permissions {
[room: string]: string[];
}
Configuration Option | Description | Type |
---|---|---|
apiKey (required) | Associate an API key with the connection, which you can generate via the dashboard. To create an API key, first register for a free account. | string |
Responsible for generating a secure token to be sent as an HTTP response, which can be exchanged for access to real-time services via @relaybox/client. To learn more about auth tokens, please refer to the Auth Tokens documentation.
relayBox.generateTokenResponse();
Returns string in JWT format
Parameter | Description | Default |
---|---|---|
clientId (optional) | Include a clientId to associate an identity with the token. You must provide a clientId for a connection using the generated token to participate in a room's presence set. | - |
expiresIn (optional) | The length of time specified in seconds before the generated token expires and can no longer be used to connect to real-time services | 900 |
permissions (optional) | Optional dynamic permissions overrides specific to the token being generated. To learn more about permissions please see Dynamic Permissions | ["*"] |
Example:
// Generate a token response with a clientId and custom expiry
const tokenResponse = relayBox.generateTokenResponse({
clientId: 123,
expiresIn: 300
});
// Generate a token response attaching dynamic permissions
const permissions = {
myRoom: [
'subscribe',
'publish',
'presence',
'metrics',
'history'
];
};
const tokenResponse = relayBox.generateTokenResponse({
permissions
});
Responsible for publishing an event to a named "room".
relayBox.publish();
Returns object of type PublishResponseData
interface PublishResponseData {
timestamp: string;
signature: string;
}
Argument | Description | Type |
---|---|---|
1 | **Room Name (required):** The name of the room to publish the event to | string |
2 | **Event Name (required):** The name of the published event. Connections subscribing to this event by name will receive the event. | string / function |
2 | **Data (optional):** The data to be sent as the event payload | string / object |
Example:
const data = {
hello: 'world'
};
// Publish an event named 'message' to 'room:one' containing data payload
const response = relayBox.publish('room:one', 'message', data);
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
RelayBox REST Services SDK. Enables seemless integration between server-side applications and RelayBox's authentication and realtime services. It provides robust functionality for generating authentication tokens, publishing events, and interacting effici
The npm package @relaybox/rest receives a total of 0 weekly downloads. As such, @relaybox/rest popularity was classified as not popular.
We found that @relaybox/rest demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.