UNPKG

@wildboar/pkcs

Version:
150 lines 6.71 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports._encode_CertBasedAuthenticationAttributes = exports._decode_CertBasedAuthenticationAttributes = exports._extension_additions_list_spec_for_CertBasedAuthenticationAttributes = exports._root_component_type_list_2_spec_for_CertBasedAuthenticationAttributes = exports._root_component_type_list_1_spec_for_CertBasedAuthenticationAttributes = exports.CertBasedAuthenticationAttributes = void 0; /* eslint-disable */ const asn1_ts_1 = require("asn1-ts"); const $ = require("asn1-ts/dist/node/functional"); /* START_OF_SYMBOL_DEFINITION CertBasedAuthenticationAttributes */ /** * @summary CertBasedAuthenticationAttributes * @description * * ### ASN.1 Definition: * * ```asn1 * CertBasedAuthenticationAttributes ::= SEQUENCE { * cha OCTET STRING, * ... * } * ``` * * @class */ class CertBasedAuthenticationAttributes { constructor( /** * @summary `cha`. * @public * @readonly */ cha, /** * @summary Extensions that are not recognized. * @public * @readonly */ _unrecognizedExtensionsList = []) { this.cha = cha; this._unrecognizedExtensionsList = _unrecognizedExtensionsList; } /** * @summary Restructures an object into a CertBasedAuthenticationAttributes * @description * * This takes an `object` and converts it to a `CertBasedAuthenticationAttributes`. * * @public * @static * @method * @param {Object} _o An object having all of the keys and values of a `CertBasedAuthenticationAttributes`. * @returns {CertBasedAuthenticationAttributes} */ static _from_object(_o) { return new CertBasedAuthenticationAttributes(_o.cha, _o._unrecognizedExtensionsList); } } exports.CertBasedAuthenticationAttributes = CertBasedAuthenticationAttributes; /* END_OF_SYMBOL_DEFINITION CertBasedAuthenticationAttributes */ /* START_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_CertBasedAuthenticationAttributes */ /** * @summary The Leading Root Component Types of CertBasedAuthenticationAttributes * @description * * This is an array of `ComponentSpec`s that define how to decode the leading root component type list of a SET or SEQUENCE. * * @constant */ exports._root_component_type_list_1_spec_for_CertBasedAuthenticationAttributes = [ new $.ComponentSpec("cha", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 4), undefined, undefined), ]; /* END_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_CertBasedAuthenticationAttributes */ /* START_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_CertBasedAuthenticationAttributes */ /** * @summary The Trailing Root Component Types of CertBasedAuthenticationAttributes * @description * * This is an array of `ComponentSpec`s that define how to decode the trailing root component type list of a SET or SEQUENCE. * * @constant */ exports._root_component_type_list_2_spec_for_CertBasedAuthenticationAttributes = []; /* END_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_CertBasedAuthenticationAttributes */ /* START_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_CertBasedAuthenticationAttributes */ /** * @summary The Extension Addition Component Types of CertBasedAuthenticationAttributes * @description * * This is an array of `ComponentSpec`s that define how to decode the extension addition component type list of a SET or SEQUENCE. * * @constant */ exports._extension_additions_list_spec_for_CertBasedAuthenticationAttributes = []; /* END_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_CertBasedAuthenticationAttributes */ /* START_OF_SYMBOL_DEFINITION _cached_decoder_for_CertBasedAuthenticationAttributes */ let _cached_decoder_for_CertBasedAuthenticationAttributes = null; /* END_OF_SYMBOL_DEFINITION _cached_decoder_for_CertBasedAuthenticationAttributes */ /* START_OF_SYMBOL_DEFINITION _decode_CertBasedAuthenticationAttributes */ /** * @summary Decodes an ASN.1 element into a(n) CertBasedAuthenticationAttributes * @function * @param {_Element} el The element being decoded. * @returns {CertBasedAuthenticationAttributes} The decoded data structure. */ function _decode_CertBasedAuthenticationAttributes(el) { if (!_cached_decoder_for_CertBasedAuthenticationAttributes) { _cached_decoder_for_CertBasedAuthenticationAttributes = function (el) { const sequence = el.sequence; if (sequence.length < 1) { throw new asn1_ts_1.ASN1ConstructionError("CertBasedAuthenticationAttributes contained only " + sequence.length.toString() + " elements."); } sequence[0].name = "cha"; let cha; cha = $._decodeOctetString(sequence[0]); return new CertBasedAuthenticationAttributes(cha, sequence.slice(1)); }; } return _cached_decoder_for_CertBasedAuthenticationAttributes(el); } exports._decode_CertBasedAuthenticationAttributes = _decode_CertBasedAuthenticationAttributes; /* END_OF_SYMBOL_DEFINITION _decode_CertBasedAuthenticationAttributes */ /* START_OF_SYMBOL_DEFINITION _cached_encoder_for_CertBasedAuthenticationAttributes */ let _cached_encoder_for_CertBasedAuthenticationAttributes = null; /* END_OF_SYMBOL_DEFINITION _cached_encoder_for_CertBasedAuthenticationAttributes */ /* START_OF_SYMBOL_DEFINITION _encode_CertBasedAuthenticationAttributes */ /** * @summary Encodes a(n) CertBasedAuthenticationAttributes 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 CertBasedAuthenticationAttributes, encoded as an ASN.1 Element. */ function _encode_CertBasedAuthenticationAttributes(value, elGetter) { if (!_cached_encoder_for_CertBasedAuthenticationAttributes) { _cached_encoder_for_CertBasedAuthenticationAttributes = function (value, elGetter) { return $._encodeSequence([] .concat([ /* REQUIRED */ $._encodeOctetString(value.cha, $.BER), ], value._unrecognizedExtensionsList ? value._unrecognizedExtensionsList : []) .filter((c) => !!c), $.BER); }; } return _cached_encoder_for_CertBasedAuthenticationAttributes(value, elGetter); } exports._encode_CertBasedAuthenticationAttributes = _encode_CertBasedAuthenticationAttributes; /* END_OF_SYMBOL_DEFINITION _encode_CertBasedAuthenticationAttributes */ /* eslint-enable */ //# sourceMappingURL=CertBasedAuthenticationAttributes.ta.js.map