@wildboar/pc
Version:
Trusted Computing Group Platform Certificate ASN.1 data structures in TypeScript
188 lines • 11.1 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports._encode_PlatformConfiguration = exports._decode_PlatformConfiguration = exports._extension_additions_list_spec_for_PlatformConfiguration = exports._root_component_type_list_2_spec_for_PlatformConfiguration = exports._root_component_type_list_1_spec_for_PlatformConfiguration = exports.PlatformConfiguration = exports._encode_Properties = exports._decode_Properties = exports.Properties = exports._encode_URIReference = exports._decode_URIReference = exports.URIReference = exports._encode_ComponentIdentifier = exports._decode_ComponentIdentifier = exports.ComponentIdentifier = void 0;
/* eslint-disable */
const asn1_ts_1 = require("asn1-ts");
const $ = require("asn1-ts/dist/node/functional");
const ComponentIdentifier_ta_1 = require("../PlatformCertificateProfile/ComponentIdentifier.ta");
var ComponentIdentifier_ta_2 = require("../PlatformCertificateProfile/ComponentIdentifier.ta");
Object.defineProperty(exports, "ComponentIdentifier", { enumerable: true, get: function () { return ComponentIdentifier_ta_2.ComponentIdentifier; } });
Object.defineProperty(exports, "_decode_ComponentIdentifier", { enumerable: true, get: function () { return ComponentIdentifier_ta_2._decode_ComponentIdentifier; } });
Object.defineProperty(exports, "_encode_ComponentIdentifier", { enumerable: true, get: function () { return ComponentIdentifier_ta_2._encode_ComponentIdentifier; } });
const URIReference_ta_1 = require("../PlatformCertificateProfile/URIReference.ta");
var URIReference_ta_2 = require("../PlatformCertificateProfile/URIReference.ta");
Object.defineProperty(exports, "URIReference", { enumerable: true, get: function () { return URIReference_ta_2.URIReference; } });
Object.defineProperty(exports, "_decode_URIReference", { enumerable: true, get: function () { return URIReference_ta_2._decode_URIReference; } });
Object.defineProperty(exports, "_encode_URIReference", { enumerable: true, get: function () { return URIReference_ta_2._encode_URIReference; } });
const Properties_ta_1 = require("../PlatformCertificateProfile/Properties.ta");
var Properties_ta_2 = require("../PlatformCertificateProfile/Properties.ta");
Object.defineProperty(exports, "Properties", { enumerable: true, get: function () { return Properties_ta_2.Properties; } });
Object.defineProperty(exports, "_decode_Properties", { enumerable: true, get: function () { return Properties_ta_2._decode_Properties; } });
Object.defineProperty(exports, "_encode_Properties", { enumerable: true, get: function () { return Properties_ta_2._encode_Properties; } });
/* START_OF_SYMBOL_DEFINITION PlatformConfiguration */
/**
* @summary PlatformConfiguration
* @description
*
* ### ASN.1 Definition:
*
* ```asn1
* PlatformConfiguration ::= SEQUENCE {
* componentIdentifiers [0] IMPLICIT SEQUENCE (SIZE(1..MAX)) OF ComponentIdentifier OPTIONAL,
* componentIdentifiersUri [1] IMPLICIT URIReference OPTIONAL,
* platformProperties [2] IMPLICIT SEQUENCE (SIZE(1..MAX)) OF Properties OPTIONAL,
* platformPropertiesUri [3] IMPLICIT URIReference OPTIONAL }
* ```
*
* @class
*/
class PlatformConfiguration {
constructor(
/**
* @summary `componentIdentifiers`.
* @public
* @readonly
*/
componentIdentifiers,
/**
* @summary `componentIdentifiersUri`.
* @public
* @readonly
*/
componentIdentifiersUri,
/**
* @summary `platformProperties`.
* @public
* @readonly
*/
platformProperties,
/**
* @summary `platformPropertiesUri`.
* @public
* @readonly
*/
platformPropertiesUri) {
this.componentIdentifiers = componentIdentifiers;
this.componentIdentifiersUri = componentIdentifiersUri;
this.platformProperties = platformProperties;
this.platformPropertiesUri = platformPropertiesUri;
}
/**
* @summary Restructures an object into a PlatformConfiguration
* @description
*
* This takes an `object` and converts it to a `PlatformConfiguration`.
*
* @public
* @static
* @method
* @param {Object} _o An object having all of the keys and values of a `PlatformConfiguration`.
* @returns {PlatformConfiguration}
*/
static _from_object(_o) {
return new PlatformConfiguration(_o.componentIdentifiers, _o.componentIdentifiersUri, _o.platformProperties, _o.platformPropertiesUri);
}
}
exports.PlatformConfiguration = PlatformConfiguration;
/* END_OF_SYMBOL_DEFINITION PlatformConfiguration */
/* START_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_PlatformConfiguration */
/**
* @summary The Leading Root Component Types of PlatformConfiguration
* @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_PlatformConfiguration = [
new $.ComponentSpec("componentIdentifiers", true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 0), undefined, undefined),
new $.ComponentSpec("componentIdentifiersUri", true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 1), undefined, undefined),
new $.ComponentSpec("platformProperties", true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 2), undefined, undefined),
new $.ComponentSpec("platformPropertiesUri", true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 3), undefined, undefined)
];
/* END_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_PlatformConfiguration */
/* START_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_PlatformConfiguration */
/**
* @summary The Trailing Root Component Types of PlatformConfiguration
* @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_PlatformConfiguration = [];
/* END_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_PlatformConfiguration */
/* START_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_PlatformConfiguration */
/**
* @summary The Extension Addition Component Types of PlatformConfiguration
* @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_PlatformConfiguration = [];
/* END_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_PlatformConfiguration */
/* START_OF_SYMBOL_DEFINITION _cached_decoder_for_PlatformConfiguration */
let _cached_decoder_for_PlatformConfiguration = null;
/* END_OF_SYMBOL_DEFINITION _cached_decoder_for_PlatformConfiguration */
/* START_OF_SYMBOL_DEFINITION _decode_PlatformConfiguration */
/**
* @summary Decodes an ASN.1 element into a(n) PlatformConfiguration
* @function
* @param {_Element} el The element being decoded.
* @returns {PlatformConfiguration} The decoded data structure.
*/
function _decode_PlatformConfiguration(el) {
if (!_cached_decoder_for_PlatformConfiguration) {
_cached_decoder_for_PlatformConfiguration = function (el) {
/* START_OF_SEQUENCE_COMPONENT_DECLARATIONS */
let componentIdentifiers;
let componentIdentifiersUri;
let platformProperties;
let platformPropertiesUri;
/* END_OF_SEQUENCE_COMPONENT_DECLARATIONS */
/* START_OF_CALLBACKS_MAP */
const callbacks = {
"componentIdentifiers": (_el) => { componentIdentifiers = $._decode_implicit(() => $._decodeSequenceOf(() => ComponentIdentifier_ta_1._decode_ComponentIdentifier))(_el); },
"componentIdentifiersUri": (_el) => { componentIdentifiersUri = $._decode_implicit(() => URIReference_ta_1._decode_URIReference)(_el); },
"platformProperties": (_el) => { platformProperties = $._decode_implicit(() => $._decodeSequenceOf(() => Properties_ta_1._decode_Properties))(_el); },
"platformPropertiesUri": (_el) => { platformPropertiesUri = $._decode_implicit(() => URIReference_ta_1._decode_URIReference)(_el); }
};
/* END_OF_CALLBACKS_MAP */
$._parse_sequence(el, callbacks, exports._root_component_type_list_1_spec_for_PlatformConfiguration, exports._extension_additions_list_spec_for_PlatformConfiguration, exports._root_component_type_list_2_spec_for_PlatformConfiguration, undefined);
return new PlatformConfiguration(/* SEQUENCE_CONSTRUCTOR_CALL */ componentIdentifiers, componentIdentifiersUri, platformProperties, platformPropertiesUri);
};
}
return _cached_decoder_for_PlatformConfiguration(el);
}
exports._decode_PlatformConfiguration = _decode_PlatformConfiguration;
/* END_OF_SYMBOL_DEFINITION _decode_PlatformConfiguration */
/* START_OF_SYMBOL_DEFINITION _cached_encoder_for_PlatformConfiguration */
let _cached_encoder_for_PlatformConfiguration = null;
/* END_OF_SYMBOL_DEFINITION _cached_encoder_for_PlatformConfiguration */
/* START_OF_SYMBOL_DEFINITION _encode_PlatformConfiguration */
/**
* @summary Encodes a(n) PlatformConfiguration 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 PlatformConfiguration, encoded as an ASN.1 Element.
*/
function _encode_PlatformConfiguration(value, elGetter) {
if (!_cached_encoder_for_PlatformConfiguration) {
_cached_encoder_for_PlatformConfiguration = function (value, elGetter) {
return $._encodeSequence([].concat([
/* IF_ABSENT */ ((value.componentIdentifiers === undefined) ? undefined : $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 0, () => $._encodeSequenceOf(() => ComponentIdentifier_ta_1._encode_ComponentIdentifier, $.BER), $.BER)(value.componentIdentifiers, $.BER)),
/* IF_ABSENT */ ((value.componentIdentifiersUri === undefined) ? undefined : $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 1, () => URIReference_ta_1._encode_URIReference, $.BER)(value.componentIdentifiersUri, $.BER)),
/* IF_ABSENT */ ((value.platformProperties === undefined) ? undefined : $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 2, () => $._encodeSequenceOf(() => Properties_ta_1._encode_Properties, $.BER), $.BER)(value.platformProperties, $.BER)),
/* IF_ABSENT */ ((value.platformPropertiesUri === undefined) ? undefined : $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 3, () => URIReference_ta_1._encode_URIReference, $.BER)(value.platformPropertiesUri, $.BER))
]).filter((c) => (!!c)), $.BER);
};
}
return _cached_encoder_for_PlatformConfiguration(value, elGetter);
}
exports._encode_PlatformConfiguration = _encode_PlatformConfiguration;
/* END_OF_SYMBOL_DEFINITION _encode_PlatformConfiguration */
/* eslint-enable */
//# sourceMappingURL=PlatformConfiguration.ta.js.map