Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
qaap-pharos
Advanced tools
(deprecated - please use rpc-websockets)
Pharos wraps the "websockets/ws" library providing JSON RPC 2.0 support on top.
npm install qaap-pharos
var Pharos = require('qaap-pharos')
// instantiate Pharos and start listening for requests
var server = new Pharos({
port: 8080,
host: 'localhost',
rpc: {
root_path: '/rpc',
version: '1.0'
}
})
// register an RPC method
server.register('sum', function(params) {
return params[0] + params[1]
})
// create an event
server.event('feedUpdated')
// get events (getter method)
console.log(server.eventList)
// emit an event to subscribers
server.emit('feedUpdated')
// close the server
server.close()
var Pharos = require('qaap-pharos')
var server = new Pharos({
port: 8080,
host: 'localhost',
rpc: {
root_path: '/rpc',
version: '1.0'
}
})
Instantiate a Pharos server.
Parameters:
options
{Object}: Server options that are also forwarded to ws
.
port
{Number}: Port number on which the server will listen for incoming requests.host
{String}: Address on which the server will listen for incoming requests.rpc
{Object}:
root_path
{String}: RPC server endpoint.version
{String}: RPC API version.Once the Pharos class is instantiated, you can use a ws
library's instance via server.wss object.
Registers an RPC method.
Parameters:
method
{String}: RPC method name.callback
{Function}: RPC function that will be fired with a possible parameter object once the method is started.Creates a new event that can be emitted to clients.
Parameters:
method
{String}: RPC method name.callback
{Function}: RPC function that will be fired once the method is started.Lists all created events.
Creates a structured error that can be thrown in a .register callback.
Parameters:
code
{Number}: Indicates the error type that occurred.message
{String}: Provides a short description of the error.data
{String|Object}: Details containing additional information about the error.Closes the server and terminates all clients.
Emits when the server has started listening for requests.
Emits when a server error is raised.
FAQs
JSON-RPC server over WebSockets for Node.js
The npm package qaap-pharos receives a total of 1 weekly downloads. As such, qaap-pharos popularity was classified as not popular.
We found that qaap-pharos demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.