@wildboar/pki-stub
Version:
X.510 PKI-Stub ASN.1 data structures in TypeScript
174 lines • 6.87 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports._encode_AlgorithmWithInvoke = exports._decode_AlgorithmWithInvoke = exports._extension_additions_list_spec_for_AlgorithmWithInvoke = exports._root_component_type_list_2_spec_for_AlgorithmWithInvoke = exports._root_component_type_list_1_spec_for_AlgorithmWithInvoke = exports.AlgorithmWithInvoke = void 0;
/* eslint-disable */
const asn1_ts_1 = require("asn1-ts");
const $ = require("asn1-ts/dist/node/functional");
/* START_OF_SYMBOL_DEFINITION AlgorithmWithInvoke */
/**
* @summary AlgorithmWithInvoke
* @description
*
* ### ASN.1 Definition:
*
* ```asn1
* AlgorithmWithInvoke{ALGORITHM:SupportedAlgorithms} ::= SEQUENCE {
* algorithm ALGORITHM.&id({SupportedAlgorithms}),
* parameters [0] ALGORITHM.&Type({SupportedAlgorithms}{@algorithm}) OPTIONAL,
* dynamParms [1] ALGORITHM.&DynParms({SupportedAlgorithms}{@algorithm}) OPTIONAL,
* ... }
* ```
*
* @class
*/
class AlgorithmWithInvoke {
constructor(
/**
* @summary `algorithm`.
* @public
* @readonly
*/
algorithm,
/**
* @summary `parameters`.
* @public
* @readonly
*/
parameters,
/**
* @summary `dynamParms`.
* @public
* @readonly
*/
dynamParms,
/**
* @summary Extensions that are not recognized.
* @public
* @readonly
*/
_unrecognizedExtensionsList = []) {
this.algorithm = algorithm;
this.parameters = parameters;
this.dynamParms = dynamParms;
this._unrecognizedExtensionsList = _unrecognizedExtensionsList;
}
/**
* @summary Restructures an object into a AlgorithmWithInvoke
* @description
*
* This takes an `object` and converts it to a `AlgorithmWithInvoke`.
*
* @public
* @static
* @method
* @param {Object} _o An object having all of the keys and values of a `AlgorithmWithInvoke`.
* @returns {AlgorithmWithInvoke}
*/
static _from_object(_o) {
return new AlgorithmWithInvoke(_o.algorithm, _o.parameters, _o.dynamParms, _o._unrecognizedExtensionsList);
}
}
exports.AlgorithmWithInvoke = AlgorithmWithInvoke;
/* END_OF_SYMBOL_DEFINITION AlgorithmWithInvoke */
/* START_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_AlgorithmWithInvoke */
/**
* @summary The Leading Root Component Types of AlgorithmWithInvoke
* @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_AlgorithmWithInvoke = [
new $.ComponentSpec("algorithm", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 6), undefined, undefined),
new $.ComponentSpec("parameters", true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 0), undefined, undefined),
new $.ComponentSpec("dynamParms", true, $.hasTag(asn1_ts_1.ASN1TagClass.context, 1), undefined, undefined),
];
/* END_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_AlgorithmWithInvoke */
/* START_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_AlgorithmWithInvoke */
/**
* @summary The Trailing Root Component Types of AlgorithmWithInvoke
* @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_AlgorithmWithInvoke = [];
/* END_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_AlgorithmWithInvoke */
/* START_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_AlgorithmWithInvoke */
/**
* @summary The Extension Addition Component Types of AlgorithmWithInvoke
* @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_AlgorithmWithInvoke = [];
/* END_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_AlgorithmWithInvoke */
/* START_OF_SYMBOL_DEFINITION _decode_AlgorithmWithInvoke */
/**
* @summary Decodes an ASN.1 element into a(n) AlgorithmWithInvoke
* @function
* @param {_Element} el The element being decoded.
* @returns {AlgorithmWithInvoke} The decoded data structure.
*/
function _decode_AlgorithmWithInvoke(el) {
/* START_OF_SEQUENCE_COMPONENT_DECLARATIONS */
let algorithm;
let parameters;
let dynamParms;
let _unrecognizedExtensionsList = [];
/* END_OF_SEQUENCE_COMPONENT_DECLARATIONS */
/* START_OF_CALLBACKS_MAP */
const callbacks = {
algorithm: (_el) => {
algorithm = $._decodeObjectIdentifier(_el);
},
parameters: (_el) => {
parameters = $._decode_explicit(() => $._decodeAny)(_el);
},
dynamParms: (_el) => {
dynamParms = $._decode_explicit(() => $._decodeAny)(_el);
},
};
/* END_OF_CALLBACKS_MAP */
$._parse_sequence(el, callbacks, exports._root_component_type_list_1_spec_for_AlgorithmWithInvoke, exports._extension_additions_list_spec_for_AlgorithmWithInvoke, exports._root_component_type_list_2_spec_for_AlgorithmWithInvoke, (ext) => {
_unrecognizedExtensionsList.push(ext);
});
return new AlgorithmWithInvoke(
/* SEQUENCE_CONSTRUCTOR_CALL */ algorithm, parameters, dynamParms, _unrecognizedExtensionsList);
}
exports._decode_AlgorithmWithInvoke = _decode_AlgorithmWithInvoke;
/* END_OF_SYMBOL_DEFINITION _decode_AlgorithmWithInvoke */
/* START_OF_SYMBOL_DEFINITION _encode_AlgorithmWithInvoke */
/**
* @summary Encodes a(n) AlgorithmWithInvoke 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 AlgorithmWithInvoke, encoded as an ASN.1 Element.
*/
function _encode_AlgorithmWithInvoke(value, elGetter) {
var _a;
const components = [
/* REQUIRED */ $._encodeObjectIdentifier(value.algorithm, $.BER),
];
if (value.parameters) {
const c = $._encode_explicit(asn1_ts_1.ASN1TagClass.context, 0, () => $._encodeAny, $.BER)(value.parameters, $.BER);
components.push(c);
}
if (value.dynamParms) {
const c = $._encode_explicit(asn1_ts_1.ASN1TagClass.context, 1, () => $._encodeAny, $.BER)(value.dynamParms, $.BER);
components.push(c);
}
if ((_a = value._unrecognizedExtensionsList) === null || _a === void 0 ? void 0 : _a.length) {
components.push(...value._unrecognizedExtensionsList);
}
return $._encodeSequence(components, $.BER);
}
exports._encode_AlgorithmWithInvoke = _encode_AlgorithmWithInvoke;
/* END_OF_SYMBOL_DEFINITION _encode_AlgorithmWithInvoke */
/* eslint-enable */
//# sourceMappingURL=AlgorithmWithInvoke.ta.js.map