UNPKG

@wildboar/pki-stub

Version:
167 lines 6.4 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports._encode_Holder = exports._decode_Holder = exports._extension_additions_list_spec_for_Holder = exports._root_component_type_list_2_spec_for_Holder = exports._root_component_type_list_1_spec_for_Holder = exports.Holder = void 0; /* eslint-disable */ const asn1_ts_1 = require("asn1-ts"); const $ = require("asn1-ts/dist/node/functional"); const IssuerSerial_ta_1 = require("../PKI-Stub/IssuerSerial.ta"); const GeneralNames_ta_1 = require("../PKI-Stub/GeneralNames.ta"); const ObjectDigestInfo_ta_1 = require("../PKI-Stub/ObjectDigestInfo.ta"); /* START_OF_SYMBOL_DEFINITION Holder */ /** * @summary Holder * @description * * ### ASN.1 Definition: * * ```asn1 * Holder ::= SEQUENCE { * baseCertificateID [0] IssuerSerial OPTIONAL, * entityName [1] GeneralNames OPTIONAL, * objectDigestInfo [2] ObjectDigestInfo OPTIONAL } * (WITH COMPONENTS {..., baseCertificateID PRESENT } | * WITH COMPONENTS {..., entityName PRESENT } | * WITH COMPONENTS {..., objectDigestInfo PRESENT } ) * ``` * * @class */ class Holder { constructor( /** * @summary `baseCertificateID`. * @public * @readonly */ baseCertificateID, /** * @summary `entityName`. * @public * @readonly */ entityName, /** * @summary `objectDigestInfo`. * @public * @readonly */ objectDigestInfo) { this.baseCertificateID = baseCertificateID; this.entityName = entityName; this.objectDigestInfo = objectDigestInfo; } /** * @summary Restructures an object into a Holder * @description * * This takes an `object` and converts it to a `Holder`. * * @public * @static * @method * @param {Object} _o An object having all of the keys and values of a `Holder`. * @returns {Holder} */ static _from_object(_o) { return new Holder(_o.baseCertificateID, _o.entityName, _o.objectDigestInfo); } } exports.Holder = Holder; /* END_OF_SYMBOL_DEFINITION Holder */ /* START_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_Holder */ /** * @summary The Leading Root Component Types of Holder * @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_Holder = [ new $.ComponentSpec("baseCertificateID", true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 0), undefined, undefined), new $.ComponentSpec("entityName", true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 1), undefined, undefined), new $.ComponentSpec("objectDigestInfo", true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 2), undefined, undefined), ]; /* END_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_Holder */ /* START_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_Holder */ /** * @summary The Trailing Root Component Types of Holder * @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_Holder = []; /* END_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_Holder */ /* START_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_Holder */ /** * @summary The Extension Addition Component Types of Holder * @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_Holder = []; /* END_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_Holder */ /* START_OF_SYMBOL_DEFINITION _decode_Holder */ /** * @summary Decodes an ASN.1 element into a(n) Holder * @function * @param {_Element} el The element being decoded. * @returns {Holder} The decoded data structure. */ function _decode_Holder(el) { /* START_OF_SEQUENCE_COMPONENT_DECLARATIONS */ let baseCertificateID; let entityName; let objectDigestInfo; /* END_OF_SEQUENCE_COMPONENT_DECLARATIONS */ /* START_OF_CALLBACKS_MAP */ const callbacks = { baseCertificateID: (_el) => { baseCertificateID = $._decode_implicit(() => IssuerSerial_ta_1._decode_IssuerSerial)(_el); }, entityName: (_el) => { entityName = $._decode_implicit(() => GeneralNames_ta_1._decode_GeneralNames)(_el); }, objectDigestInfo: (_el) => { objectDigestInfo = $._decode_implicit(() => ObjectDigestInfo_ta_1._decode_ObjectDigestInfo)(_el); }, }; /* END_OF_CALLBACKS_MAP */ $._parse_sequence(el, callbacks, exports._root_component_type_list_1_spec_for_Holder, exports._extension_additions_list_spec_for_Holder, exports._root_component_type_list_2_spec_for_Holder, undefined); return new Holder( /* SEQUENCE_CONSTRUCTOR_CALL */ baseCertificateID, entityName, objectDigestInfo); } exports._decode_Holder = _decode_Holder; /* END_OF_SYMBOL_DEFINITION _decode_Holder */ /* START_OF_SYMBOL_DEFINITION _encode_Holder */ /** * @summary Encodes a(n) Holder 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 Holder, encoded as an ASN.1 Element. */ function _encode_Holder(value, elGetter) { const components = []; if (value.baseCertificateID) { const c = $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 0, () => IssuerSerial_ta_1._encode_IssuerSerial, $.BER)(value.baseCertificateID, $.BER); components.push(c); } if (value.entityName) { const c = $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 1, () => GeneralNames_ta_1._encode_GeneralNames, $.BER)(value.entityName, $.BER); components.push(c); } if (value.objectDigestInfo) { const c = $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 2, () => ObjectDigestInfo_ta_1._encode_ObjectDigestInfo, $.BER)(value.objectDigestInfo, $.BER); components.push(c); } return $._encodeSequence(components, $.BER); } exports._encode_Holder = _encode_Holder; /* END_OF_SYMBOL_DEFINITION _encode_Holder */ /* eslint-enable */ //# sourceMappingURL=Holder.ta.js.map