
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
@northernblock/triangulation-algorithm
Advanced tools
Accept or reject a nodes location based on ping times
npm i @northernblock/triangulation-algorithm
To import the library, you can write
const triangulate = require('@northernblock/triangulation-algorithm')
Then, triangulate is a function that takes 2 parameters:
triangulate function throws errors
const newNodePings = { A: 180, B: 200, C: 400, D: 300 }
const existingNodePings = {
A: { B: 500, C: 500, D: 500 },
B: { A: 500, C: 500, D: 500 },
C: { A: 500, B: 500, D: 500 },
D: { A: 500, B: 500, C: 500 },
}
try {
const res = triangulate(newNodePings, existingNodePings)
// expected output: [{ A: 180, D: 300, B: 200 }]
} catch (e) {
console.log(e.message)
}
npm test to run all test units
newNodePings is null or undefined: Received: ${newNodePings}. newNodePings cannot be null or undefinednewNodePings is not an object: Received: ${newNodePings}. newNodePings needs to be an objectnewNodePings is not defined: newNodePings has an undefined value: ${nodePingTime}newNodePings is not an Integer: Received ${nodePingTime} of type ${typeof nodePingTime}. Node pings need to be Integers. Make sure they are numbers, not strings. ( you can use parseInt(string) )existingNodePings is null or undefined: Received: ${existingNodePings}. existingNodePings cannot be null or undefined.)existingNodePings is not an Object: Received: ${existingNodePings}. existingNodePings needs to be an objectexistingNodePings is null or undefined: Received: ${existingNodePingData}. existingNodePingData cannot be null or undefinedexistingNodePings is not an Object: Received ${existingNodePingData} for one of the ping times. Each nodes pingtimes to other nodes needs to be an object in this format: { [nodeId]: pingTime }existingNodePings is null or undefined: One node ping in existingNodePings has an undefined value: ${nodePingTime}existingNodePings is not an Integer: node pings need to be Integers. Make sure they are numbers, not strings. ( you can use parseInt(string) )newNodePings has less than 4 distances: Please provide 4 or more distances.newNodePings doesn't include all the nodes provided in existingNodePings: Please provide ping time to all nodes!New node collides with node(s) ${arrayOfNodes}New node falls outside of the globe because of distances ${arrayOfNodesWithDistances}Ping data received is not validSomething went horribly wrong inside /lib/ping-validator.js, Internal error... something bad has happened!FAQs
Accept or reject a nodes location based on ping times
We found that @northernblock/triangulation-algorithm demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.