Comparing version 2.1.12 to 2.1.13
@@ -0,1 +1,6 @@ | ||
## 2.1.13 (2020-02-24) | ||
- require_packet_hash flag | ||
- unbreak browser version due to browserify | ||
## 2.1.12 (2020-02-21) | ||
@@ -2,0 +7,0 @@ |
@@ -9,5 +9,6 @@ // Generated by IcedCoffeeScript 108.0.11 | ||
WRONG_SIGNING_KEY: "wrong signing key specified", | ||
REVOKED_KEY: "key is revoked" | ||
REVOKED_KEY: "key is revoked", | ||
UNSEAL: "packet unseal failed" | ||
}); | ||
}).call(this); |
// Generated by IcedCoffeeScript 108.0.11 | ||
(function() { | ||
var K, SHA256, alloc, bufeq_secure, katch, null_hash, obj_extract, pack, purepack, read_base64, seal, unpack, unseal, _ref, _ref1; | ||
var K, SHA256, UnsealError, alloc, bufeq_secure, katch, null_hash, obj_extract, pack, purepack, read_base64, seal, unpack, unseal, _ref, _ref1; | ||
@@ -13,2 +13,4 @@ K = require('../const').kb; | ||
UnsealError = require('../errors').errors.UnsealError; | ||
null_hash = Buffer.alloc(0); | ||
@@ -54,4 +56,5 @@ | ||
unseal = function(buf) { | ||
var h, hasher, hv, oo, t, _ref2; | ||
unseal = function(buf, _arg) { | ||
var h, hasher, hv, oo, strict, t, _ref2; | ||
strict = (_arg != null ? _arg : {}).strict; | ||
oo = unpack(buf); | ||
@@ -62,11 +65,13 @@ if ((hv = oo != null ? (_ref2 = oo.hash) != null ? _ref2.value : void 0 : void 0) != null) { | ||
if (hasher == null) { | ||
throw new Error("unknown hash algo: " + t); | ||
throw new UnsealError("unknown hash algo: " + t); | ||
} | ||
h = hasher(pack(oo)); | ||
if (!bufeq_secure(h, hv)) { | ||
throw new Error("hash mismatch"); | ||
throw new UnsealError("hash mismatch"); | ||
} | ||
if (oo.version !== K.versions.V1) { | ||
throw new Error("unknown version"); | ||
throw new UnsealError("unknown version"); | ||
} | ||
} else if (strict) { | ||
throw new UnsealError("need a hash in strict mode"); | ||
} | ||
@@ -73,0 +78,0 @@ return obj_extract(oo, ['tag', 'body']); |
@@ -414,4 +414,4 @@ // Generated by IcedCoffeeScript 108.0.11 | ||
unbox_decode = function(_arg) { | ||
var armored, binary, e, err, rawobj, ret, _ref2; | ||
armored = _arg.armored, binary = _arg.binary, rawobj = _arg.rawobj; | ||
var armored, binary, e, err, rawobj, require_packet_hash, ret, _ref2; | ||
armored = _arg.armored, binary = _arg.binary, rawobj = _arg.rawobj, require_packet_hash = _arg.require_packet_hash; | ||
err = ret = null; | ||
@@ -427,3 +427,5 @@ if ((armored == null) && (rawobj == null) && (binary == null)) { | ||
try { | ||
rawobj = encode.unseal(binary); | ||
rawobj = encode.unseal(binary, { | ||
strict: require_packet_hash | ||
}); | ||
} catch (_error) { | ||
@@ -439,6 +441,6 @@ e = _error; | ||
unbox = function(_arg, cb) { | ||
var armored, binary, encrypt_for, esc, packet, prefix, rawobj, res, ___iced_passed_deferral, __iced_deferrals, __iced_k; | ||
var armored, binary, encrypt_for, esc, packet, prefix, rawobj, require_packet_hash, res, ___iced_passed_deferral, __iced_deferrals, __iced_k; | ||
__iced_k = __iced_k_noop; | ||
___iced_passed_deferral = iced.findDeferral(arguments); | ||
armored = _arg.armored, binary = _arg.binary, rawobj = _arg.rawobj, encrypt_for = _arg.encrypt_for, prefix = _arg.prefix; | ||
armored = _arg.armored, binary = _arg.binary, rawobj = _arg.rawobj, encrypt_for = _arg.encrypt_for, prefix = _arg.prefix, require_packet_hash = _arg.require_packet_hash; | ||
esc = make_esc(cb, "unbox"); | ||
@@ -454,3 +456,4 @@ (function(_this) { | ||
binary: binary, | ||
rawobj: rawobj | ||
rawobj: rawobj, | ||
require_packet_hash: require_packet_hash | ||
}), esc(__iced_deferrals.defer({ | ||
@@ -578,6 +581,6 @@ assign_fn: (function() { | ||
verify = function(_arg, cb) { | ||
var armored, binary, err, esc, kid, km, res, ___iced_passed_deferral, __iced_deferrals, __iced_k; | ||
var armored, binary, err, esc, kid, km, require_packet_hash, res, ___iced_passed_deferral, __iced_deferrals, __iced_k; | ||
__iced_k = __iced_k_noop; | ||
___iced_passed_deferral = iced.findDeferral(arguments); | ||
armored = _arg.armored, binary = _arg.binary, kid = _arg.kid; | ||
armored = _arg.armored, binary = _arg.binary, kid = _arg.kid, require_packet_hash = _arg.require_packet_hash; | ||
esc = make_esc(cb); | ||
@@ -612,3 +615,4 @@ err = null; | ||
armored: armored, | ||
binary: binary | ||
binary: binary, | ||
require_packet_hash: require_packet_hash | ||
}, esc(__iced_deferrals.defer({ | ||
@@ -665,6 +669,6 @@ assign_fn: (function() { | ||
SignatureEngine.prototype.get_unverified_payload_from_raw_sig_body = function(_arg, cb) { | ||
var body, esc, packet, rawobj, ___iced_passed_deferral, __iced_deferrals, __iced_k; | ||
var body, esc, packet, rawobj, require_packet_hash, ___iced_passed_deferral, __iced_deferrals, __iced_k; | ||
__iced_k = __iced_k_noop; | ||
___iced_passed_deferral = iced.findDeferral(arguments); | ||
body = _arg.body; | ||
body = _arg.body, require_packet_hash = _arg.require_packet_hash; | ||
esc = make_esc(cb, "get_payload_from_raw_sig_body"); | ||
@@ -679,3 +683,5 @@ (function(_this) { | ||
akatch((function() { | ||
return encode.unseal(body); | ||
return encode.unseal(body, { | ||
strict: require_packet_hash | ||
}); | ||
}), esc(__iced_deferrals.defer({ | ||
@@ -780,2 +786,3 @@ assign_fn: (function() { | ||
arg.prefix = opts.prefix; | ||
arg.require_packet_hash = opts.require_packet_hash; | ||
(function(_this) { | ||
@@ -795,3 +802,3 @@ return (function(__iced_k) { | ||
})(), | ||
lineno: 295 | ||
lineno: 296 | ||
}))); | ||
@@ -798,0 +805,0 @@ __iced_deferrals._fulfill(); |
// Generated by IcedCoffeeScript 108.0.11 | ||
(function() { | ||
var GenericKey, iced, import_key_cb, make_esc, promisify, ukm, __iced_k, __iced_k_noop; | ||
var GenericKey, iced, import_key_cb, make_esc, ukm, __iced_k, __iced_k_noop; | ||
@@ -12,4 +12,2 @@ iced = require('iced-runtime'); | ||
promisify = require('util').promisify; | ||
exports.GenericKey = GenericKey = (function() { | ||
@@ -48,3 +46,3 @@ function GenericKey(_arg) { | ||
})(), | ||
lineno: 12 | ||
lineno: 11 | ||
})), opts); | ||
@@ -61,3 +59,13 @@ __iced_deferrals._fulfill(); | ||
GenericKey.prototype.verify = function(s, opts) { | ||
return promisify(this._verify_cb.bind(this))(s, opts); | ||
return new Promise(((function(_this) { | ||
return function(resolve, reject) { | ||
return _this._verify_cb(s, opts, function(err, res) { | ||
if (err != null) { | ||
return reject(err); | ||
} else { | ||
return resolve(res); | ||
} | ||
}); | ||
}; | ||
})(this))); | ||
}; | ||
@@ -89,3 +97,3 @@ | ||
})(), | ||
lineno: 18 | ||
lineno: 23 | ||
}))); | ||
@@ -104,4 +112,14 @@ __iced_deferrals._fulfill(); | ||
exports.importKey = promisify(import_key_cb); | ||
exports.importKey = function(s, opts) { | ||
return new Promise(function(resolve, reject) { | ||
return import_key_cb(s, opts, function(err, ret) { | ||
if (err != null) { | ||
return reject(err); | ||
} else { | ||
return resolve(ret); | ||
} | ||
}); | ||
}); | ||
}; | ||
}).call(this); |
@@ -10,3 +10,3 @@ { | ||
"author": "Maxwell Krohn", | ||
"version": "2.1.12", | ||
"version": "2.1.13", | ||
"license": "BSD-3-Clause", | ||
@@ -40,3 +40,3 @@ "types": "./index.d.ts", | ||
"devDependencies": { | ||
"browserify": "^15.0.0", | ||
"browserify": "^16.5.0", | ||
"colors": "0.6.2", | ||
@@ -43,0 +43,0 @@ "iced-coffee-script": "108.0.11", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1269222
18737