pkcs-ts
Version:
PKCS #1 through #15 (Except #11) - Private and Public Keys, Certificates, and More
90 lines • 4.67 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports._encode_DDO = exports._decode_DDO = exports._extension_additions_list_spec_for_DDO = exports._root_component_type_list_2_spec_for_DDO = exports._root_component_type_list_1_spec_for_DDO = exports.DDO = exports._encode_Path = exports._decode_Path = exports.Path = void 0;
const tslib_1 = require("tslib");
const asn1_ts_1 = require("asn1-ts");
const $ = tslib_1.__importStar(require("asn1-ts/dist/node/functional"));
const Path_ta_1 = require("../PKCS-15/Path.ta");
var Path_ta_2 = require("../PKCS-15/Path.ta");
Object.defineProperty(exports, "Path", { enumerable: true, get: function () { return Path_ta_2.Path; } });
Object.defineProperty(exports, "_decode_Path", { enumerable: true, get: function () { return Path_ta_2._decode_Path; } });
Object.defineProperty(exports, "_encode_Path", { enumerable: true, get: function () { return Path_ta_2._encode_Path; } });
class DDO {
constructor(oid, odfPath, tokenInfoPath, unusedPath, _unrecognizedExtensionsList = []) {
this.oid = oid;
this.odfPath = odfPath;
this.tokenInfoPath = tokenInfoPath;
this.unusedPath = unusedPath;
this._unrecognizedExtensionsList = _unrecognizedExtensionsList;
}
static _from_object(_o) {
return new DDO(_o.oid, _o.odfPath, _o.tokenInfoPath, _o.unusedPath, _o._unrecognizedExtensionsList);
}
}
exports.DDO = DDO;
exports._root_component_type_list_1_spec_for_DDO = [
new $.ComponentSpec("oid", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 6), undefined, undefined),
new $.ComponentSpec("odfPath", true, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 16), undefined, undefined),
new $.ComponentSpec("tokenInfoPath", true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 0), undefined, undefined),
new $.ComponentSpec("unusedPath", true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 1), undefined, undefined),
];
exports._root_component_type_list_2_spec_for_DDO = [];
exports._extension_additions_list_spec_for_DDO = [];
let _cached_decoder_for_DDO = null;
function _decode_DDO(el) {
if (!_cached_decoder_for_DDO) {
_cached_decoder_for_DDO = function (el) {
let oid;
let odfPath;
let tokenInfoPath;
let unusedPath;
let _unrecognizedExtensionsList = [];
const callbacks = {
oid: (_el) => {
oid = $._decodeObjectIdentifier(_el);
},
odfPath: (_el) => {
odfPath = Path_ta_1._decode_Path(_el);
},
tokenInfoPath: (_el) => {
tokenInfoPath = $._decode_implicit(() => Path_ta_1._decode_Path)(_el);
},
unusedPath: (_el) => {
unusedPath = $._decode_implicit(() => Path_ta_1._decode_Path)(_el);
},
};
$._parse_sequence(el, callbacks, exports._root_component_type_list_1_spec_for_DDO, exports._extension_additions_list_spec_for_DDO, exports._root_component_type_list_2_spec_for_DDO, (ext) => {
_unrecognizedExtensionsList.push(ext);
});
return new DDO(oid, odfPath, tokenInfoPath, unusedPath, _unrecognizedExtensionsList);
};
}
return _cached_decoder_for_DDO(el);
}
exports._decode_DDO = _decode_DDO;
let _cached_encoder_for_DDO = null;
function _encode_DDO(value, elGetter) {
if (!_cached_encoder_for_DDO) {
_cached_encoder_for_DDO = function (value, elGetter) {
return $._encodeSequence([]
.concat([
$._encodeObjectIdentifier(value.oid, $.BER),
value.odfPath === undefined
? undefined
: Path_ta_1._encode_Path(value.odfPath, $.BER),
value.tokenInfoPath === undefined
? undefined
: $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 0, () => Path_ta_1._encode_Path, $.BER)(value.tokenInfoPath, $.BER),
value.unusedPath === undefined
? undefined
: $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 1, () => Path_ta_1._encode_Path, $.BER)(value.unusedPath, $.BER),
], value._unrecognizedExtensionsList
? value._unrecognizedExtensionsList
: [])
.filter((c) => !!c), $.BER);
};
}
return _cached_encoder_for_DDO(value, elGetter);
}
exports._encode_DDO = _encode_DDO;
//# sourceMappingURL=DDO.ta.js.map