UNPKG

@wildboar/pkcs

Version:
140 lines 5.78 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports._get_encoder_for_KeyInfo_paramsAndOps = exports._get_decoder_for_KeyInfo_paramsAndOps = exports._extension_additions_list_spec_for_KeyInfo_paramsAndOps = exports._root_component_type_list_2_spec_for_KeyInfo_paramsAndOps = exports._root_component_type_list_1_spec_for_KeyInfo_paramsAndOps = exports.KeyInfo_paramsAndOps = void 0; const $ = require("asn1-ts/dist/node/functional"); /* START_OF_SYMBOL_DEFINITION KeyInfo_paramsAndOps */ /** * @summary KeyInfo_paramsAndOps * @description * * ### ASN.1 Definition: * * ```asn1 * KeyInfo-paramsAndOps ::= SEQUENCE { -- REMOVED_FROM_UNNESTING -- } * ``` * * @class */ class KeyInfo_paramsAndOps { constructor( /** * @summary `parameters`. * @public * @readonly */ parameters, /** * @summary `supportedOperations`. * @public * @readonly */ supportedOperations) { this.parameters = parameters; this.supportedOperations = supportedOperations; } /** * @summary Restructures an object into a KeyInfo_paramsAndOps * @description * * This takes an `object` and converts it to a `KeyInfo_paramsAndOps`. * * @public * @static * @method * @param {Object} _o An object having all of the keys and values of a `KeyInfo_paramsAndOps`. * @returns {KeyInfo_paramsAndOps} */ static _from_object(_o) { return new KeyInfo_paramsAndOps(_o.parameters, _o.supportedOperations); } } exports.KeyInfo_paramsAndOps = KeyInfo_paramsAndOps; /* END_OF_SYMBOL_DEFINITION KeyInfo_paramsAndOps */ /* START_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_KeyInfo_paramsAndOps */ /** * @summary The Leading Root Component Types of KeyInfo_paramsAndOps * @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_KeyInfo_paramsAndOps = [ new $.ComponentSpec("parameters", false, $.hasAnyTag, undefined, undefined), new $.ComponentSpec("supportedOperations", true, $.hasAnyTag, undefined, undefined), ]; /* END_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_KeyInfo_paramsAndOps */ /* START_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_KeyInfo_paramsAndOps */ /** * @summary The Trailing Root Component Types of KeyInfo_paramsAndOps * @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_KeyInfo_paramsAndOps = []; /* END_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_KeyInfo_paramsAndOps */ /* START_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_KeyInfo_paramsAndOps */ /** * @summary The Extension Addition Component Types of KeyInfo_paramsAndOps * @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_KeyInfo_paramsAndOps = []; /* END_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_KeyInfo_paramsAndOps */ /* START_OF_SYMBOL_DEFINITION _get_decoder_for_KeyInfo_paramsAndOps */ /** * @summary Returns a function that will decode an ASN.1 element into a(n) KeyInfo_paramsAndOps * @function * @param {_Element} el The element being decoded. * @returns A function that will decode an ASN.1 element. */ function _get_decoder_for_KeyInfo_paramsAndOps(_decode_ParameterType, _decode_OperationsType) { return function (el) { /* START_OF_SEQUENCE_COMPONENT_DECLARATIONS */ let parameters; let supportedOperations; /* END_OF_SEQUENCE_COMPONENT_DECLARATIONS */ /* START_OF_CALLBACKS_MAP */ const callbacks = { parameters: (_el) => { parameters = _decode_ParameterType(_el); }, supportedOperations: (_el) => { supportedOperations = _decode_OperationsType(_el); }, }; /* END_OF_CALLBACKS_MAP */ $._parse_sequence(el, callbacks, exports._root_component_type_list_1_spec_for_KeyInfo_paramsAndOps, exports._extension_additions_list_spec_for_KeyInfo_paramsAndOps, exports._root_component_type_list_2_spec_for_KeyInfo_paramsAndOps, undefined); return new KeyInfo_paramsAndOps( /* SEQUENCE_CONSTRUCTOR_CALL */ parameters, supportedOperations); }; } exports._get_decoder_for_KeyInfo_paramsAndOps = _get_decoder_for_KeyInfo_paramsAndOps; /* END_OF_SYMBOL_DEFINITION _get_decoder_for_KeyInfo_paramsAndOps */ /* START_OF_SYMBOL_DEFINITION _get_encoder_for_KeyInfo_paramsAndOps */ /** * @summary Returns a function that will encode a(n) KeyInfo_paramsAndOps into an ASN.1 Element. * @function * @returns A function that will encode a(n) KeyInfo_paramsAndOps as an ASN.1 element. */ function _get_encoder_for_KeyInfo_paramsAndOps(_encode_ParameterType, _encode_OperationsType) { return function (value, elGetter) { return $._encodeSequence([] .concat([ /* REQUIRED */ _encode_ParameterType(value.parameters, $.BER), /* IF_ABSENT */ value.supportedOperations === undefined ? undefined : _encode_OperationsType(value.supportedOperations, $.BER), ]) .filter((c) => !!c), $.BER); }; } exports._get_encoder_for_KeyInfo_paramsAndOps = _get_encoder_for_KeyInfo_paramsAndOps; /* END_OF_SYMBOL_DEFINITION _get_encoder_for_KeyInfo_paramsAndOps */ /* eslint-enable */ //# sourceMappingURL=KeyInfo-paramsAndOps.ta.js.map