UNPKG

@wildboar/pkcs

Version:
201 lines 11.3 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports._encode_FingerPrint = exports._decode_FingerPrint = exports._extension_additions_list_spec_for_FingerPrint = exports._root_component_type_list_2_spec_for_FingerPrint = exports._root_component_type_list_1_spec_for_FingerPrint = exports.FingerPrint = exports._enum_for_FingerPrint_hand = exports._encode_FingerPrint_hand = exports._decode_FingerPrint_hand = exports.right = exports.left = exports.FingerPrint_hand_right = exports.FingerPrint_hand_left = exports.FingerPrint_hand = exports._enum_for_FingerPrint_finger = exports._encode_FingerPrint_finger = exports._decode_FingerPrint_finger = exports.thumb = exports.ringFinger = exports.pointerFinger = exports.middleFinger = exports.littleFinger = exports.FingerPrint_finger_thumb = exports.FingerPrint_finger_ringFinger = exports.FingerPrint_finger_pointerFinger = exports.FingerPrint_finger_middleFinger = exports.FingerPrint_finger_littleFinger = exports.FingerPrint_finger = void 0; /* eslint-disable */ const asn1_ts_1 = require("asn1-ts"); const $ = require("asn1-ts/dist/node/functional"); const FingerPrint_finger_ta_1 = require("../PKCS-15/FingerPrint-finger.ta"); const FingerPrint_hand_ta_1 = require("../PKCS-15/FingerPrint-hand.ta"); var FingerPrint_finger_ta_2 = require("../PKCS-15/FingerPrint-finger.ta"); Object.defineProperty(exports, "FingerPrint_finger", { enumerable: true, get: function () { return FingerPrint_finger_ta_2.FingerPrint_finger; } }); Object.defineProperty(exports, "FingerPrint_finger_littleFinger", { enumerable: true, get: function () { return FingerPrint_finger_ta_2.FingerPrint_finger_littleFinger; } }); /* IMPORTED_LONG_ENUMERATION_ITEM */ Object.defineProperty(exports, "FingerPrint_finger_middleFinger", { enumerable: true, get: function () { return FingerPrint_finger_ta_2.FingerPrint_finger_middleFinger; } }); /* IMPORTED_LONG_ENUMERATION_ITEM */ Object.defineProperty(exports, "FingerPrint_finger_pointerFinger", { enumerable: true, get: function () { return FingerPrint_finger_ta_2.FingerPrint_finger_pointerFinger; } }); /* IMPORTED_LONG_ENUMERATION_ITEM */ Object.defineProperty(exports, "FingerPrint_finger_ringFinger", { enumerable: true, get: function () { return FingerPrint_finger_ta_2.FingerPrint_finger_ringFinger; } }); /* IMPORTED_LONG_ENUMERATION_ITEM */ Object.defineProperty(exports, "FingerPrint_finger_thumb", { enumerable: true, get: function () { return FingerPrint_finger_ta_2.FingerPrint_finger_thumb; } }); /* IMPORTED_LONG_ENUMERATION_ITEM */ Object.defineProperty(exports, "littleFinger", { enumerable: true, get: function () { return FingerPrint_finger_ta_2.littleFinger; } }); /* IMPORTED_SHORT_ENUMERATION_ITEM */ Object.defineProperty(exports, "middleFinger", { enumerable: true, get: function () { return FingerPrint_finger_ta_2.middleFinger; } }); /* IMPORTED_SHORT_ENUMERATION_ITEM */ Object.defineProperty(exports, "pointerFinger", { enumerable: true, get: function () { return FingerPrint_finger_ta_2.pointerFinger; } }); /* IMPORTED_SHORT_ENUMERATION_ITEM */ Object.defineProperty(exports, "ringFinger", { enumerable: true, get: function () { return FingerPrint_finger_ta_2.ringFinger; } }); /* IMPORTED_SHORT_ENUMERATION_ITEM */ Object.defineProperty(exports, "thumb", { enumerable: true, get: function () { return FingerPrint_finger_ta_2.thumb; } }); /* IMPORTED_SHORT_ENUMERATION_ITEM */ Object.defineProperty(exports, "_decode_FingerPrint_finger", { enumerable: true, get: function () { return FingerPrint_finger_ta_2._decode_FingerPrint_finger; } }); Object.defineProperty(exports, "_encode_FingerPrint_finger", { enumerable: true, get: function () { return FingerPrint_finger_ta_2._encode_FingerPrint_finger; } }); Object.defineProperty(exports, "_enum_for_FingerPrint_finger", { enumerable: true, get: function () { return FingerPrint_finger_ta_2._enum_for_FingerPrint_finger; } }); var FingerPrint_hand_ta_2 = require("../PKCS-15/FingerPrint-hand.ta"); Object.defineProperty(exports, "FingerPrint_hand", { enumerable: true, get: function () { return FingerPrint_hand_ta_2.FingerPrint_hand; } }); Object.defineProperty(exports, "FingerPrint_hand_left", { enumerable: true, get: function () { return FingerPrint_hand_ta_2.FingerPrint_hand_left; } }); /* IMPORTED_LONG_ENUMERATION_ITEM */ Object.defineProperty(exports, "FingerPrint_hand_right", { enumerable: true, get: function () { return FingerPrint_hand_ta_2.FingerPrint_hand_right; } }); /* IMPORTED_LONG_ENUMERATION_ITEM */ Object.defineProperty(exports, "left", { enumerable: true, get: function () { return FingerPrint_hand_ta_2.left; } }); /* IMPORTED_SHORT_ENUMERATION_ITEM */ Object.defineProperty(exports, "right", { enumerable: true, get: function () { return FingerPrint_hand_ta_2.right; } }); /* IMPORTED_SHORT_ENUMERATION_ITEM */ Object.defineProperty(exports, "_decode_FingerPrint_hand", { enumerable: true, get: function () { return FingerPrint_hand_ta_2._decode_FingerPrint_hand; } }); Object.defineProperty(exports, "_encode_FingerPrint_hand", { enumerable: true, get: function () { return FingerPrint_hand_ta_2._encode_FingerPrint_hand; } }); Object.defineProperty(exports, "_enum_for_FingerPrint_hand", { enumerable: true, get: function () { return FingerPrint_hand_ta_2._enum_for_FingerPrint_hand; } }); /* START_OF_SYMBOL_DEFINITION FingerPrint */ /** * @summary FingerPrint * @description * * ### ASN.1 Definition: * * ```asn1 * FingerPrint ::= SEQUENCE { * hand ENUMERATED {left, right}, * finger ENUMERATED {thumb, pointerFinger, middleFinger, ringFinger, littleFinger}, * ... * } * ``` * * @class */ class FingerPrint { constructor( /** * @summary `hand`. * @public * @readonly */ hand, /** * @summary `finger`. * @public * @readonly */ finger, /** * @summary Extensions that are not recognized. * @public * @readonly */ _unrecognizedExtensionsList = []) { this.hand = hand; this.finger = finger; this._unrecognizedExtensionsList = _unrecognizedExtensionsList; } /** * @summary Restructures an object into a FingerPrint * @description * * This takes an `object` and converts it to a `FingerPrint`. * * @public * @static * @method * @param {Object} _o An object having all of the keys and values of a `FingerPrint`. * @returns {FingerPrint} */ static _from_object(_o) { return new FingerPrint(_o.hand, _o.finger, _o._unrecognizedExtensionsList); } } exports.FingerPrint = FingerPrint; /** * @summary The enum used as the type of the component `hand` * @public * @static */ FingerPrint._enum_for_hand = FingerPrint_hand_ta_1._enum_for_FingerPrint_hand; /** * @summary The enum used as the type of the component `finger` * @public * @static */ FingerPrint._enum_for_finger = FingerPrint_finger_ta_1._enum_for_FingerPrint_finger; /* END_OF_SYMBOL_DEFINITION FingerPrint */ /* START_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_FingerPrint */ /** * @summary The Leading Root Component Types of FingerPrint * @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_FingerPrint = [ new $.ComponentSpec("hand", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 10), undefined, undefined), new $.ComponentSpec("finger", false, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 10), undefined, undefined), ]; /* END_OF_SYMBOL_DEFINITION _root_component_type_list_1_spec_for_FingerPrint */ /* START_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_FingerPrint */ /** * @summary The Trailing Root Component Types of FingerPrint * @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_FingerPrint = []; /* END_OF_SYMBOL_DEFINITION _root_component_type_list_2_spec_for_FingerPrint */ /* START_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_FingerPrint */ /** * @summary The Extension Addition Component Types of FingerPrint * @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_FingerPrint = []; /* END_OF_SYMBOL_DEFINITION _extension_additions_list_spec_for_FingerPrint */ /* START_OF_SYMBOL_DEFINITION _cached_decoder_for_FingerPrint */ let _cached_decoder_for_FingerPrint = null; /* END_OF_SYMBOL_DEFINITION _cached_decoder_for_FingerPrint */ /* START_OF_SYMBOL_DEFINITION _decode_FingerPrint */ /** * @summary Decodes an ASN.1 element into a(n) FingerPrint * @function * @param {_Element} el The element being decoded. * @returns {FingerPrint} The decoded data structure. */ function _decode_FingerPrint(el) { if (!_cached_decoder_for_FingerPrint) { _cached_decoder_for_FingerPrint = function (el) { const sequence = el.sequence; if (sequence.length < 2) { throw new asn1_ts_1.ASN1ConstructionError("FingerPrint contained only " + sequence.length.toString() + " elements."); } sequence[0].name = "hand"; sequence[1].name = "finger"; let hand; let finger; hand = FingerPrint_hand_ta_1._decode_FingerPrint_hand(sequence[0]); finger = FingerPrint_finger_ta_1._decode_FingerPrint_finger(sequence[1]); return new FingerPrint(hand, finger, sequence.slice(2)); }; } return _cached_decoder_for_FingerPrint(el); } exports._decode_FingerPrint = _decode_FingerPrint; /* END_OF_SYMBOL_DEFINITION _decode_FingerPrint */ /* START_OF_SYMBOL_DEFINITION _cached_encoder_for_FingerPrint */ let _cached_encoder_for_FingerPrint = null; /* END_OF_SYMBOL_DEFINITION _cached_encoder_for_FingerPrint */ /* START_OF_SYMBOL_DEFINITION _encode_FingerPrint */ /** * @summary Encodes a(n) FingerPrint 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 FingerPrint, encoded as an ASN.1 Element. */ function _encode_FingerPrint(value, elGetter) { if (!_cached_encoder_for_FingerPrint) { _cached_encoder_for_FingerPrint = function (value, elGetter) { return $._encodeSequence([] .concat([ /* REQUIRED */ FingerPrint_hand_ta_1._encode_FingerPrint_hand(value.hand, $.BER), /* REQUIRED */ FingerPrint_finger_ta_1._encode_FingerPrint_finger(value.finger, $.BER), ], value._unrecognizedExtensionsList ? value._unrecognizedExtensionsList : []) .filter((c) => !!c), $.BER); }; } return _cached_encoder_for_FingerPrint(value, elGetter); } exports._encode_FingerPrint = _encode_FingerPrint; /* END_OF_SYMBOL_DEFINITION _encode_FingerPrint */ /* eslint-enable */ //# sourceMappingURL=FingerPrint.ta.js.map