Comparing version 4.6.2 to 4.7.0
@@ -66,3 +66,3 @@ var Reporter = require('../base').Reporter; | ||
'optional', 'any', 'obj', 'use', 'alteredUse', 'key', 'default', 'explicit', | ||
'implicit' | ||
'implicit', 'contains' | ||
]; | ||
@@ -272,3 +272,3 @@ | ||
Node.prototype._decode = function decode(input) { | ||
Node.prototype._decode = function decode(input, options) { | ||
var state = this._baseState; | ||
@@ -278,3 +278,3 @@ | ||
if (state.parent === null) | ||
return input.wrapResult(state.children[0]._decode(input)); | ||
return input.wrapResult(state.children[0]._decode(input, options)); | ||
@@ -303,5 +303,5 @@ var result = state['default']; | ||
if (state.choice === null) | ||
this._decodeGeneric(state.tag, input); | ||
this._decodeGeneric(state.tag, input, options); | ||
else | ||
this._decodeChoice(input); | ||
this._decodeChoice(input, options); | ||
present = true; | ||
@@ -334,2 +334,4 @@ } catch (e) { | ||
var start = input.offset; | ||
// Unwrap implicit and normal values | ||
@@ -357,5 +359,5 @@ if (state.use === null && state.choice === null) { | ||
else if (state.choice === null) | ||
result = this._decodeGeneric(state.tag, input); | ||
result = this._decodeGeneric(state.tag, input, options); | ||
else | ||
result = this._decodeChoice(input); | ||
result = this._decodeChoice(input, options); | ||
@@ -370,3 +372,3 @@ if (input.isError(result)) | ||
// parts of encoded data | ||
child._decode(input); | ||
child._decode(input, options); | ||
}); | ||
@@ -378,4 +380,10 @@ } | ||
var data = new DecoderBuffer(result); | ||
result = this._getUse(state.contains, input._reporterState.obj)._decode(data); | ||
result = this._getUse(state.contains, input._reporterState.obj) | ||
._decode(data, options); | ||
} | ||
var end = input.offset; | ||
if (options && options.track) | ||
options.track(input.path(), start, end); | ||
} | ||
@@ -394,3 +402,3 @@ | ||
Node.prototype._decodeGeneric = function decodeGeneric(tag, input) { | ||
Node.prototype._decodeGeneric = function decodeGeneric(tag, input, options) { | ||
var state = this._baseState; | ||
@@ -401,21 +409,24 @@ | ||
if (tag === 'seqof' || tag === 'setof') | ||
return this._decodeList(input, tag, state.args[0]); | ||
return this._decodeList(input, tag, state.args[0], options); | ||
else if (/str$/.test(tag)) | ||
return this._decodeStr(input, tag); | ||
return this._decodeStr(input, tag, options); | ||
else if (tag === 'objid' && state.args) | ||
return this._decodeObjid(input, state.args[0], state.args[1]); | ||
return this._decodeObjid(input, state.args[0], state.args[1], options); | ||
else if (tag === 'objid') | ||
return this._decodeObjid(input, null, null); | ||
return this._decodeObjid(input, null, null, options); | ||
else if (tag === 'gentime' || tag === 'utctime') | ||
return this._decodeTime(input, tag); | ||
return this._decodeTime(input, tag, options); | ||
else if (tag === 'null_') | ||
return this._decodeNull(input); | ||
return this._decodeNull(input, options); | ||
else if (tag === 'bool') | ||
return this._decodeBool(input); | ||
return this._decodeBool(input, options); | ||
else if (tag === 'int' || tag === 'enum') | ||
return this._decodeInt(input, state.args && state.args[0]); | ||
else if (state.use !== null) | ||
return this._getUse(state.use, input._reporterState.obj)._decode(input); | ||
else | ||
return this._decodeInt(input, state.args && state.args[0], options); | ||
if (state.use !== null) { | ||
return this._getUse(state.use, input._reporterState.obj) | ||
._decode(input, options); | ||
} else { | ||
return input.error('unknown tag: ' + tag); | ||
} | ||
}; | ||
@@ -437,3 +448,3 @@ | ||
Node.prototype._decodeChoice = function decodeChoice(input) { | ||
Node.prototype._decodeChoice = function decodeChoice(input, options) { | ||
var state = this._baseState; | ||
@@ -447,3 +458,3 @@ var result = null; | ||
try { | ||
var value = node._decode(input); | ||
var value = node._decode(input, options); | ||
if (input.isError(value)) | ||
@@ -450,0 +461,0 @@ return false; |
@@ -42,2 +42,6 @@ var inherits = require('inherits'); | ||
Reporter.prototype.path = function path() { | ||
return this._reporterState.path.join('/'); | ||
}; | ||
Reporter.prototype.enterObject = function enterObject() { | ||
@@ -44,0 +48,0 @@ var state = this._reporterState; |
@@ -111,3 +111,4 @@ var inherits = require('inherits'); | ||
DERNode.prototype._decodeList = function decodeList(buffer, tag, decoder) { | ||
DERNode.prototype._decodeList = function decodeList(buffer, tag, decoder, | ||
options) { | ||
var result = []; | ||
@@ -119,3 +120,3 @@ while (!buffer.isEmpty()) { | ||
var res = decoder.decode(buffer, 'der'); | ||
var res = decoder.decode(buffer, 'der', options); | ||
if (buffer.isError(res) && possibleEnd) | ||
@@ -122,0 +123,0 @@ break; |
{ | ||
"name": "asn1.js", | ||
"version": "4.6.2", | ||
"version": "4.7.0", | ||
"description": "ASN.1 encoder and decoder", | ||
@@ -5,0 +5,0 @@ "main": "lib/asn1.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
122948
37
3264