UNPKG

@wildboar/pkcs

Version:
205 lines 9.06 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports._encode_UnusedSpace = exports._decode_UnusedSpace = exports._extension_additions_list_spec_for_UnusedSpace = exports._root_component_type_list_2_spec_for_UnusedSpace = exports._root_component_type_list_1_spec_for_UnusedSpace = exports.UnusedSpace = exports._encode_Path = exports._decode_Path = exports.Path = exports._encode_Identifier = exports._decode_Identifier = exports._encode_AccessControlRule = exports._decode_AccessControlRule = exports.AccessControlRule = void 0; /* eslint-disable */ const asn1_ts_1 = require("asn1-ts"); const $ = require("asn1-ts/dist/node/functional"); const AccessControlRule_ta_1 = require("../PKCS-15/AccessControlRule.ta"); const Identifier_ta_1 = require("../PKCS-15/Identifier.ta"); const Path_ta_1 = require("../PKCS-15/Path.ta"); var AccessControlRule_ta_2 = require("../PKCS-15/AccessControlRule.ta"); Object.defineProperty(exports, "AccessControlRule", { enumerable: true, get: function () { return AccessControlRule_ta_2.AccessControlRule; } }); Object.defineProperty(exports, "_decode_AccessControlRule", { enumerable: true, get: function () { return AccessControlRule_ta_2._decode_AccessControlRule; } }); Object.defineProperty(exports, "_encode_AccessControlRule", { enumerable: true, get: function () { return AccessControlRule_ta_2._encode_AccessControlRule; } }); var Identifier_ta_2 = require("../PKCS-15/Identifier.ta"); Object.defineProperty(exports, "_decode_Identifier", { enumerable: true, get: function () { return Identifier_ta_2._decode_Identifier; } }); Object.defineProperty(exports, "_encode_Identifier", { enumerable: true, get: function () { return Identifier_ta_2._encode_Identifier; } }); var Path_ta_2 = require("../PKCS-15/Path.ta"); Object.defineProperty(exports, "Path", { enumerable: true, get: function () { return Path_ta_2.Path; } }); Object.defineProperty(exports, "_decode_Path", { enumerable: true, get: function () { return Path_ta_2._decode_Path; } }); Object.defineProperty(exports, "_encode_Path", { enumerable: true, get: function () { return Path_ta_2._encode_Path; } }); /* START_OF_SYMBOL_DEFINITION UnusedSpace */ /** * @summary UnusedSpace * @description * * ### ASN.1 Definition: * * ```asn1 * UnusedSpace ::= SEQUENCE { * path Path (WITH COMPONENTS {..., index PRESENT, length PRESENT}), * authId Identifier OPTIONAL, * ..., * accessControlRules SEQUENCE OF AccessControlRule OPTIONAL * } * ``` * * @class */ class UnusedSpace { constructor( /** * @summary `path`. * @public * @readonly */ path, /** * @summary `authId`. * @public * @readonly */ authId, /** * @summary `accessControlRules`. * @public * @readonly */ accessControlRules, /** * @summary Extensions that are not recognized. * @public * @readonly */ _unrecognizedExtensionsList = []) { this.path = path; this.authId = authId; this.accessControlRules = accessControlRules; this._unrecognizedExtensionsList = _unrecognizedExtensionsList; } /** * @summary Restructures an object into a UnusedSpace * @description * * This takes an `object` and converts it to a `UnusedSpace`. * * @public * @static * @method * @param {Object} _o An object having all of the keys and values of a `UnusedSpace`. * @returns {UnusedSpace} */ static _from_object(_o) { return new UnusedSpace(_o.path, _o.authId, _o.accessControlRules, _o._unrecognizedExtensionsList); } } exports.UnusedSpace = UnusedSpace; /* END_OF_SYMBOL_DEFINITION UnusedSpace */ /* START_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_UnusedSpace */ /** * @summary The Leading Root Component Types of UnusedSpace * @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_UnusedSpace = [ new $.ComponentSpec("path", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 16), undefined, undefined), new $.ComponentSpec("authId", true, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 4), undefined, undefined), ]; /* END_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_UnusedSpace */ /* START_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_UnusedSpace */ /** * @summary The Trailing Root Component Types of UnusedSpace * @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_UnusedSpace = []; /* END_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_UnusedSpace */ /* START_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_UnusedSpace */ /** * @summary The Extension Addition Component Types of UnusedSpace * @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_UnusedSpace = [ new $.ComponentSpec("accessControlRules", true, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 16), undefined, undefined), ]; /* END_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_UnusedSpace */ /* START_OF_SYMBOL_DEFINITION _cached_decoder_for_UnusedSpace */ let _cached_decoder_for_UnusedSpace = null; /* END_OF_SYMBOL_DEFINITION _cached_decoder_for_UnusedSpace */ /* START_OF_SYMBOL_DEFINITION _decode_UnusedSpace */ /** * @summary Decodes an ASN.1 element into a(n) UnusedSpace * @function * @param {_Element} el The element being decoded. * @returns {UnusedSpace} The decoded data structure. */ function _decode_UnusedSpace(el) { if (!_cached_decoder_for_UnusedSpace) { _cached_decoder_for_UnusedSpace = function (el) { /* START_OF_SEQUENCE_COMPONENT_DECLARATIONS */ let path; let authId; let accessControlRules; let _unrecognizedExtensionsList = []; /* END_OF_SEQUENCE_COMPONENT_DECLARATIONS */ /* START_OF_CALLBACKS_MAP */ const callbacks = { path: (_el) => { path = Path_ta_1._decode_Path(_el); }, authId: (_el) => { authId = Identifier_ta_1._decode_Identifier(_el); }, accessControlRules: (_el) => { accessControlRules = $._decodeSequenceOf(() => AccessControlRule_ta_1._decode_AccessControlRule)(_el); }, }; /* END_OF_CALLBACKS_MAP */ $._parse_sequence(el, callbacks, exports._root_component_type_list_1_spec_for_UnusedSpace, exports._extension_additions_list_spec_for_UnusedSpace, exports._root_component_type_list_2_spec_for_UnusedSpace, (ext) => { _unrecognizedExtensionsList.push(ext); }); return new UnusedSpace( /* SEQUENCE_CONSTRUCTOR_CALL */ path, authId, accessControlRules, _unrecognizedExtensionsList); }; } return _cached_decoder_for_UnusedSpace(el); } exports._decode_UnusedSpace = _decode_UnusedSpace; /* END_OF_SYMBOL_DEFINITION _decode_UnusedSpace */ /* START_OF_SYMBOL_DEFINITION _cached_encoder_for_UnusedSpace */ let _cached_encoder_for_UnusedSpace = null; /* END_OF_SYMBOL_DEFINITION _cached_encoder_for_UnusedSpace */ /* START_OF_SYMBOL_DEFINITION _encode_UnusedSpace */ /** * @summary Encodes a(n) UnusedSpace 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 UnusedSpace, encoded as an ASN.1 Element. */ function _encode_UnusedSpace(value, elGetter) { if (!_cached_encoder_for_UnusedSpace) { _cached_encoder_for_UnusedSpace = function (value, elGetter) { return $._encodeSequence([] .concat([ /* REQUIRED */ Path_ta_1._encode_Path(value.path, $.BER), /* IF_ABSENT */ value.authId === undefined ? undefined : Identifier_ta_1._encode_Identifier(value.authId, $.BER), ], [ /* IF_ABSENT */ value.accessControlRules === undefined ? undefined : $._encodeSequenceOf(() => AccessControlRule_ta_1._encode_AccessControlRule, $.BER)(value.accessControlRules, $.BER), ], value._unrecognizedExtensionsList ? value._unrecognizedExtensionsList : []) .filter((c) => !!c), $.BER); }; } return _cached_encoder_for_UnusedSpace(value, elGetter); } exports._encode_UnusedSpace = _encode_UnusedSpace; /* END_OF_SYMBOL_DEFINITION _encode_UnusedSpace */ /* eslint-enable */ //# sourceMappingURL=UnusedSpace.ta.js.map