UNPKG

@wildboar/pc

Version:

Trusted Computing Group Platform Certificate ASN.1 data structures in TypeScript

139 lines 6.1 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports._encode_ManufacturerId = exports._decode_ManufacturerId = exports._extension_additions_list_spec_for_ManufacturerId = exports._root_component_type_list_2_spec_for_ManufacturerId = exports._root_component_type_list_1_spec_for_ManufacturerId = exports.ManufacturerId = exports._encode_PrivateEnterpriseNumber = exports._decode_PrivateEnterpriseNumber = void 0; /* eslint-disable */ const asn1_ts_1 = require("asn1-ts"); const $ = require("asn1-ts/dist/node/functional"); const PrivateEnterpriseNumber_ta_1 = require("../PlatformCertificateProfile/PrivateEnterpriseNumber.ta"); var PrivateEnterpriseNumber_ta_2 = require("../PlatformCertificateProfile/PrivateEnterpriseNumber.ta"); Object.defineProperty(exports, "_decode_PrivateEnterpriseNumber", { enumerable: true, get: function () { return PrivateEnterpriseNumber_ta_2._decode_PrivateEnterpriseNumber; } }); Object.defineProperty(exports, "_encode_PrivateEnterpriseNumber", { enumerable: true, get: function () { return PrivateEnterpriseNumber_ta_2._encode_PrivateEnterpriseNumber; } }); /* START_OF_SYMBOL_DEFINITION ManufacturerId */ /** * @summary ManufacturerId * @description * * ### ASN.1 Definition: * * ```asn1 * ManufacturerId ::= SEQUENCE { * manufacturerIdentifier PrivateEnterpriseNumber } * ``` * * @class */ class ManufacturerId { constructor( /** * @summary `manufacturerIdentifier`. * @public * @readonly */ manufacturerIdentifier) { this.manufacturerIdentifier = manufacturerIdentifier; } /** * @summary Restructures an object into a ManufacturerId * @description * * This takes an `object` and converts it to a `ManufacturerId`. * * @public * @static * @method * @param {Object} _o An object having all of the keys and values of a `ManufacturerId`. * @returns {ManufacturerId} */ static _from_object(_o) { return new ManufacturerId(_o.manufacturerIdentifier); } } exports.ManufacturerId = ManufacturerId; /* END_OF_SYMBOL_DEFINITION ManufacturerId */ /* START_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_ManufacturerId */ /** * @summary The Leading Root Component Types of ManufacturerId * @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_ManufacturerId = [ new $.ComponentSpec("manufacturerIdentifier", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 6), undefined, undefined) ]; /* END_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_ManufacturerId */ /* START_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_ManufacturerId */ /** * @summary The Trailing Root Component Types of ManufacturerId * @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_ManufacturerId = []; /* END_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_ManufacturerId */ /* START_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_ManufacturerId */ /** * @summary The Extension Addition Component Types of ManufacturerId * @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_ManufacturerId = []; /* END_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_ManufacturerId */ /* START_OF_SYMBOL_DEFINITION _cached_decoder_for_ManufacturerId */ let _cached_decoder_for_ManufacturerId = null; /* END_OF_SYMBOL_DEFINITION _cached_decoder_for_ManufacturerId */ /* START_OF_SYMBOL_DEFINITION _decode_ManufacturerId */ /** * @summary Decodes an ASN.1 element into a(n) ManufacturerId * @function * @param {_Element} el The element being decoded. * @returns {ManufacturerId} The decoded data structure. */ function _decode_ManufacturerId(el) { if (!_cached_decoder_for_ManufacturerId) { _cached_decoder_for_ManufacturerId = function (el) { const sequence = el.sequence; if (sequence.length < 1) { throw new asn1_ts_1.ASN1ConstructionError("ManufacturerId contained only " + sequence.length.toString() + " elements."); } sequence[0].name = "manufacturerIdentifier"; let manufacturerIdentifier; manufacturerIdentifier = PrivateEnterpriseNumber_ta_1._decode_PrivateEnterpriseNumber(sequence[0]); return new ManufacturerId(manufacturerIdentifier); }; } return _cached_decoder_for_ManufacturerId(el); } exports._decode_ManufacturerId = _decode_ManufacturerId; /* END_OF_SYMBOL_DEFINITION _decode_ManufacturerId */ /* START_OF_SYMBOL_DEFINITION _cached_encoder_for_ManufacturerId */ let _cached_encoder_for_ManufacturerId = null; /* END_OF_SYMBOL_DEFINITION _cached_encoder_for_ManufacturerId */ /* START_OF_SYMBOL_DEFINITION _encode_ManufacturerId */ /** * @summary Encodes a(n) ManufacturerId 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 ManufacturerId, encoded as an ASN.1 Element. */ function _encode_ManufacturerId(value, elGetter) { if (!_cached_encoder_for_ManufacturerId) { _cached_encoder_for_ManufacturerId = function (value, elGetter) { return $._encodeSequence([].concat([ /* REQUIRED */ PrivateEnterpriseNumber_ta_1._encode_PrivateEnterpriseNumber(value.manufacturerIdentifier, $.BER) ]).filter((c) => (!!c)), $.BER); }; } return _cached_encoder_for_ManufacturerId(value, elGetter); } exports._encode_ManufacturerId = _encode_ManufacturerId; /* END_OF_SYMBOL_DEFINITION _encode_ManufacturerId */ /* eslint-enable */ //# sourceMappingURL=ManufacturerId.ta.js.map