
Security News
Bun 1.2.19 Adds Isolated Installs for Better Monorepo Support
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.
insane-openbazaar-api
Advanced tools
Openbazaar API client for Nodejs.
// include the module
var OpenBazaarAPI = require('insane-openbazaar-api');
// create a new instance
var ob = new OpenBazaarAPI({
"username": "chris_grimmett", // the username to your openbazaar server
"password": "rosebud", // the password to your openbazaar server
"proto": "https", // optional. defaults to http
"host" : "localhost", // optional. defaults to 127.0.0.1
"port" : "18469" // optional. defaults to 18469
});
// log into your openbazaar server
ob.login(function(err, code, body) {
if (err) throw err;
// get your openbazaar profile description
ob.get_profile(function(err, code, body) {
if (err) throw err;
console.log(body.profile.short_description);
// get someone else's profile
ob.get_profile({'guid': 'a06aa22a38f0e62221ab74464c311bd88305f88c'}, function(err, code, body) {
if (err) throw err;
console.log(body.profile.website);
});
});
});
(Because I forget!)
I'm using node foreman to set environment variables. I keep a .env
file with environment variables; it is ignored by git and not in this repository.
I'm using Drakov in testing to mock OpenBazaar-Server API responses. API mocks are defined in spec.md
and use the API Blueprint format.
I wrote the tests to be flexible with server mocking. I test two different ways. One is running Drakov in the foreground.
Drakov runs in the foreground in a second terminal--
drakov -f ./spec.md -p 3000 --watch
And in my main terminal, I run nf mocha
I do this while I develop locally so I can see that Drakov is responding to the API queries as expected during the mocha tests.
I can also test against a live openbazaar server, by these environment variables in .env
OB_USERNAME=chris_grimmett
OB_PASSWORD=rosebud
OB_HOST=192.168.1.24
OB_PORT=18469
#OB_LIVE_TEST=1
The OB_LIVE_TEST is what tells the mocha test to run against a live OpenBazaar server. I just comment or uncomment that line depending on what type of test I want to run.
When Travic-CI runs the test, TRAVIS
is set in the environment. Mocha sees this environment variable, and calls Drakov from within the test.
If you get something like "Cannot POST /api/v1/login" in the body of the response from Drakov or OpenBazaar-Server, it means your request isn't matching the OpenBazaar-Server spec (see spec.md). Maybe you aren't sending the username and password as a querystring in the body? Maybe you are sending the wrong username and password? (Drakov requires username:test password:test.) See blobs/example-curl-trace.txt
for an example of how a good request looks. You can also use the node module, request-debug
to see what your request is sending.
If you get the above error when trying to use the API against a live OpenBazaar-Server, check your server configuration. If SSL is enabled on your OpenBazaar-Server, but you have your API set to use HTTP, you will see the above error. In your API environment variables, add OB_PROTO=https
If you followed the OpenBazaar team's guide on setting up SSL, that guide doesn't have you pay any attention to seting SSL CA names, localities, etc. Because of that, your CA has no altnames, which node uses to check and see if it is talking to the correct server. To get past this error in a secure fashion, you will need to create a new SSL certificate with a subjectAltName (SAN). See https://wiki.cacert.org/FAQ/subjectAltName
FAQs
OpenBazaar API client for Node.
We found that insane-openbazaar-api 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.
Security News
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.
Security News
Popular npm packages like eslint-config-prettier were compromised after a phishing attack stole a maintainer’s token, spreading malicious updates.
Security News
/Research
A phishing attack targeted developers using a typosquatted npm domain (npnjs.com) to steal credentials via fake login pages - watch out for similar scams.