UNPKG

@wildboar/pkcs

Version:
63 lines 3.25 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports._encode_CertificateChoice = exports._decode_CertificateChoice = void 0; /* eslint-disable */ const asn1_ts_1 = require("asn1-ts"); const $ = require("asn1-ts/dist/node/functional"); const AttributeCertificate_ta_1 = require("@wildboar/x500/src/lib/modules/AttributeCertificateDefinitions/AttributeCertificate.ta"); const Certificate_ta_1 = require("@wildboar/x500/src/lib/modules/AuthenticationFramework/Certificate.ta"); const ExtendedCertificate_ta_1 = require("../PKCS7/ExtendedCertificate.ta"); /* END_OF_SYMBOL_DEFINITION CertificateChoice */ /* START_OF_SYMBOL_DEFINITION _cached_decoder_for_CertificateChoice */ let _cached_decoder_for_CertificateChoice = null; /* END_OF_SYMBOL_DEFINITION _cached_decoder_for_CertificateChoice */ /* START_OF_SYMBOL_DEFINITION _decode_CertificateChoice */ /** * @summary Decodes an ASN.1 element into a(n) CertificateChoice * @function * @param {_Element} el The element being decoded. * @returns {CertificateChoice} The decoded data structure. */ function _decode_CertificateChoice(el) { if (!_cached_decoder_for_CertificateChoice) { _cached_decoder_for_CertificateChoice = $._decode_inextensible_choice({ "UNIVERSAL 16": ["certificate", Certificate_ta_1._decode_Certificate], "CONTEXT 0": [ "extendedCertificate", $._decode_implicit(() => ExtendedCertificate_ta_1._decode_ExtendedCertificate), ], "CONTEXT 1": [ "attributeCertificate", $._decode_implicit(() => AttributeCertificate_ta_1._decode_AttributeCertificate), ], }); } return _cached_decoder_for_CertificateChoice(el); } exports._decode_CertificateChoice = _decode_CertificateChoice; /* END_OF_SYMBOL_DEFINITION _decode_CertificateChoice */ /* START_OF_SYMBOL_DEFINITION _cached_encoder_for_CertificateChoice */ let _cached_encoder_for_CertificateChoice = null; /* END_OF_SYMBOL_DEFINITION _cached_encoder_for_CertificateChoice */ /* START_OF_SYMBOL_DEFINITION _encode_CertificateChoice */ /** * @summary Encodes a(n) CertificateChoice into an ASN.1 Element. * @function * @param {value} el The element being decoded. * @param elGetter A function that can be used to get new ASN.1 elements. * @returns {_Element} The CertificateChoice, encoded as an ASN.1 Element. */ function _encode_CertificateChoice(value, elGetter) { if (!_cached_encoder_for_CertificateChoice) { _cached_encoder_for_CertificateChoice = $._encode_choice({ certificate: Certificate_ta_1._encode_Certificate, extendedCertificate: $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 0, () => ExtendedCertificate_ta_1._encode_ExtendedCertificate, $.BER), attributeCertificate: $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 1, () => AttributeCertificate_ta_1._encode_AttributeCertificate, $.BER), }, $.BER); } return _cached_encoder_for_CertificateChoice(value, elGetter); } exports._encode_CertificateChoice = _encode_CertificateChoice; /* END_OF_SYMBOL_DEFINITION _encode_CertificateChoice */ /* eslint-enable */ //# sourceMappingURL=CertificateChoice.ta.js.map