Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
RPCh SDK is a library which will be used by a client who wants to access the RPCh network, additionally, the SDK will be integrated into our own “RPCh web3 adaptors”. Through the SDK, the client should be able to send traffic through the RPCh network and maintain a reliability metric of used HOPR entry nodes.
You will need to have Node.js and npm/yarn installed on your computer. You can download them from their official website or use a package manager like Homebrew (for Mac) or Chocolatey (for Windows).
Install necessary packages
yarn add @rpch/crypto @rpch/sdk
Get your rpch client by running
curl --request GET \
--url https://staging.discovery.rpch.tech/api/v1/request/trial
or go to https://access.rpch.net/ and follow the docker guide
You can create an instance of the SDK by passing in the required options and key-value store functions:
import * as RPChCrypto from "@rpch/crypto";
import SDK from "@rpch/sdk";
const sdk = new SDK(
{
crypto: RPChCrypto,
client: "your_client_name",
timeout: 5000,
discoveryPlatformApiEndpoint: "https://staging.discovery.rpch.tech",
},
setKeyValFunction,
getKeyValFunction
);
Here are the available options:
The setKeyValFunction and getKeyValFunction functions are used to store and retrieve key-value pairs for the SDK. These are used to store counters for outgoing requests and responses.
// This is an example of a simple way to set these functions
async function setKeyVal(key: string, val: string): Promise<void> {
localStorage.setItem(key, val);
}
async function getKeyVal(key: string): Promise<string | undefined> {
return localStorage.getItem(key);
}
Before you can send requests through the SDK, you must start it by calling the start method:
await sdk.start();
This will fetch the required data from the discovery platform and start any necessary intervals.
Sending a requests consists of 2 steps:
const req = await sdk.createRequest("provider", "body");
The first argument is the provider name and the second argument is the request body.const res = await sdk.sendRequest(req);
This will send the request through the HOPR network and return the response. If there is an error, it will be thrown.When you are finished using the SDK, be sure to release it's acquired resources.
sdk.destruct();
This will stop any necessary intervals and clear up any remaining processes.
Depending on which platform you are running the SDK, you need to enable debugging in different ways. We use the library debug for our logging.
DEBUG="rpch*" ..
localStorage
with keyval debug:rpch*
sdk.debug.enable("rpch*")
FAQs
## Description
The npm package @rpch/sdk receives a total of 2 weekly downloads. As such, @rpch/sdk popularity was classified as not popular.
We found that @rpch/sdk 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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.