UNPKG

@wildboar/pc

Version:

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

179 lines 8.81 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports._encode_Properties = exports._decode_Properties = exports._extension_additions_list_spec_for_Properties = exports._root_component_type_list_2_spec_for_Properties = exports._root_component_type_list_1_spec_for_Properties = exports.Properties = exports._encode_AttributeStatus = exports._decode_AttributeStatus = exports.removed = exports.AttributeStatus_removed = exports.modified = exports.AttributeStatus_modified = exports.added = exports.AttributeStatus_added = exports._enum_for_AttributeStatus = exports.AttributeStatus = void 0; /* eslint-disable */ const asn1_ts_1 = require("asn1-ts"); const $ = require("asn1-ts/dist/node/functional"); const AttributeStatus_ta_1 = require("../PlatformCertificateProfile/AttributeStatus.ta"); var AttributeStatus_ta_2 = require("../PlatformCertificateProfile/AttributeStatus.ta"); Object.defineProperty(exports, "AttributeStatus", { enumerable: true, get: function () { return AttributeStatus_ta_2.AttributeStatus; } }); Object.defineProperty(exports, "_enum_for_AttributeStatus", { enumerable: true, get: function () { return AttributeStatus_ta_2._enum_for_AttributeStatus; } }); Object.defineProperty(exports, "AttributeStatus_added", { enumerable: true, get: function () { return AttributeStatus_ta_2.AttributeStatus_added; } }); /* IMPORTED_LONG_ENUMERATION_ITEM */ Object.defineProperty(exports, "added", { enumerable: true, get: function () { return AttributeStatus_ta_2.added; } }); /* IMPORTED_SHORT_ENUMERATION_ITEM */ Object.defineProperty(exports, "AttributeStatus_modified", { enumerable: true, get: function () { return AttributeStatus_ta_2.AttributeStatus_modified; } }); /* IMPORTED_LONG_ENUMERATION_ITEM */ Object.defineProperty(exports, "modified", { enumerable: true, get: function () { return AttributeStatus_ta_2.modified; } }); /* IMPORTED_SHORT_ENUMERATION_ITEM */ Object.defineProperty(exports, "AttributeStatus_removed", { enumerable: true, get: function () { return AttributeStatus_ta_2.AttributeStatus_removed; } }); /* IMPORTED_LONG_ENUMERATION_ITEM */ Object.defineProperty(exports, "removed", { enumerable: true, get: function () { return AttributeStatus_ta_2.removed; } }); /* IMPORTED_SHORT_ENUMERATION_ITEM */ Object.defineProperty(exports, "_decode_AttributeStatus", { enumerable: true, get: function () { return AttributeStatus_ta_2._decode_AttributeStatus; } }); Object.defineProperty(exports, "_encode_AttributeStatus", { enumerable: true, get: function () { return AttributeStatus_ta_2._encode_AttributeStatus; } }); /* START_OF_SYMBOL_DEFINITION Properties */ /** * @summary Properties * @description * * ### ASN.1 Definition: * * ```asn1 * Properties ::= SEQUENCE { * propertyName UTF8String (SIZE (1..strmax)), * propertyValue UTF8String (SIZE (1..strmax)), * status [0] IMPLICIT AttributeStatus OPTIONAL } * ``` * * @class */ class Properties { constructor( /** * @summary `propertyName`. * @public * @readonly */ propertyName, /** * @summary `propertyValue`. * @public * @readonly */ propertyValue, /** * @summary `status`. * @public * @readonly */ status) { this.propertyName = propertyName; this.propertyValue = propertyValue; this.status = status; } /** * @summary Restructures an object into a Properties * @description * * This takes an `object` and converts it to a `Properties`. * * @public * @static * @method * @param {Object} _o An object having all of the keys and values of a `Properties`. * @returns {Properties} */ static _from_object(_o) { return new Properties(_o.propertyName, _o.propertyValue, _o.status); } } exports.Properties = Properties; /** * @summary The enum used as the type of the component `status` * @public * @static */ Properties._enum_for_status = AttributeStatus_ta_1._enum_for_AttributeStatus; /* END_OF_SYMBOL_DEFINITION Properties */ /* START_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_Properties */ /** * @summary The Leading Root Component Types of Properties * @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_Properties = [ new $.ComponentSpec("propertyName", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 12), undefined, undefined), new $.ComponentSpec("propertyValue", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 12), undefined, undefined), new $.ComponentSpec("status", true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 0), undefined, undefined) ]; /* END_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_Properties */ /* START_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_Properties */ /** * @summary The Trailing Root Component Types of Properties * @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_Properties = []; /* END_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_Properties */ /* START_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_Properties */ /** * @summary The Extension Addition Component Types of Properties * @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_Properties = []; /* END_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_Properties */ /* START_OF_SYMBOL_DEFINITION _cached_decoder_for_Properties */ let _cached_decoder_for_Properties = null; /* END_OF_SYMBOL_DEFINITION _cached_decoder_for_Properties */ /* START_OF_SYMBOL_DEFINITION _decode_Properties */ /** * @summary Decodes an ASN.1 element into a(n) Properties * @function * @param {_Element} el The element being decoded. * @returns {Properties} The decoded data structure. */ function _decode_Properties(el) { if (!_cached_decoder_for_Properties) { _cached_decoder_for_Properties = function (el) { /* START_OF_SEQUENCE_COMPONENT_DECLARATIONS */ let propertyName; let propertyValue; let status; /* END_OF_SEQUENCE_COMPONENT_DECLARATIONS */ /* START_OF_CALLBACKS_MAP */ const callbacks = { "propertyName": (_el) => { propertyName = $._decodeUTF8String(_el); }, "propertyValue": (_el) => { propertyValue = $._decodeUTF8String(_el); }, "status": (_el) => { status = $._decode_implicit(() => AttributeStatus_ta_1._decode_AttributeStatus)(_el); } }; /* END_OF_CALLBACKS_MAP */ $._parse_sequence(el, callbacks, exports._root_component_type_list_1_spec_for_Properties, exports._extension_additions_list_spec_for_Properties, exports._root_component_type_list_2_spec_for_Properties, undefined); return new Properties(/* SEQUENCE_CONSTRUCTOR_CALL */ propertyName, propertyValue, status); }; } return _cached_decoder_for_Properties(el); } exports._decode_Properties = _decode_Properties; /* END_OF_SYMBOL_DEFINITION _decode_Properties */ /* START_OF_SYMBOL_DEFINITION _cached_encoder_for_Properties */ let _cached_encoder_for_Properties = null; /* END_OF_SYMBOL_DEFINITION _cached_encoder_for_Properties */ /* START_OF_SYMBOL_DEFINITION _encode_Properties */ /** * @summary Encodes a(n) Properties 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 Properties, encoded as an ASN.1 Element. */ function _encode_Properties(value, elGetter) { if (!_cached_encoder_for_Properties) { _cached_encoder_for_Properties = function (value, elGetter) { return $._encodeSequence([].concat([ /* REQUIRED */ $._encodeUTF8String(value.propertyName, $.BER), /* REQUIRED */ $._encodeUTF8String(value.propertyValue, $.BER), /* IF_ABSENT */ ((value.status === undefined) ? undefined : $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 0, () => AttributeStatus_ta_1._encode_AttributeStatus, $.BER)(value.status, $.BER)) ]).filter((c) => (!!c)), $.BER); }; } return _cached_encoder_for_Properties(value, elGetter); } exports._encode_Properties = _encode_Properties; /* END_OF_SYMBOL_DEFINITION _encode_Properties */ /* eslint-enable */ //# sourceMappingURL=Properties.ta.js.map