Socket
Socket
Sign inDemoInstall

stampery

Package Overview
Dependencies
47
Maintainers
3
Versions
31
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 6.0.0 to 6.0.1

deleteme.js

18

dist/stampery.js

@@ -176,15 +176,15 @@ (function() {

Stampery.prototype.prove = function(receipts) {
var receipt;
if ('receipts' in receipts) {
receipts = receipts.receipts;
Stampery.prototype.prove = function(receipt) {
if ('receipts' in receipt) {
receipt = receipt.receipts;
}
receipt = [receipts.btc, receipts.eth].find(function(receipt) {
return typeof receipt !== 'number';
});
if ('btc' in receipt) {
receipt = [receipt.btc, receipt.eth].find(function(receipt) {
return typeof receipt !== 'number';
});
}
if (receipt) {
return this._checkSiblings(receipt.targetHash, receipt.proof, receipt.merkleRoot);
} else {
return false;
}
return false;
};

@@ -191,0 +191,0 @@

@@ -1,1 +0,1 @@

(function(){var a,b,c,d=function(a,b){return function(){return a.apply(b,arguments)}};b=require("crypto"),c=require("request"),a=function(){function a(a,c){var e;this.clientSecret=a,this.env=null!=c?c:"prod",this._merkleMix=d(this._merkleMix,this),this._checkSiblings=d(this._checkSiblings,this),this.prove=d(this.prove,this),this._req=d(this._req,this),this._post=d(this._post,this),this._get=d(this._get,this),this.stamp=d(this.stamp,this),this.getAll=d(this.getAll,this),this.getByHash=d(this.getByHash,this),this.getById=d(this.getById,this),this.clientId=b.createHash("md5").update(this.clientSecret).digest("hex").substring(0,15),e=new Buffer(this.clientId+":"+this.clientSecret),this.auth="Basic "+e.toString("base64"),this.host="beta"===this.env?"https://api-beta.stampery.com":"https://api-prod.stampery.com"}return a.prototype.hash=function(a){return b.createHash("sha256").update(a).digest()},a.prototype.getById=function(a,b){return this._get("stamps/"+a,function(a,c){return c&&(c=c[0]),b(a,c)})},a.prototype.getByHash=function(a,b){return a instanceof Buffer&&(a=a.toString("hex")),this._get("stamps/"+a,b)},a.prototype.getAll=function(a,b){var c,d;return d=null!=b?[a,b]:[0,a],c=d[0],a=d[1],this._get("stamps?page="+c,a)},a.prototype.stamp=function(a,b){return a instanceof Buffer&&(a=a.toString("hex")),this._post("stamps",{hash:a},b)},a.prototype._get=function(a,b){return this._req("GET",a,{},b)},a.prototype._post=function(a,b,c){return this._req("POST",a,b,c)},a.prototype._req=function(a,b,d,e){var f;return f={method:a,url:this.host+"/"+b,headers:{Authorization:this.auth,"Content-Type":"application/json"}},d&&(f.json=d),c(f,function(a,b,c){return a?e(a,null):b.statusCode>=400?e({code:b.statusCode,message:b.statusMessage},null):e(null,c.result)})},a.prototype.prove=function(a){var b;return"receipts"in a&&(a=a.receipts),b=[a.btc,a.eth].find(function(a){return"number"!=typeof a}),!!b&&this._checkSiblings(b.targetHash,b.proof,b.merkleRoot)},a.prototype._checkSiblings=function(a,b,c){var d,e,f,g;return b.length>0?(e=b[0],g=b.slice(1),d="left"in e?[e.left,a]:[a,e.right],f=this._merkleMix(d),this._checkSiblings(f,g,c)):(c=new Buffer(c,"hex"),a.equals(c))},a.prototype._merkleMix=function(a){var b;return b=Buffer.concat(a.map(function(a){return Buffer(a,"hex")})),this.hash(b)},a}(),module.exports=a}).call(this);
(function(){var a,b,c,d=function(a,b){return function(){return a.apply(b,arguments)}};b=require("crypto"),c=require("request"),a=function(){function a(a,c){var e;this.clientSecret=a,this.env=null!=c?c:"prod",this._merkleMix=d(this._merkleMix,this),this._checkSiblings=d(this._checkSiblings,this),this.prove=d(this.prove,this),this._req=d(this._req,this),this._post=d(this._post,this),this._get=d(this._get,this),this.stamp=d(this.stamp,this),this.getAll=d(this.getAll,this),this.getByHash=d(this.getByHash,this),this.getById=d(this.getById,this),this.clientId=b.createHash("md5").update(this.clientSecret).digest("hex").substring(0,15),e=new Buffer(this.clientId+":"+this.clientSecret),this.auth="Basic "+e.toString("base64"),this.host="beta"===this.env?"https://api-beta.stampery.com":"https://api-prod.stampery.com"}return a.prototype.hash=function(a){return b.createHash("sha256").update(a).digest()},a.prototype.getById=function(a,b){return this._get("stamps/"+a,function(a,c){return c&&(c=c[0]),b(a,c)})},a.prototype.getByHash=function(a,b){return a instanceof Buffer&&(a=a.toString("hex")),this._get("stamps/"+a,b)},a.prototype.getAll=function(a,b){var c,d;return d=null!=b?[a,b]:[0,a],c=d[0],a=d[1],this._get("stamps?page="+c,a)},a.prototype.stamp=function(a,b){return a instanceof Buffer&&(a=a.toString("hex")),this._post("stamps",{hash:a},b)},a.prototype._get=function(a,b){return this._req("GET",a,{},b)},a.prototype._post=function(a,b,c){return this._req("POST",a,b,c)},a.prototype._req=function(a,b,d,e){var f;return f={method:a,url:this.host+"/"+b,headers:{Authorization:this.auth,"Content-Type":"application/json"}},d&&(f.json=d),c(f,function(a,b,c){return a?e(a,null):b.statusCode>=400?e({code:b.statusCode,message:b.statusMessage},null):e(null,c.result)})},a.prototype.prove=function(a){return"receipts"in a&&(a=a.receipts),"btc"in a&&(a=[a.btc,a.eth].find(function(a){return"number"!=typeof a})),!!a&&this._checkSiblings(a.targetHash,a.proof,a.merkleRoot)},a.prototype._checkSiblings=function(a,b,c){var d,e,f,g;return b.length>0?(e=b[0],g=b.slice(1),d="left"in e?[e.left,a]:[a,e.right],f=this._merkleMix(d),this._checkSiblings(f,g,c)):(c=new Buffer(c,"hex"),a.equals(c))},a.prototype._merkleMix=function(a){var b;return b=Buffer.concat(a.map(function(a){return Buffer(a,"hex")})),this.hash(b)},a}(),module.exports=a}).call(this);
{
"name": "stampery",
"version": "6.0.0",
"version": "6.0.1",
"description": "Stampery API for NodeJS: seamlessly integrate the blockchain-powered, industrial-scale certification platform into your NodeJS apps.",

@@ -5,0 +5,0 @@ "main": "dist/stampery.min.js",

@@ -157,13 +157,2 @@ # Stampery

## Other languages and platforms
Stampery API is also available in many other languages and platforms:
- [Python](https://github.com/stampery/python)
- [Ruby](https://github.com/stampery/ruby)
- [Go](https://github.com/stampery/go)
- [Elixir](https://github.com/stampery/elixir)
- [Java](https://github.com/stampery/java)
- [PHP](https://github.com/stampery/php)
## Feedback

@@ -177,2 +166,2 @@

© 2015-2016 Stampery, Inc.
© 2015-2017 Stampery, Inc.

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc