UNPKG

pkcs-ts

Version:

PKCS #1 through #15 (Except #11) - Private and Public Keys, Certificates, and More

62 lines 2.84 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports._encode_CRLBag = exports._decode_CRLBag = exports._extension_additions_list_spec_for_CRLBag = exports._root_component_type_list_2_spec_for_CRLBag = exports._root_component_type_list_1_spec_for_CRLBag = exports.CRLBag = exports.CRLTypes = void 0; const tslib_1 = require("tslib"); const asn1_ts_1 = require("asn1-ts"); const $ = tslib_1.__importStar(require("asn1-ts/dist/node/functional")); var CRLTypes_osa_1 = require("../PKCS-12/CRLTypes.osa"); Object.defineProperty(exports, "CRLTypes", { enumerable: true, get: function () { return CRLTypes_osa_1.CRLTypes; } }); class CRLBag { constructor(crlId, crltValue) { this.crlId = crlId; this.crltValue = crltValue; } static _from_object(_o) { return new CRLBag(_o.crlId, _o.crltValue); } } exports.CRLBag = CRLBag; exports._root_component_type_list_1_spec_for_CRLBag = [ new $.ComponentSpec("crlId", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 6), undefined, undefined), new $.ComponentSpec("crltValue", false, $.hasTag(asn1_ts_1.ASN1TagClass.context, 0), undefined, undefined), ]; exports._root_component_type_list_2_spec_for_CRLBag = []; exports._extension_additions_list_spec_for_CRLBag = []; let _cached_decoder_for_CRLBag = null; function _decode_CRLBag(el) { if (!_cached_decoder_for_CRLBag) { _cached_decoder_for_CRLBag = function (el) { const sequence = el.sequence; if (sequence.length < 2) { throw new asn1_ts_1.ASN1ConstructionError("CRLBag contained only " + sequence.length.toString() + " elements."); } sequence[0].name = "crlId"; sequence[1].name = "crltValue"; let crlId; let crltValue; crlId = $._decodeObjectIdentifier(sequence[0]); crltValue = $._decode_explicit(() => $._decodeAny)(sequence[1]); return new CRLBag(crlId, crltValue); }; } return _cached_decoder_for_CRLBag(el); } exports._decode_CRLBag = _decode_CRLBag; let _cached_encoder_for_CRLBag = null; function _encode_CRLBag(value, elGetter) { if (!_cached_encoder_for_CRLBag) { _cached_encoder_for_CRLBag = function (value, elGetter) { return $._encodeSequence([] .concat([ $._encodeObjectIdentifier(value.crlId, $.BER), $._encode_explicit(asn1_ts_1.ASN1TagClass.context, 0, () => $._encodeAny, $.BER)(value.crltValue, $.BER), ]) .filter((c) => !!c), $.BER); }; } return _cached_encoder_for_CRLBag(value, elGetter); } exports._encode_CRLBag = _encode_CRLBag; //# sourceMappingURL=CRLBag.ta.js.map