Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sharelock-client

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sharelock-client - npm Package Compare versions

Comparing version 0.0.0 to 0.0.1

3

package.json
{
"name": "sharelock-client",
"version": "0.0.0",
"version": "0.0.1",
"description": "Node.js wrapper for https://sharelock.io",

@@ -14,3 +14,2 @@ "homepage": "https://sharelock.io",

"dependencies": {
"lodash": "^3.3.1",
"request": "^2.53.0",

@@ -17,0 +16,0 @@ "valid-url": "^1.0.9"

var request = require('request');
var ld = require('lodash');
var validUrl = require('valid-url');
function Sharelock (uri) {
if (!uri) {
this.uri = 'https://sharelock.io';
} else if (validUrl.isUri(uri)) {
this.url = uri;
} else {
throw 'Invalid Sharelock URI specified: ' + uri;
}
if (!uri) {
this.uri = 'https://sharelock.io';
} else if (validUrl.isUri(uri)) {
this.url = uri;
} else {
throw 'Invalid Sharelock URI specified: ' + uri;
}
}

@@ -17,34 +16,34 @@

Sharelock.init = function (url) {
return new Sharelock(url);
return new Sharelock(url);
};
Sharelock.prototype.create = function (secret, acl, cb) {
var uri = this.uri;
var options = {
uri: uri + '/create',
method: 'POST',
json: {
"d": secret,
"a": parseAcl(acl)
}
};
request.post(options, function (err, response, body) {
if (!err && response.statusCode === 200) {
return cb(null, uri + body);
} else {
return cb(err, null);
}
});
var uri = this.uri;
var options = {
uri: uri + '/create',
method: 'POST',
json: {
"d": secret,
"a": parseAcl(acl)
}
};
request.post(options, function (err, response, body) {
if (!err && response.statusCode === 200) {
return cb(null, uri + body);
} else {
return cb(err, null);
}
});
};
function parseAcl(acl) {
if (acl.constructor === Array && acl.length > 0) {
return acl.join(',');
} else if (ld.isString(acl)) {
return acl;
} else {
throw 'Invalid recipient list (ACL) specified: ' + acl;
}
if (acl.constructor === Array && acl.length > 0) {
return acl.join(',');
} else if (typeof acl === 'string') {
return acl;
} else {
throw 'Invalid recipient list (ACL) specified: ' + acl;
}
}
module.exports = Sharelock;
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc