UNPKG

pkcs-ts

Version:

PKCS #1 through #15 (Except #11) - Private and Public Keys, Certificates, and More

71 lines 3.69 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports._encode_PasswordInfo = exports._decode_PasswordInfo = exports._extension_additions_list_spec_for_PasswordInfo = exports._root_component_type_list_2_spec_for_PasswordInfo = exports._root_component_type_list_1_spec_for_PasswordInfo = exports.PasswordInfo = exports._encode_Label = exports._decode_Label = void 0; const tslib_1 = require("tslib"); const asn1_ts_1 = require("asn1-ts"); const $ = tslib_1.__importStar(require("asn1-ts/dist/node/functional")); const AlgorithmIdentifier_ta_1 = require("x500-ts/dist/node/modules/AuthenticationFramework/AlgorithmIdentifier.ta"); const Label_ta_1 = require("../PKCS-15/Label.ta"); var Label_ta_2 = require("../PKCS-15/Label.ta"); Object.defineProperty(exports, "_decode_Label", { enumerable: true, get: function () { return Label_ta_2._decode_Label; } }); Object.defineProperty(exports, "_encode_Label", { enumerable: true, get: function () { return Label_ta_2._encode_Label; } }); class PasswordInfo { constructor(hint, algId, _unrecognizedExtensionsList = []) { this.hint = hint; this.algId = algId; this._unrecognizedExtensionsList = _unrecognizedExtensionsList; } static _from_object(_o) { return new PasswordInfo(_o.hint, _o.algId, _o._unrecognizedExtensionsList); } } exports.PasswordInfo = PasswordInfo; exports._root_component_type_list_1_spec_for_PasswordInfo = [ new $.ComponentSpec("hint", true, $.hasTag(asn1_ts_1.ASN1TagClass.universal, 12), undefined, undefined), ]; exports._root_component_type_list_2_spec_for_PasswordInfo = []; exports._extension_additions_list_spec_for_PasswordInfo = []; let _cached_decoder_for_PasswordInfo = null; function _decode_PasswordInfo(el) { if (!_cached_decoder_for_PasswordInfo) { _cached_decoder_for_PasswordInfo = function (el) { let hint; let algId; let _unrecognizedExtensionsList = []; const callbacks = { hint: (_el) => { hint = Label_ta_1._decode_Label(_el); }, algId: (_el) => { algId = AlgorithmIdentifier_ta_1._decode_AlgorithmIdentifier(_el); }, }; $._parse_sequence(el, callbacks, exports._root_component_type_list_1_spec_for_PasswordInfo, exports._extension_additions_list_spec_for_PasswordInfo, exports._root_component_type_list_2_spec_for_PasswordInfo, (ext) => { _unrecognizedExtensionsList.push(ext); }); return new PasswordInfo(hint, algId, _unrecognizedExtensionsList); }; } return _cached_decoder_for_PasswordInfo(el); } exports._decode_PasswordInfo = _decode_PasswordInfo; let _cached_encoder_for_PasswordInfo = null; function _encode_PasswordInfo(value, elGetter) { if (!_cached_encoder_for_PasswordInfo) { _cached_encoder_for_PasswordInfo = function (value, elGetter) { return $._encodeSequence([] .concat([ value.hint === undefined ? undefined : Label_ta_1._encode_Label(value.hint, $.BER), AlgorithmIdentifier_ta_1._encode_AlgorithmIdentifier(value.algId, $.BER), ], value._unrecognizedExtensionsList ? value._unrecognizedExtensionsList : []) .filter((c) => !!c), $.BER); }; } return _cached_encoder_for_PasswordInfo(value, elGetter); } exports._encode_PasswordInfo = _encode_PasswordInfo; //# sourceMappingURL=PasswordInfo.ta.js.map