Skip to content

Commit

Permalink
Pass whole impl to multiunsealer.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredhanson committed Feb 24, 2021
1 parent f6d042c commit 264da80
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions lib/multiunsealer.js
Expand Up @@ -34,7 +34,7 @@ MultiUnsealer.prototype.unseal = function(token, options, cb) {
var header;

try {
header = layer[1](token);
header = layer.parse(token);
} catch (ex) {
// parse error, attempt next
return next();
Expand All @@ -56,12 +56,12 @@ MultiUnsealer.prototype.unseal = function(token, options, cb) {

try {

var arity = layer[0].length;;
var arity = layer.unseal.length;;
switch (arity) {
case 3:
return layer[0](token, key, next);
return layer.unseal(token, key, next);
default:
return next(null, layer[0](token, key));
return next(null, layer.unseal(token, key));
}

} catch (ex) {
Expand Down
2 changes: 1 addition & 1 deletion lib/tokens.js
Expand Up @@ -43,7 +43,7 @@ Tokens.prototype.createUnsealer = function(type) {
if (!type) {
types = this._formats.getTypes();
for (i = 0, len = types.length; i < len; ++i) {
stack.push([this._formats.get(types[i]).unseal, this._formats.get(types[i]).parse]);
stack.push(this._formats.get(types[i]));
}

return new MultiUnsealer(stack, this._keyring);
Expand Down

0 comments on commit 264da80

Please sign in to comment.