@wildboar/pki-stub
Version:
X.510 PKI-Stub ASN.1 data structures in TypeScript
171 lines • 7.14 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports._encode_TBSCertAVL_entries_Item = exports._decode_TBSCertAVL_entries_Item = exports._extension_additions_list_spec_for_TBSCertAVL_entries_Item = exports._root_component_type_list_2_spec_for_TBSCertAVL_entries_Item = exports._root_component_type_list_1_spec_for_TBSCertAVL_entries_Item = exports.TBSCertAVL_entries_Item = void 0;
/* eslint-disable */
const asn1_ts_1 = require("asn1-ts");
const $ = require("asn1-ts/dist/node/functional");
const TBSCertAVL_entries_Item_idType_ta_1 = require("../PKI-Stub/TBSCertAVL-entries-Item-idType.ta");
const Extensions_ta_1 = require("../PKI-Stub/Extensions.ta");
const ScopeRestrictions_ta_1 = require("../AuthenticationFramework/ScopeRestrictions.ta");
/* START_OF_SYMBOL_DEFINITION TBSCertAVL_entries_Item */
/**
* @summary TBSCertAVL_entries_Item
* @description
*
* ### ASN.1 Definition:
*
* ```asn1
* TBSCertAVL-entries-Item ::= SEQUENCE { -- REMOVED_FROM_UNNESTING -- }
* ```
*
* @class
*/
class TBSCertAVL_entries_Item {
constructor(
/**
* @summary `idType`.
* @public
* @readonly
*/
idType,
/**
* @summary `scope`.
* @public
* @readonly
*/
scope,
/**
* @summary `entryExtensions`.
* @public
* @readonly
*/
entryExtensions,
/**
* @summary Extensions that are not recognized.
* @public
* @readonly
*/
_unrecognizedExtensionsList = []) {
this.idType = idType;
this.scope = scope;
this.entryExtensions = entryExtensions;
this._unrecognizedExtensionsList = _unrecognizedExtensionsList;
}
/**
* @summary Restructures an object into a TBSCertAVL_entries_Item
* @description
*
* This takes an `object` and converts it to a `TBSCertAVL_entries_Item`.
*
* @public
* @static
* @method
* @param {Object} _o An object having all of the keys and values of a `TBSCertAVL_entries_Item`.
* @returns {TBSCertAVL_entries_Item}
*/
static _from_object(_o) {
return new TBSCertAVL_entries_Item(_o.idType, _o.scope, _o.entryExtensions, _o._unrecognizedExtensionsList);
}
}
exports.TBSCertAVL_entries_Item = TBSCertAVL_entries_Item;
/* END_OF_SYMBOL_DEFINITION TBSCertAVL_entries_Item */
/* START_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_TBSCertAVL_entries_Item */
/**
* @summary The Leading Root Component Types of TBSCertAVL_entries_Item
* @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_TBSCertAVL_entries_Item = [
new $.ComponentSpec("idType", false, $.hasAnyTag, undefined, undefined),
,
/* FIXME: scope COULD_NOT_RESOLVE_TYPE_DEF */ new $.ComponentSpec("entryExtensions", true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 1), undefined, undefined),
];
/* END_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_TBSCertAVL_entries_Item */
/* START_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_TBSCertAVL_entries_Item */
/**
* @summary The Trailing Root Component Types of TBSCertAVL_entries_Item
* @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_TBSCertAVL_entries_Item = [];
/* END_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_TBSCertAVL_entries_Item */
/* START_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_TBSCertAVL_entries_Item */
/**
* @summary The Extension Addition Component Types of TBSCertAVL_entries_Item
* @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_TBSCertAVL_entries_Item = [];
/* END_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_TBSCertAVL_entries_Item */
/* START_OF_SYMBOL_DEFINITION _decode_TBSCertAVL_entries_Item */
/**
* @summary Decodes an ASN.1 element into a(n) TBSCertAVL_entries_Item
* @function
* @param {_Element} el The element being decoded.
* @returns {TBSCertAVL_entries_Item} The decoded data structure.
*/
function _decode_TBSCertAVL_entries_Item(el) {
/* START_OF_SEQUENCE_COMPONENT_DECLARATIONS */
let idType;
let scope;
let entryExtensions;
let _unrecognizedExtensionsList = [];
/* END_OF_SEQUENCE_COMPONENT_DECLARATIONS */
/* START_OF_CALLBACKS_MAP */
const callbacks = {
idType: (_el) => {
idType = TBSCertAVL_entries_Item_idType_ta_1._decode_TBSCertAVL_entries_Item_idType(_el);
},
scope: (_el) => {
scope = $._decode_implicit(() => ScopeRestrictions_ta_1._decode_ScopeRestrictions)(_el);
},
entryExtensions: (_el) => {
entryExtensions = $._decode_implicit(() => Extensions_ta_1._decode_Extensions)(_el);
},
};
/* END_OF_CALLBACKS_MAP */
$._parse_sequence(el, callbacks, exports._root_component_type_list_1_spec_for_TBSCertAVL_entries_Item, exports._extension_additions_list_spec_for_TBSCertAVL_entries_Item, exports._root_component_type_list_2_spec_for_TBSCertAVL_entries_Item, (ext) => {
_unrecognizedExtensionsList.push(ext);
});
return new TBSCertAVL_entries_Item(
/* SEQUENCE_CONSTRUCTOR_CALL */ idType, scope, entryExtensions, _unrecognizedExtensionsList);
}
exports._decode_TBSCertAVL_entries_Item = _decode_TBSCertAVL_entries_Item;
/* END_OF_SYMBOL_DEFINITION _decode_TBSCertAVL_entries_Item */
/* START_OF_SYMBOL_DEFINITION _encode_TBSCertAVL_entries_Item */
/**
* @summary Encodes a(n) TBSCertAVL_entries_Item 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 TBSCertAVL_entries_Item, encoded as an ASN.1 Element.
*/
function _encode_TBSCertAVL_entries_Item(value, elGetter) {
var _a, _b;
const components = [
TBSCertAVL_entries_Item_idType_ta_1._encode_TBSCertAVL_entries_Item_idType(value.idType, $.BER),
];
if (value.scope) {
const c = $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 0, () => ScopeRestrictions_ta_1._encode_ScopeRestrictions, $.BER)(value.scope, $.BER);
components.push(c);
}
if ((_a = value.entryExtensions) === null || _a === void 0 ? void 0 : _a.length) {
const c = $._encode_implicit(asn1_ts_1.ASN1TagClass.context, 1, () => Extensions_ta_1._encode_Extensions, $.BER)(value.entryExtensions, $.BER);
components.push(c);
}
components.push(...(_b = value._unrecognizedExtensionsList) !== null && _b !== void 0 ? _b : []);
return $._encodeSequence(components, $.BER);
}
exports._encode_TBSCertAVL_entries_Item = _encode_TBSCertAVL_entries_Item;
/* END_OF_SYMBOL_DEFINITION _encode_TBSCertAVL_entries_Item */
/* eslint-enable */
//# sourceMappingURL=TBSCertAVL-entries-Item.ta.js.map