f.AES_Encrypt_process(e),()=>f.AES_Encrypt_finish())}(e,t,r,u);const l=new a.default[e](t),p=l.blockSize,y=u.slice();let b=new Uint8Array;const m=e=>{e&&(b=o.default.concatUint8Array([b,e]));const t=new Uint8Array(b.length);let r,n=0;for(;e?b.length>=p:b.length;){const e=l.encrypt(y);for(r=0;rnew Uint8Array(a.update(d.from(e))))}(e,t,r,s);if("aes"===e.substr(0,3))return function(e,t,r,a){if(o.default.isStream(r)){const e=new n.AES_CFB(t,a);return i.default.transform(r,t=>e.AES_Decrypt_process(t),()=>e.AES_Decrypt_finish())}return n.AES_CFB.decrypt(r,t,a)}(0,t,r,s);const u=new a.default[e](t),c=u.blockSize;let l=s,p=new Uint8Array;const y=e=>{e&&(p=o.default.concatUint8Array([p,e]));const t=new Uint8Array(p.length);let r,n=0;for(;e?p.length>=c:p.length;){const e=u.encrypt(l);for(l=p,r=0;r>>=8),i=255&(e>>>=8),a=255&(e>>>=8);return t=this.sboxes[0][a]+this.sboxes[1][i],t^=this.sboxes[2][n],t+=this.sboxes[3][r]},n.prototype._encrypt_block=function(e){let t,r=e[0],n=e[1];for(t=0;t>>24-8*t&255,i[t+n]=r[1]>>>24-8*t&255;return i},n.prototype._decrypt_block=function(e){let t,r=e[0],n=e[1];for(t=this.NN+1;t>1;--t){const e=r^=this.parray[t];r=n=this._F(r)^n,n=e}r^=this.parray[1],n^=this.parray[0],e[0]=this._clean(n),e[1]=this._clean(r)},n.prototype.init=function(e){let t,r=0;for(this.parray=[],t=0;t=e.length&&(r=0);this.parray[t]=this.PARRAY[t]^n}for(this.sboxes=[],t=0;t<4;++t)for(this.sboxes[t]=[],r=0;r<256;++r)this.sboxes[t][r]=this.SBOXES[t][r];const n=[0,0];for(t=0;t>>24&255,t[a+1]=u>>>16&255,t[a+2]=u>>>8&255,t[a+3]=255&u,t[a+4]=o>>>24&255,t[a+5]=o>>>16&255,t[a+6]=o>>>8&255,t[a+7]=255&o}return t},this.decrypt=function(e){const t=new Array(e.length);for(let a=0;a>>24&255,t[a+1]=u>>>16&255,t[a+2]=u>>>8&255,t[a+3]=255&u,t[a+4]=o>>>24&255,t[a+5]=o>>16&255,t[a+6]=o>>8&255,t[a+7]=255&o}return t};const e=new Array(4);e[0]=new Array(4),e[0][0]=[4,0,13,15,12,14,8],e[0][1]=[5,2,16,18,17,19,10],e[0][2]=[6,3,23,22,21,20,9],e[0][3]=[7,1,26,25,27,24,11],e[1]=new Array(4),e[1][0]=[0,6,21,23,20,22,16],e[1][1]=[1,4,0,2,1,3,18],e[1][2]=[2,5,7,6,5,4,17],e[1][3]=[3,7,10,9,11,8,19],e[2]=new Array(4),e[2][0]=[4,0,13,15,12,14,8],e[2][1]=[5,2,16,18,17,19,10],e[2][2]=[6,3,23,22,21,20,9],e[2][3]=[7,1,26,25,27,24,11],e[3]=new Array(4),e[3][0]=[0,6,21,23,20,22,16],e[3][1]=[1,4,0,2,1,3,18],e[3][2]=[2,5,7,6,5,4,17],e[3][3]=[3,7,10,9,11,8,19];const t=new Array(4);function r(e,t,r){const n=t+e,i=n<>>32-r;return(a[0][i>>>24]^a[1][i>>>16&255])-a[2][i>>>8&255]+a[3][255&i]}function n(e,t,r){const n=t^e,i=n<>>32-r;return a[0][i>>>24]-a[1][i>>>16&255]+a[2][i>>>8&255]^a[3][255&i]}function i(e,t,r){const n=t-e,i=n<>>32-r;return(a[0][i>>>24]+a[1][i>>>16&255]^a[2][i>>>8&255])-a[3][255&i]}t[0]=new Array(4),t[0][0]=[24,25,23,22,18],t[0][1]=[26,27,21,20,22],t[0][2]=[28,29,19,18,25],t[0][3]=[30,31,17,16,28],t[1]=new Array(4),t[1][0]=[3,2,12,13,8],t[1][1]=[1,0,14,15,13],t[1][2]=[7,6,8,9,3],t[1][3]=[5,4,10,11,7],t[2]=new Array(4),t[2][0]=[19,18,28,29,25],t[2][1]=[17,16,30,31,28],t[2][2]=[23,22,24,25,18],t[2][3]=[21,20,26,27,22],t[3]=new Array(4),t[3][0]=[8,9,7,6,3],t[3][1]=[10,11,5,4,7],t[3][2]=[12,13,3,2,8],t[3][3]=[14,15,1,0,13],this.keySchedule=function(r){const n=new Array(8),i=new Array(32);let s;for(let e=0;e<4;e++)s=4*e,n[e]=r[s]<<24|r[s+1]<<16|r[s+2]<<8|r[s+3];const o=[6,7,4,5];let u,c=0;for(let f=0;f<2;f++)for(let r=0;r<4;r++){for(s=0;s<4;s++){const t=e[r][s];u=n[t[1]],u^=a[4][n[t[2]>>>2]>>>24-8*(3&t[2])&255],u^=a[5][n[t[3]>>>2]>>>24-8*(3&t[3])&255],u^=a[6][n[t[4]>>>2]>>>24-8*(3&t[4])&255],u^=a[7][n[t[5]>>>2]>>>24-8*(3&t[5])&255],u^=a[o[s]][n[t[6]>>>2]>>>24-8*(3&t[6])&255],n[t[0]]=u}for(s=0;s<4;s++){const e=t[r][s];u=a[4][n[e[0]>>>2]>>>24-8*(3&e[0])&255],u^=a[5][n[e[1]>>>2]>>>24-8*(3&e[1])&255],u^=a[6][n[e[2]>>>2]>>>24-8*(3&e[2])&255],u^=a[7][n[e[3]>>>2]>>>24-8*(3&e[3])&255],u^=a[4+s][n[e[4]>>>2]>>>24-8*(3&e[4])&255],i[c]=u,c++}}for(let e=0;e<16;e++)this.masking[e]=i[e],this.rotate[e]=31&i[16+e]};const a=new Array(8);a[0]=[821772500,2678128395,1810681135,1059425402,505495343,2617265619,1610868032,3483355465,3218386727,2294005173,3791863952,2563806837,1852023008,365126098,3269944861,584384398,677919599,3229601881,4280515016,2002735330,1136869587,3744433750,2289869850,2731719981,2714362070,879511577,1639411079,575934255,717107937,2857637483,576097850,2731753936,1725645e3,2810460463,5111599,767152862,2543075244,1251459544,1383482551,3052681127,3089939183,3612463449,1878520045,1510570527,2189125840,2431448366,582008916,3163445557,1265446783,1354458274,3529918736,3202711853,3073581712,3912963487,3029263377,1275016285,4249207360,2905708351,3304509486,1442611557,3585198765,2712415662,2731849581,3248163920,2283946226,208555832,2766454743,1331405426,1447828783,3315356441,3108627284,2957404670,2981538698,3339933917,1669711173,286233437,1465092821,1782121619,3862771680,710211251,980974943,1651941557,430374111,2051154026,704238805,4128970897,3144820574,2857402727,948965521,3333752299,2227686284,718756367,2269778983,2731643755,718440111,2857816721,3616097120,1113355533,2478022182,410092745,1811985197,1944238868,2696854588,1415722873,1682284203,1060277122,1998114690,1503841958,82706478,2315155686,1068173648,845149890,2167947013,1768146376,1993038550,3566826697,3390574031,940016341,3355073782,2328040721,904371731,1205506512,4094660742,2816623006,825647681,85914773,2857843460,1249926541,1417871568,3287612,3211054559,3126306446,1975924523,1353700161,2814456437,2438597621,1800716203,722146342,2873936343,1151126914,4160483941,2877670899,458611604,2866078500,3483680063,770352098,2652916994,3367839148,3940505011,3585973912,3809620402,718646636,2504206814,2914927912,3631288169,2857486607,2860018678,575749918,2857478043,718488780,2069512688,3548183469,453416197,1106044049,3032691430,52586708,3378514636,3459808877,3211506028,1785789304,218356169,3571399134,3759170522,1194783844,1523787992,3007827094,1975193539,2555452411,1341901877,3045838698,3776907964,3217423946,2802510864,2889438986,1057244207,1636348243,3761863214,1462225785,2632663439,481089165,718503062,24497053,3332243209,3344655856,3655024856,3960371065,1195698900,2971415156,3710176158,2115785917,4027663609,3525578417,2524296189,2745972565,3564906415,1372086093,1452307862,2780501478,1476592880,3389271281,18495466,2378148571,901398090,891748256,3279637769,3157290713,2560960102,1447622437,4284372637,216884176,2086908623,1879786977,3588903153,2242455666,2938092967,3559082096,2810645491,758861177,1121993112,215018983,642190776,4169236812,1196255959,2081185372,3508738393,941322904,4124243163,2877523539,1848581667,2205260958,3180453958,2589345134,3694731276,550028657,2519456284,3789985535,2973870856,2093648313,443148163,46942275,2734146937,1117713533,1115362972,1523183689,3717140224,1551984063],a[1]=[522195092,4010518363,1776537470,960447360,4267822970,4005896314,1435016340,1929119313,2913464185,1310552629,3579470798,3724818106,2579771631,1594623892,417127293,2715217907,2696228731,1508390405,3994398868,3925858569,3695444102,4019471449,3129199795,3770928635,3520741761,990456497,4187484609,2783367035,21106139,3840405339,631373633,3783325702,532942976,396095098,3548038825,4267192484,2564721535,2011709262,2039648873,620404603,3776170075,2898526339,3612357925,4159332703,1645490516,223693667,1567101217,3362177881,1029951347,3470931136,3570957959,1550265121,119497089,972513919,907948164,3840628539,1613718692,3594177948,465323573,2659255085,654439692,2575596212,2699288441,3127702412,277098644,624404830,4100943870,2717858591,546110314,2403699828,3655377447,1321679412,4236791657,1045293279,4010672264,895050893,2319792268,494945126,1914543101,2777056443,3894764339,2219737618,311263384,4275257268,3458730721,669096869,3584475730,3835122877,3319158237,3949359204,2005142349,2713102337,2228954793,3769984788,569394103,3855636576,1425027204,108000370,2736431443,3671869269,3043122623,1750473702,2211081108,762237499,3972989403,2798899386,3061857628,2943854345,867476300,964413654,1591880597,1594774276,2179821409,552026980,3026064248,3726140315,2283577634,3110545105,2152310760,582474363,1582640421,1383256631,2043843868,3322775884,1217180674,463797851,2763038571,480777679,2718707717,2289164131,3118346187,214354409,200212307,3810608407,3025414197,2674075964,3997296425,1847405948,1342460550,510035443,4080271814,815934613,833030224,1620250387,1945732119,2703661145,3966000196,1388869545,3456054182,2687178561,2092620194,562037615,1356438536,3409922145,3261847397,1688467115,2150901366,631725691,3840332284,549916902,3455104640,394546491,837744717,2114462948,751520235,2221554606,2415360136,3999097078,2063029875,803036379,2702586305,821456707,3019566164,360699898,4018502092,3511869016,3677355358,2402471449,812317050,49299192,2570164949,3259169295,2816732080,3331213574,3101303564,2156015656,3705598920,3546263921,143268808,3200304480,1638124008,3165189453,3341807610,578956953,2193977524,3638120073,2333881532,807278310,658237817,2969561766,1641658566,11683945,3086995007,148645947,1138423386,4158756760,1981396783,2401016740,3699783584,380097457,2680394679,2803068651,3334260286,441530178,4016580796,1375954390,761952171,891809099,2183123478,157052462,3683840763,1592404427,341349109,2438483839,1417898363,644327628,2233032776,2353769706,2201510100,220455161,1815641738,182899273,2995019788,3627381533,3702638151,2890684138,1052606899,588164016,1681439879,4038439418,2405343923,4229449282,167996282,1336969661,1688053129,2739224926,1543734051,1046297529,1138201970,2121126012,115334942,1819067631,1902159161,1941945968,2206692869,1159982321],a[2]=[2381300288,637164959,3952098751,3893414151,1197506559,916448331,2350892612,2932787856,3199334847,4009478890,3905886544,1373570990,2450425862,4037870920,3778841987,2456817877,286293407,124026297,3001279700,1028597854,3115296800,4208886496,2691114635,2188540206,1430237888,1218109995,3572471700,308166588,570424558,2187009021,2455094765,307733056,1310360322,3135275007,1384269543,2388071438,863238079,2359263624,2801553128,3380786597,2831162807,1470087780,1728663345,4072488799,1090516929,532123132,2389430977,1132193179,2578464191,3051079243,1670234342,1434557849,2711078940,1241591150,3314043432,3435360113,3091448339,1812415473,2198440252,267246943,796911696,3619716990,38830015,1526438404,2806502096,374413614,2943401790,1489179520,1603809326,1920779204,168801282,260042626,2358705581,1563175598,2397674057,1356499128,2217211040,514611088,2037363785,2186468373,4022173083,2792511869,2913485016,1173701892,4200428547,3896427269,1334932762,2455136706,602925377,2835607854,1613172210,41346230,2499634548,2457437618,2188827595,41386358,4172255629,1313404830,2405527007,3801973774,2217704835,873260488,2528884354,2478092616,4012915883,2555359016,2006953883,2463913485,575479328,2218240648,2099895446,660001756,2341502190,3038761536,3888151779,3848713377,3286851934,1022894237,1620365795,3449594689,1551255054,15374395,3570825345,4249311020,4151111129,3181912732,310226346,1133119310,530038928,136043402,2476768958,3107506709,2544909567,1036173560,2367337196,1681395281,1758231547,3641649032,306774401,1575354324,3716085866,1990386196,3114533736,2455606671,1262092282,3124342505,2768229131,4210529083,1833535011,423410938,660763973,2187129978,1639812e3,3508421329,3467445492,310289298,272797111,2188552562,2456863912,310240523,677093832,1013118031,901835429,3892695601,1116285435,3036471170,1337354835,243122523,520626091,277223598,4244441197,4194248841,1766575121,594173102,316590669,742362309,3536858622,4176435350,3838792410,2501204839,1229605004,3115755532,1552908988,2312334149,979407927,3959474601,1148277331,176638793,3614686272,2083809052,40992502,1340822838,2731552767,3535757508,3560899520,1354035053,122129617,7215240,2732932949,3118912700,2718203926,2539075635,3609230695,3725561661,1928887091,2882293555,1988674909,2063640240,2491088897,1459647954,4189817080,2302804382,1113892351,2237858528,1927010603,4002880361,1856122846,1594404395,2944033133,3855189863,3474975698,1643104450,4054590833,3431086530,1730235576,2984608721,3084664418,2131803598,4178205752,267404349,1617849798,1616132681,1462223176,736725533,2327058232,551665188,2945899023,1749386277,2575514597,1611482493,674206544,2201269090,3642560800,728599968,1680547377,2620414464,1388111496,453204106,4156223445,1094905244,2754698257,2201108165,3757000246,2704524545,3922940700,3996465027],a[3]=[2645754912,532081118,2814278639,3530793624,1246723035,1689095255,2236679235,4194438865,2116582143,3859789411,157234593,2045505824,4245003587,1687664561,4083425123,605965023,672431967,1336064205,3376611392,214114848,4258466608,3232053071,489488601,605322005,3998028058,264917351,1912574028,756637694,436560991,202637054,135989450,85393697,2152923392,3896401662,2895836408,2145855233,3535335007,115294817,3147733898,1922296357,3464822751,4117858305,1037454084,2725193275,2127856640,1417604070,1148013728,1827919605,642362335,2929772533,909348033,1346338451,3547799649,297154785,1917849091,4161712827,2883604526,3968694238,1469521537,3780077382,3375584256,1763717519,136166297,4290970789,1295325189,2134727907,2798151366,1566297257,3672928234,2677174161,2672173615,965822077,2780786062,289653839,1133871874,3491843819,35685304,1068898316,418943774,672553190,642281022,2346158704,1954014401,3037126780,4079815205,2030668546,3840588673,672283427,1776201016,359975446,3750173538,555499703,2769985273,1324923,69110472,152125443,3176785106,3822147285,1340634837,798073664,1434183902,15393959,216384236,1303690150,3881221631,3711134124,3960975413,106373927,2578434224,1455997841,1801814300,1578393881,1854262133,3188178946,3258078583,2302670060,1539295533,3505142565,3078625975,2372746020,549938159,3278284284,2620926080,181285381,2865321098,3970029511,68876850,488006234,1728155692,2608167508,836007927,2435231793,919367643,3339422534,3655756360,1457871481,40520939,1380155135,797931188,234455205,2255801827,3990488299,397000196,739833055,3077865373,2871719860,4022553888,772369276,390177364,3853951029,557662966,740064294,1640166671,1699928825,3535942136,622006121,3625353122,68743880,1742502,219489963,1664179233,1577743084,1236991741,410585305,2366487942,823226535,1050371084,3426619607,3586839478,212779912,4147118561,1819446015,1911218849,530248558,3486241071,3252585495,2886188651,3410272728,2342195030,20547779,2982490058,3032363469,3631753222,312714466,1870521650,1493008054,3491686656,615382978,4103671749,2534517445,1932181,2196105170,278426614,6369430,3274544417,2913018367,697336853,2143000447,2946413531,701099306,1558357093,2805003052,3500818408,2321334417,3567135975,216290473,3591032198,23009561,1996984579,3735042806,2024298078,3739440863,569400510,2339758983,3016033873,3097871343,3639523026,3844324983,3256173865,795471839,2951117563,4101031090,4091603803,3603732598,971261452,534414648,428311343,3389027175,2844869880,694888862,1227866773,2456207019,3043454569,2614353370,3749578031,3676663836,459166190,4132644070,1794958188,51825668,2252611902,3084671440,2036672799,3436641603,1099053433,2469121526,3059204941,1323291266,2061838604,1018778475,2233344254,2553501054,334295216,3556750194,1065731521,183467730],a[4]=[2127105028,745436345,2601412319,2788391185,3093987327,500390133,1155374404,389092991,150729210,3891597772,3523549952,1935325696,716645080,946045387,2901812282,1774124410,3869435775,4039581901,3293136918,3438657920,948246080,363898952,3867875531,1286266623,1598556673,68334250,630723836,1104211938,1312863373,613332731,2377784574,1101634306,441780740,3129959883,1917973735,2510624549,3238456535,2544211978,3308894634,1299840618,4076074851,1756332096,3977027158,297047435,3790297736,2265573040,3621810518,1311375015,1667687725,47300608,3299642885,2474112369,201668394,1468347890,576830978,3594690761,3742605952,1958042578,1747032512,3558991340,1408974056,3366841779,682131401,1033214337,1545599232,4265137049,206503691,103024618,2855227313,1337551222,2428998917,2963842932,4015366655,3852247746,2796956967,3865723491,3747938335,247794022,3755824572,702416469,2434691994,397379957,851939612,2314769512,218229120,1380406772,62274761,214451378,3170103466,2276210409,3845813286,28563499,446592073,1693330814,3453727194,29968656,3093872512,220656637,2470637031,77972100,1667708854,1358280214,4064765667,2395616961,325977563,4277240721,4220025399,3605526484,3355147721,811859167,3069544926,3962126810,652502677,3075892249,4132761541,3498924215,1217549313,3250244479,3858715919,3053989961,1538642152,2279026266,2875879137,574252750,3324769229,2651358713,1758150215,141295887,2719868960,3515574750,4093007735,4194485238,1082055363,3417560400,395511885,2966884026,179534037,3646028556,3738688086,1092926436,2496269142,257381841,3772900718,1636087230,1477059743,2499234752,3811018894,2675660129,3285975680,90732309,1684827095,1150307763,1723134115,3237045386,1769919919,1240018934,815675215,750138730,2239792499,1234303040,1995484674,138143821,675421338,1145607174,1936608440,3238603024,2345230278,2105974004,323969391,779555213,3004902369,2861610098,1017501463,2098600890,2628620304,2940611490,2682542546,1171473753,3656571411,3687208071,4091869518,393037935,159126506,1662887367,1147106178,391545844,3452332695,1891500680,3016609650,1851642611,546529401,1167818917,3194020571,2848076033,3953471836,575554290,475796850,4134673196,450035699,2351251534,844027695,1080539133,86184846,1554234488,3692025454,1972511363,2018339607,1491841390,1141460869,1061690759,4244549243,2008416118,2351104703,2868147542,1598468138,722020353,1027143159,212344630,1387219594,1725294528,3745187956,2500153616,458938280,4129215917,1828119673,544571780,3503225445,2297937496,1241802790,267843827,2694610800,1397140384,1558801448,3782667683,1806446719,929573330,2234912681,400817706,616011623,4121520928,3603768725,1761550015,1968522284,4053731006,4192232858,4005120285,872482584,3140537016,3894607381,2287405443,1963876937,3663887957,1584857e3,2975024454,1833426440,4025083860],a[5]=[4143615901,749497569,1285769319,3795025788,2514159847,23610292,3974978748,844452780,3214870880,3751928557,2213566365,1676510905,448177848,3730751033,4086298418,2307502392,871450977,3222878141,4110862042,3831651966,2735270553,1310974780,2043402188,1218528103,2736035353,4274605013,2702448458,3936360550,2693061421,162023535,2827510090,687910808,23484817,3784910947,3371371616,779677500,3503626546,3473927188,4157212626,3500679282,4248902014,2466621104,3899384794,1958663117,925738300,1283408968,3669349440,1840910019,137959847,2679828185,1239142320,1315376211,1547541505,1690155329,739140458,3128809933,3933172616,3876308834,905091803,1548541325,4040461708,3095483362,144808038,451078856,676114313,2861728291,2469707347,993665471,373509091,2599041286,4025009006,4170239449,2149739950,3275793571,3749616649,2794760199,1534877388,572371878,2590613551,1753320020,3467782511,1405125690,4270405205,633333386,3026356924,3475123903,632057672,2846462855,1404951397,3882875879,3915906424,195638627,2385783745,3902872553,1233155085,3355999740,2380578713,2702246304,2144565621,3663341248,3894384975,2502479241,4248018925,3094885567,1594115437,572884632,3385116731,767645374,1331858858,1475698373,3793881790,3532746431,1321687957,619889600,1121017241,3440213920,2070816767,2833025776,1933951238,4095615791,890643334,3874130214,859025556,360630002,925594799,1764062180,3920222280,4078305929,979562269,2810700344,4087740022,1949714515,546639971,1165388173,3069891591,1495988560,922170659,1291546247,2107952832,1813327274,3406010024,3306028637,4241950635,153207855,2313154747,1608695416,1150242611,1967526857,721801357,1220138373,3691287617,3356069787,2112743302,3281662835,1111556101,1778980689,250857638,2298507990,673216130,2846488510,3207751581,3562756981,3008625920,3417367384,2198807050,529510932,3547516680,3426503187,2364944742,102533054,2294910856,1617093527,1204784762,3066581635,1019391227,1069574518,1317995090,1691889997,3661132003,510022745,3238594800,1362108837,1817929911,2184153760,805817662,1953603311,3699844737,120799444,2118332377,207536705,2282301548,4120041617,145305846,2508124933,3086745533,3261524335,1877257368,2977164480,3160454186,2503252186,4221677074,759945014,254147243,2767453419,3801518371,629083197,2471014217,907280572,3900796746,940896768,2751021123,2625262786,3161476951,3661752313,3260732218,1425318020,2977912069,1496677566,3988592072,2140652971,3126511541,3069632175,977771578,1392695845,1698528874,1411812681,1369733098,1343739227,3620887944,1142123638,67414216,3102056737,3088749194,1626167401,2546293654,3941374235,697522451,33404913,143560186,2595682037,994885535,1247667115,3859094837,2699155541,3547024625,4114935275,2968073508,3199963069,2732024527,1237921620,951448369,1898488916,1211705605,2790989240,2233243581,3598044975],a[6]=[2246066201,858518887,1714274303,3485882003,713916271,2879113490,3730835617,539548191,36158695,1298409750,419087104,1358007170,749914897,2989680476,1261868530,2995193822,2690628854,3443622377,3780124940,3796824509,2976433025,4259637129,1551479e3,512490819,1296650241,951993153,2436689437,2460458047,144139966,3136204276,310820559,3068840729,643875328,1969602020,1680088954,2185813161,3283332454,672358534,198762408,896343282,276269502,3014846926,84060815,197145886,376173866,3943890818,3813173521,3545068822,1316698879,1598252827,2633424951,1233235075,859989710,2358460855,3503838400,3409603720,1203513385,1193654839,2792018475,2060853022,207403770,1144516871,3068631394,1121114134,177607304,3785736302,326409831,1929119770,2983279095,4183308101,3474579288,3200513878,3228482096,119610148,1170376745,3378393471,3163473169,951863017,3337026068,3135789130,2907618374,1183797387,2015970143,4045674555,2182986399,2952138740,3928772205,384012900,2454997643,10178499,2879818989,2596892536,111523738,2995089006,451689641,3196290696,235406569,1441906262,3890558523,3013735005,4158569349,1644036924,376726067,1006849064,3664579700,2041234796,1021632941,1374734338,2566452058,371631263,4007144233,490221539,206551450,3140638584,1053219195,1853335209,3412429660,3562156231,735133835,1623211703,3104214392,2738312436,4096837757,3366392578,3110964274,3956598718,3196820781,2038037254,3877786376,2339753847,300912036,3766732888,2372630639,1516443558,4200396704,1574567987,4069441456,4122592016,2699739776,146372218,2748961456,2043888151,35287437,2596680554,655490400,1132482787,110692520,1031794116,2188192751,1324057718,1217253157,919197030,686247489,3261139658,1028237775,3135486431,3059715558,2460921700,986174950,2661811465,4062904701,2752986992,3709736643,367056889,1353824391,731860949,1650113154,1778481506,784341916,357075625,3608602432,1074092588,2480052770,3811426202,92751289,877911070,3600361838,1231880047,480201094,3756190983,3094495953,434011822,87971354,363687820,1717726236,1901380172,3926403882,2481662265,400339184,1490350766,2661455099,1389319756,2558787174,784598401,1983468483,30828846,3550527752,2716276238,3841122214,1765724805,1955612312,1277890269,1333098070,1564029816,2704417615,1026694237,3287671188,1260819201,3349086767,1016692350,1582273796,1073413053,1995943182,694588404,1025494639,3323872702,3551898420,4146854327,453260480,1316140391,1435673405,3038941953,3486689407,1622062951,403978347,817677117,950059133,4246079218,3278066075,1486738320,1417279718,481875527,2549965225,3933690356,760697757,1452955855,3897451437,1177426808,1702951038,4085348628,2447005172,1084371187,3516436277,3068336338,1073369276,1027665953,3284188590,1230553676,1368340146,2226246512,267243139,2274220762,4070734279,2497715176,2423353163,2504755875],a[7]=[3793104909,3151888380,2817252029,895778965,2005530807,3871412763,237245952,86829237,296341424,3851759377,3974600970,2475086196,709006108,1994621201,2972577594,937287164,3734691505,168608556,3189338153,2225080640,3139713551,3033610191,3025041904,77524477,185966941,1208824168,2344345178,1721625922,3354191921,1066374631,1927223579,1971335949,2483503697,1551748602,2881383779,2856329572,3003241482,48746954,1398218158,2050065058,313056748,4255789917,393167848,1912293076,940740642,3465845460,3091687853,2522601570,2197016661,1727764327,364383054,492521376,1291706479,3264136376,1474851438,1685747964,2575719748,1619776915,1814040067,970743798,1561002147,2925768690,2123093554,1880132620,3151188041,697884420,2550985770,2607674513,2659114323,110200136,1489731079,997519150,1378877361,3527870668,478029773,2766872923,1022481122,431258168,1112503832,897933369,2635587303,669726182,3383752315,918222264,163866573,3246985393,3776823163,114105080,1903216136,761148244,3571337562,1690750982,3166750252,1037045171,1888456500,2010454850,642736655,616092351,365016990,1185228132,4174898510,1043824992,2023083429,2241598885,3863320456,3279669087,3674716684,108438443,2132974366,830746235,606445527,4173263986,2204105912,1844756978,2532684181,4245352700,2969441100,3796921661,1335562986,4061524517,2720232303,2679424040,634407289,885462008,3294724487,3933892248,2094100220,339117932,4048830727,3202280980,1458155303,2689246273,1022871705,2464987878,3714515309,353796843,2822958815,4256850100,4052777845,551748367,618185374,3778635579,4020649912,1904685140,3069366075,2670879810,3407193292,2954511620,4058283405,2219449317,3135758300,1120655984,3447565834,1474845562,3577699062,550456716,3466908712,2043752612,881257467,869518812,2005220179,938474677,3305539448,3850417126,1315485940,3318264702,226533026,965733244,321539988,1136104718,804158748,573969341,3708209826,937399083,3290727049,2901666755,1461057207,4013193437,4066861423,3242773476,2421326174,1581322155,3028952165,786071460,3900391652,3918438532,1485433313,4023619836,3708277595,3678951060,953673138,1467089153,1930354364,1533292819,2492563023,1346121658,1685000834,1965281866,3765933717,4190206607,2052792609,3515332758,690371149,3125873887,2180283551,2903598061,3933952357,436236910,289419410,14314871,1242357089,2904507907,1616633776,2666382180,585885352,3471299210,2699507360,1432659641,277164553,3354103607,770115018,2303809295,3741942315,3177781868,2853364978,2269453327,3774259834,987383833,1290892879,225909803,1741533526,890078084,1496906255,1111072499,916028167,243534141,1252605537,2204162171,531204876,290011180,3916834213,102027703,237315147,209093447,1486785922,220223953,2758195998,4175039106,82940208,3127791296,2569425252,518464269,1353887104,3941492737,2377294467,3935040926]}function i(e){this.cast5=new n,this.cast5.setKey(e),this.encrypt=function(e){return this.cast5.encrypt(e)}}Object.defineProperty(r,"__esModule",{value:!0}),i.blockSize=i.prototype.blockSize=8,i.keySize=i.prototype.keySize=16,r.default=i},{}],85:[function(e,t,r){"use strict";function n(e,t,r,n,i,a){const s=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],o=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],u=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],c=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],f=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],d=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],l=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],h=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];let p,y,b,m,g,w,_,v,k,A,S,E,P,x,M=0,C=t.length;const K=32===e.length?3:9;v=3===K?r?[0,32,2]:[30,-2,-2]:r?[0,32,2,62,30,-2,64,96,2]:[94,62,-2,32,64,2,30,-2,-2],r&&(C=(t=function(e,t){const r=8-e.length%8;let n;if(2===t&&r<8)n=" ".charCodeAt(0);else if(1===t)n=r;else{if(t||!(r<8)){if(8===r)return e;throw new Error("des: invalid padding")}n=0}const i=new Uint8Array(e.length+r);for(let a=0;a>>4^_))<<4,w^=(b=65535&(w>>>16^(_^=b)))<<16,w^=b=858993459&((_^=b)>>>2^w),w^=b=16711935&((_^=b<<2)>>>8^w),w=(w^=(b=1431655765&(w>>>1^(_^=b<<8)))<<1)<<1|w>>>31,_=(_^=b)<<1|_>>>31,y=0;y>>4|_<<28)^e[p+1],b=w,w=_,_=b^(o[m>>>24&63]|c[m>>>16&63]|d[m>>>8&63]|h[63&m]|s[g>>>24&63]|u[g>>>16&63]|f[g>>>8&63]|l[63&g]);b=w,w=_,_=b}_=_>>>1|_<<31,_^=b=1431655765&((w=w>>>1|w<<31)>>>1^_),_^=(b=16711935&(_>>>8^(w^=b<<1)))<<8,_^=(b=858993459&(_>>>2^(w^=b)))<<2,_^=b=65535&((w^=b)>>>16^_),_^=b=252645135&((w^=b<<16)>>>4^_),w^=b<<4,1===n&&(r?(k=w,S=_):(w^=A,_^=E)),U[R++]=w>>>24,U[R++]=w>>>16&255,U[R++]=w>>>8&255,U[R++]=255&w,U[R++]=_>>>24,U[R++]=_>>>16&255,U[R++]=_>>>8&255,U[R++]=255&_}return r||(U=function(e,t){let r,n=null;if(2===t)r=" ".charCodeAt(0);else if(1===t)n=e[e.length-1];else{if(t)throw new Error("des: invalid padding");r=0}if(!n){for(n=1;e[e.length-n]===r;)n++;n--}return e.subarray(0,e.length-n)}(U,a)),U}function i(e){const t=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],r=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],n=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],i=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],a=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],s=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],o=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],u=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],c=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],f=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],d=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],l=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],h=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],p=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],y=e.length>8?3:1,b=new Array(32*y),m=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0];let g,w,_,v=0,k=0;for(let A=0;A>>4^A))<<4,y^=_=65535&((A^=_)>>>-16^y),y^=(_=858993459&(y>>>2^(A^=_<<-16)))<<2,y^=_=65535&((A^=_)>>>-16^y),y^=(_=1431655765&(y>>>1^(A^=_<<-16)))<<1,y^=_=16711935&((A^=_)>>>8^y),_=(y^=(_=1431655765&(y>>>1^(A^=_<<8)))<<1)<<8|(A^=_)>>>20&240,y=A<<24|A<<8&16711680|A>>>8&65280|A>>>24&240,A=_;for(let e=0;e>>26,A=A<<2|A>>>26):(y=y<<1|y>>>27,A=A<<1|A>>>27),_=65535&((w=u[(A&=-15)>>>28]|c[A>>>24&15]|f[A>>>20&15]|d[A>>>16&15]|l[A>>>12&15]|h[A>>>8&15]|p[A>>>4&15])>>>16^(g=t[(y&=-15)>>>28]|r[y>>>24&15]|n[y>>>20&15]|i[y>>>16&15]|a[y>>>12&15]|s[y>>>8&15]|o[y>>>4&15])),b[k++]=g^_,b[k++]=w^_<<16}return b}function a(e){this.key=[];for(let t=0;t<3;t++)this.key.push(new Uint8Array(e.subarray(8*t,8*t+8)));this.encrypt=function(e){return n(i(this.key[2]),n(i(this.key[1]),n(i(this.key[0]),e,!0,0,null,null),!1,0,null,null),!0,0,null,null)}}Object.defineProperty(r,"__esModule",{value:!0}),a.keySize=a.prototype.keySize=24,a.blockSize=a.prototype.blockSize=8,r.default={DES:function(e){this.key=e,this.encrypt=function(e,t){return n(i(this.key),e,!0,0,null,t)},this.decrypt=function(e,t){return n(i(this.key),e,!1,0,null,t)}},TripleDES:a}},{}],86:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=u(e("./aes")),i=u(e("./des.js")),a=u(e("./cast5")),s=u(e("./twofish")),o=u(e("./blowfish"));function u(e){return e&&e.__esModule?e:{default:e}}r.default={aes128:(0,n.default)(128),aes192:(0,n.default)(192),aes256:(0,n.default)(256),des:i.default.DES,tripledes:i.default.TripleDES,"3des":i.default.TripleDES,cast5:a.default,twofish:s.default,blowfish:o.default,idea:function(){throw new Error("IDEA symmetric-key algorithm not implemented")}}},{"./aes":82,"./blowfish":83,"./cast5":84,"./des.js":85,"./twofish":87}],87:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const n=4294967295;function i(e,t){return(e<>>32-t)&n}function a(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function s(e,t,r){e.splice(t,4,255&r,r>>>8&255,r>>>16&255,r>>>24&255)}function o(e,t){return e>>>8*t&255}function u(e){this.tf=function(){let e=null,t=null,r=-1,u=[],c=[[],[],[],[]];function f(e){return c[0][o(e,0)]^c[1][o(e,1)]^c[2][o(e,2)]^c[3][o(e,3)]}function d(e){return c[0][o(e,3)]^c[1][o(e,0)]^c[2][o(e,1)]^c[3][o(e,2)]}function l(e,t){let r=f(t[0]),a=d(t[1]);t[2]=i(t[2]^r+a+u[4*e+8]&n,31),t[3]=i(t[3],1)^r+2*a+u[4*e+9]&n,r=f(t[2]),a=d(t[3]),t[0]=i(t[0]^r+a+u[4*e+10]&n,31),t[1]=i(t[1],1)^r+2*a+u[4*e+11]&n}function h(e,t){let r=f(t[0]),a=d(t[1]);t[2]=i(t[2],1)^r+a+u[4*e+10]&n,t[3]=i(t[3]^r+2*a+u[4*e+11]&n,31),r=f(t[2]),a=d(t[3]),t[0]=i(t[0],1)^r+a+u[4*e+8]&n,t[1]=i(t[1]^r+2*a+u[4*e+9]&n,31)}return{name:"twofish",blocksize:16,open:function(t){let r,s,f,d,l;const h=[],p=[],y=[];let b;const m=[];let g,w,_;const v=[[8,1,7,13,6,15,3,2,0,11,5,9,14,12,10,4],[2,8,11,13,15,7,6,14,3,1,9,4,0,10,12,5]],k=[[14,12,11,8,1,2,3,5,15,4,10,6,7,0,9,13],[1,14,2,11,4,12,3,7,6,13,10,5,15,9,0,8]],A=[[11,10,5,14,6,13,9,0,12,8,15,3,2,4,7,1],[4,12,7,5,1,6,9,10,0,14,13,8,2,11,3,15]],S=[[13,7,15,4,1,2,6,14,9,11,3,0,8,5,12,10],[11,9,5,1,12,3,13,14,6,4,7,15,2,0,8,10]],E=[0,8,1,9,2,10,3,11,4,12,5,13,6,14,7,15],P=[0,9,2,11,4,13,6,15,8,1,10,3,12,5,14,7],x=[[],[]],M=[[],[],[],[]];function C(e){return e^e>>2^[0,90,180,238][3&e]}function K(e){return e^e>>1^e>>2^[0,238,180,90][3&e]}function U(e,t){let r,i,a;for(r=0;r<8;r++)i=t>>>24,t=t<<8&n|e>>>24,e=e<<8&n,a=i<<1,128&i&&(a^=333),t^=i^a<<16,a^=i>>>1,1&i&&(a^=166),t^=a<<24|a<<8;return t}function R(e,t){const r=t>>4,n=15&t,i=v[e][r^n],a=k[e][E[n]^P[r]];return S[e][E[a]^P[i]]<<4|A[e][i^a]}function B(e,t){let r=o(e,0),n=o(e,1),i=o(e,2),a=o(e,3);switch(b){case 4:r=x[1][r]^o(t[3],0),n=x[0][n]^o(t[3],1),i=x[0][i]^o(t[3],2),a=x[1][a]^o(t[3],3);case 3:r=x[1][r]^o(t[2],0),n=x[1][n]^o(t[2],1),i=x[0][i]^o(t[2],2),a=x[0][a]^o(t[2],3);case 2:r=x[0][x[0][r]^o(t[1],0)]^o(t[0],0),n=x[0][x[1][n]^o(t[1],1)]^o(t[0],1),i=x[1][x[0][i]^o(t[1],2)]^o(t[0],2),a=x[1][x[1][a]^o(t[1],3)]^o(t[0],3)}return M[0][r]^M[1][n]^M[2][i]^M[3][a]}for(r=(e=(e=t).slice(0,32)).length;16!==r&&24!==r&&32!==r;)e[r++]=0;for(r=0;r>2]=a(e,r);for(r=0;r<256;r++)x[0][r]=R(0,r),x[1][r]=R(1,r);for(r=0;r<256;r++)w=C(g=x[1][r]),_=K(g),M[0][r]=g+(w<<8)+(_<<16)+(_<<24),M[2][r]=w+(_<<8)+(g<<16)+(_<<24),w=C(g=x[0][r]),_=K(g),M[1][r]=_+(_<<8)+(w<<16)+(g<<24),M[3][r]=w+(g<<8)+(_<<16)+(w<<24);for(b=y.length/2,r=0;r=0;t--)h(t,i);s(t,r,i[2]^u[0]),s(t,r+4,i[3]^u[1]),s(t,r+8,i[0]^u[2]),s(t,r+12,i[1]^u[3]),r+=16},finalize:function(){return t}}}(),this.tf.open(Array.from(e),0),this.encrypt=function(e){return this.tf.encrypt(Array.from(e),0)}}u.keySize=u.prototype.keySize=32,u.blockSize=u.prototype.blockSize=16,r.default=u},{}],88:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n,i=e("asmcrypto.js/dist_es5/aes/cbc"),a=e("../util"),s=(n=a)&&n.__esModule?n:{default:n};const o=s.default.getWebCrypto(),u=s.default.getNodeCrypto(),c=s.default.getNodeBuffer(),f=16;function d(e,t){const r=e.length-f;for(let n=0;n{r.update(b.from(e))},()=>new Uint8Array(r.digest()))}}function g(e,t){return async function(r){if(!l.default.isStream(r)&&p&&t&&r.length>=d.default.min_bytes_for_web_crypto)return new Uint8Array(await p.digest(t,r));const n=e();return c.default.transform(r,e=>{n.update(e)},()=>new Uint8Array(n.digest()))}}function w(e,t){return async function(r){if(l.default.isStream(r)){const t=new e;return c.default.transform(r,e=>{t.process(e)},()=>t.finish().result)}return p&&t&&r.length>=d.default.min_bytes_for_web_crypto?new Uint8Array(await p.digest(t,r)):e.bytes(r)}}let _;_=y?{md5:m("md5"),sha1:m("sha1"),sha224:m("sha224"),sha256:m("sha256"),sha384:m("sha384"),sha512:m("sha512"),ripemd:m("ripemd160")}:{md5:f.default,sha1:w(n.Sha1,-1===navigator.userAgent.indexOf("Edge")&&"SHA-1"),sha224:g(a.default),sha256:w(i.Sha256,"SHA-256"),sha384:g(s.default,"SHA-384"),sha512:g(o.default,"SHA-512"),ripemd:g(u.ripemd160)},r.default={md5:_.md5,sha1:_.sha1,sha224:_.sha224,sha256:_.sha256,sha384:_.sha384,sha512:_.sha512,ripemd:_.ripemd,digest:function(e,t){switch(e){case 1:return this.md5(t);case 2:return this.sha1(t);case 3:return this.ripemd(t);case 8:return this.sha256(t);case 9:return this.sha384(t);case 10:return this.sha512(t);case 11:return this.sha224(t);default:throw new Error("Invalid hash function.")}},getHashByteLength:function(e){switch(e){case 1:return 16;case 2:case 3:return 20;case 8:return 32;case 9:return 48;case 10:return 64;case 11:return 28;default:throw new Error("Invalid hash algorithm.")}}}},{"../../config":79,"../../util":158,"./md5":93,"asmcrypto.js/dist_es5/hash/sha1/sha1":11,"asmcrypto.js/dist_es5/hash/sha256/sha256":13,"hash.js/lib/hash/ripemd":37,"hash.js/lib/hash/sha/224":40,"hash.js/lib/hash/sha/384":42,"hash.js/lib/hash/sha/512":43,"web-stream-tools":75}],93:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n,i=e("../../util"),a=(n=i)&&n.__esModule?n:{default:n};function s(e,t){let r=e[0],n=e[1],i=e[2],a=e[3];r=u(r,n,i,a,t[0],7,-680876936),a=u(a,r,n,i,t[1],12,-389564586),i=u(i,a,r,n,t[2],17,606105819),n=u(n,i,a,r,t[3],22,-1044525330),r=u(r,n,i,a,t[4],7,-176418897),a=u(a,r,n,i,t[5],12,1200080426),i=u(i,a,r,n,t[6],17,-1473231341),n=u(n,i,a,r,t[7],22,-45705983),r=u(r,n,i,a,t[8],7,1770035416),a=u(a,r,n,i,t[9],12,-1958414417),i=u(i,a,r,n,t[10],17,-42063),n=u(n,i,a,r,t[11],22,-1990404162),r=u(r,n,i,a,t[12],7,1804603682),a=u(a,r,n,i,t[13],12,-40341101),i=u(i,a,r,n,t[14],17,-1502002290),r=c(r,n=u(n,i,a,r,t[15],22,1236535329),i,a,t[1],5,-165796510),a=c(a,r,n,i,t[6],9,-1069501632),i=c(i,a,r,n,t[11],14,643717713),n=c(n,i,a,r,t[0],20,-373897302),r=c(r,n,i,a,t[5],5,-701558691),a=c(a,r,n,i,t[10],9,38016083),i=c(i,a,r,n,t[15],14,-660478335),n=c(n,i,a,r,t[4],20,-405537848),r=c(r,n,i,a,t[9],5,568446438),a=c(a,r,n,i,t[14],9,-1019803690),i=c(i,a,r,n,t[3],14,-187363961),n=c(n,i,a,r,t[8],20,1163531501),r=c(r,n,i,a,t[13],5,-1444681467),a=c(a,r,n,i,t[2],9,-51403784),i=c(i,a,r,n,t[7],14,1735328473),r=f(r,n=c(n,i,a,r,t[12],20,-1926607734),i,a,t[5],4,-378558),a=f(a,r,n,i,t[8],11,-2022574463),i=f(i,a,r,n,t[11],16,1839030562),n=f(n,i,a,r,t[14],23,-35309556),r=f(r,n,i,a,t[1],4,-1530992060),a=f(a,r,n,i,t[4],11,1272893353),i=f(i,a,r,n,t[7],16,-155497632),n=f(n,i,a,r,t[10],23,-1094730640),r=f(r,n,i,a,t[13],4,681279174),a=f(a,r,n,i,t[0],11,-358537222),i=f(i,a,r,n,t[3],16,-722521979),n=f(n,i,a,r,t[6],23,76029189),r=f(r,n,i,a,t[9],4,-640364487),a=f(a,r,n,i,t[12],11,-421815835),i=f(i,a,r,n,t[15],16,530742520),r=d(r,n=f(n,i,a,r,t[2],23,-995338651),i,a,t[0],6,-198630844),a=d(a,r,n,i,t[7],10,1126891415),i=d(i,a,r,n,t[14],15,-1416354905),n=d(n,i,a,r,t[5],21,-57434055),r=d(r,n,i,a,t[12],6,1700485571),a=d(a,r,n,i,t[3],10,-1894986606),i=d(i,a,r,n,t[10],15,-1051523),n=d(n,i,a,r,t[1],21,-2054922799),r=d(r,n,i,a,t[8],6,1873313359),a=d(a,r,n,i,t[15],10,-30611744),i=d(i,a,r,n,t[6],15,-1560198380),n=d(n,i,a,r,t[13],21,1309151649),r=d(r,n,i,a,t[4],6,-145523070),a=d(a,r,n,i,t[11],10,-1120210379),i=d(i,a,r,n,t[2],15,718787259),n=d(n,i,a,r,t[9],21,-343485551),e[0]=y(r,e[0]),e[1]=y(n,e[1]),e[2]=y(i,e[2]),e[3]=y(a,e[3])}function o(e,t,r,n,i,a){return t=y(y(t,e),y(n,a)),y(t<>>32-i,r)}function u(e,t,r,n,i,a,s){return o(t&r|~t&n,e,t,i,a,s)}function c(e,t,r,n,i,a,s){return o(t&n|r&~n,e,t,i,a,s)}function f(e,t,r,n,i,a,s){return o(t^r^n,e,t,i,a,s)}function d(e,t,r,n,i,a,s){return o(r^(t|~n),e,t,i,a,s)}function l(e){const t=[];let r;for(r=0;r<64;r+=4)t[r>>2]=e.charCodeAt(r)+(e.charCodeAt(r+1)<<8)+(e.charCodeAt(r+2)<<16)+(e.charCodeAt(r+3)<<24);return t}const h="0123456789abcdef".split("");function p(e){let t="",r=0;for(;r<4;r++)t+=h[e>>8*r+4&15]+h[e>>8*r&15];return t}function y(e,t){return e+t&4294967295}r.default=async function(e){const t=function(e){const t=e.length,r=[1732584193,-271733879,-1732584194,271733878];let n;for(n=64;n<=e.length;n+=64)s(r,l(e.substring(n-64,n)));e=e.substring(n-64);const i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(n=0;n>2]|=e.charCodeAt(n)<<(n%4<<3);if(i[n>>2]|=128<<(n%4<<3),n>55)for(s(r,i),n=0;n<16;n++)i[n]=0;return i[14]=8*t,s(r,i),r}(a.default.Uint8Array_to_str(e));return a.default.hex_to_Uint8Array(function(e){for(let t=0;t>3),17+(g>>3)),8-(7&g)).subarray(1),k=new Uint8Array(s),A=new Uint8Array(t.length+u);let S,E=0;for(S=0;St-11)throw new Error("Message too long");const i=await async function(e){let t="";for(;t.length=8&&0===a)return e.substr(n);throw new Error("Decryption error")},u.encode=async function(e,t,r){let n;const s=a.default.Uint8Array_to_str(t);if(s.length!==i.default.getHashByteLength(e))throw new Error("Invalid hash length");let o="";for(n=0;n0){const r=e.charCodeAt(t-1);if(r>=1&&e.substr(t-r)===String.fromCharCode(r).repeat(r))return e.substr(0,t-r)}throw new Error("Invalid padding")}}},{}],98:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=o(e("bn.js")),i=o(e("../random")),a=o(e("../../util")),s=o(e("./prime"));function o(e){return e&&e.__esModule?e:{default:e}}const u=new n.default(1),c=new n.default(0);r.default={sign:async function(e,t,r,a,s,o){let f,d,l,h;const p=new n.default.red(a),y=new n.default.red(s),b=r.toRed(p),m=o.toRed(y),g=new n.default(t.subarray(0,s.byteLength())).toRed(y);for(;f=await i.default.getRandomBN(u,s),d=b.redPow(f).fromRed().toRed(y),0===c.cmp(d)||(h=g.redAdd(m.redMul(d)),l=f.toRed(y).redInvm().redMul(h),0===c.cmp(l)););return{r:d.toArrayLike(Uint8Array,"be",s.byteLength()),s:l.toArrayLike(Uint8Array,"be",s.byteLength())}},verify:async function(e,t,r,i,s,o,u,f){if(c.ucmp(t)>=0||t.ucmp(u)>=0||c.ucmp(r)>=0||r.ucmp(u)>=0)return a.default.print_debug("invalid DSA Signature"),null;const d=new n.default.red(o),l=new n.default.red(u),h=new n.default(i.subarray(0,u.byteLength())),p=r.toRed(l).redInvm();if(0===c.cmp(p))return a.default.print_debug("invalid DSA Signature"),null;const y=h.toRed(l).redMul(p),b=t.toRed(l).redMul(p),m=s.toRed(d).redPow(y.fromRed()),g=f.toRed(d).redPow(b.fromRed());return 0===m.redMul(g).fromRed().mod(u).cmp(t)},validateParams:async function(e,t,r,a,o){e=new n.default(e),t=new n.default(t),r=new n.default(r),a=new n.default(a);const u=new n.default(1);if(r.lte(u)||r.gte(e))return!1;if(!e.sub(u).mod(t).isZero())return!1;const c=new n.default.red(e),f=r.toRed(c);if(!f.redPow(t).eq(u))return!1;const d=t.bitLength();if(d<150||!(await s.default.isProbablePrime(t,null,32)))return!1;o=new n.default(o);const l=await i.default.getRandomBN(new n.default(2).shln(d-1),new n.default(2).shln(d)),h=t.mul(l).add(o);return!!a.eq(f.redPow(h))}}},{"../../util":158,"../random":109,"./prime":107,"bn.js":16}],99:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=a(e("bn.js")),i=a(e("../random"));function a(e){return e&&e.__esModule?e:{default:e}}const s=new n.default(0);r.default={encrypt:async function(e,t,r,a){const o=new n.default.red(t),u=e.toRed(o),c=r.toRed(o),f=a.toRed(o),d=await i.default.getRandomBN(s,t);return{c1:c.redPow(d).fromRed(),c2:f.redPow(d).redMul(u).fromRed()}},decrypt:async function(e,t,r,i){const a=new n.default.red(r),s=e.toRed(a),o=t.toRed(a);return s.redPow(i).redInvm().redMul(o).fromRed()},validateParams:async function(e,t,r,a){e=new n.default(e),t=new n.default(t),r=new n.default(r);const s=new n.default(1);if(t.lte(s)||t.gte(e))return!1;const o=e.subn(1).bitLength();if(o<1023)return!1;const u=new n.default.red(e),c=t.toRed(u);if(!c.redPow(e.subn(1)).eq(s))return!1;let f=t;const d=new n.default(1),l=new n.default(2).shln(17);for(;d.lt(l);){if((f=f.mul(t).mod(e)).eqn(1))return!1;d.iaddn(1)}a=new n.default(a);const h=await i.default.getRandomBN(new n.default(2).shln(o-1),new n.default(2).shln(o)),p=e.subn(1).mul(h).add(a);return!!r.eq(c.redPow(p))}}},{"../random":109,"bn.js":16}],100:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.validateStandardParams=r.privateToJwk=r.rawPublicToJwk=r.jwkToRawPublic=r.getPreferredHashAlgo=r.generate=r.nodeCurves=r.webCurves=r.curves=void 0;var n=f(e("bn.js")),i=f(e("tweetnacl/nacl-fast-light.js")),a=f(e("../../random")),s=f(e("../../../enums")),o=f(e("../../../util")),u=f(e("../../../type/oid")),c=e("./indutnyKey");function f(e){return e&&e.__esModule?e:{default:e}}const d=o.default.getWebCrypto(),l=o.default.getNodeCrypto(),h={p256:"P-256",p384:"P-384",p521:"P-521"},p=l?l.getCurves():[],y=l?{secp256k1:p.includes("secp256k1")?"secp256k1":void 0,p256:p.includes("prime256v1")?"prime256v1":void 0,p384:p.includes("secp384r1")?"secp384r1":void 0,p521:p.includes("secp521r1")?"secp521r1":void 0,ed25519:p.includes("ED25519")?"ED25519":void 0,curve25519:p.includes("X25519")?"X25519":void 0,brainpoolP256r1:p.includes("brainpoolP256r1")?"brainpoolP256r1":void 0,brainpoolP384r1:p.includes("brainpoolP384r1")?"brainpoolP384r1":void 0,brainpoolP512r1:p.includes("brainpoolP512r1")?"brainpoolP512r1":void 0}:{},b={p256:{oid:[6,8,42,134,72,206,61,3,1,7],keyType:s.default.publicKey.ecdsa,hash:s.default.hash.sha256,cipher:s.default.symmetric.aes128,node:y.p256,web:h.p256,payloadSize:32,sharedSize:256},p384:{oid:[6,5,43,129,4,0,34],keyType:s.default.publicKey.ecdsa,hash:s.default.hash.sha384,cipher:s.default.symmetric.aes192,node:y.p384,web:h.p384,payloadSize:48,sharedSize:384},p521:{oid:[6,5,43,129,4,0,35],keyType:s.default.publicKey.ecdsa,hash:s.default.hash.sha512,cipher:s.default.symmetric.aes256,node:y.p521,web:h.p521,payloadSize:66,sharedSize:528},secp256k1:{oid:[6,5,43,129,4,0,10],keyType:s.default.publicKey.ecdsa,hash:s.default.hash.sha256,cipher:s.default.symmetric.aes128,node:y.secp256k1,payloadSize:32},ed25519:{oid:[6,9,43,6,1,4,1,218,71,15,1],keyType:s.default.publicKey.eddsa,hash:s.default.hash.sha512,node:!1,payloadSize:32},curve25519:{oid:[6,10,43,6,1,4,1,151,85,1,5,1],keyType:s.default.publicKey.ecdh,hash:s.default.hash.sha256,cipher:s.default.symmetric.aes128,node:!1,payloadSize:32},brainpoolP256r1:{oid:[6,9,43,36,3,3,2,8,1,1,7],keyType:s.default.publicKey.ecdsa,hash:s.default.hash.sha256,cipher:s.default.symmetric.aes128,node:y.brainpoolP256r1,payloadSize:32},brainpoolP384r1:{oid:[6,9,43,36,3,3,2,8,1,1,11],keyType:s.default.publicKey.ecdsa,hash:s.default.hash.sha384,cipher:s.default.symmetric.aes192,node:y.brainpoolP384r1,payloadSize:48},brainpoolP512r1:{oid:[6,9,43,36,3,3,2,8,1,1,13],keyType:s.default.publicKey.ecdsa,hash:s.default.hash.sha512,cipher:s.default.symmetric.aes256,node:y.brainpoolP512r1,payloadSize:64}};function m(e,t){try{(o.default.isArray(e)||o.default.isUint8Array(e))&&(e=new u.default(e)),e instanceof u.default&&(e=e.getName()),this.name=s.default.write(s.default.curve,e)}catch(r){throw new Error("Not valid curve")}t=t||b[this.name],this.keyType=t.keyType,this.oid=t.oid,this.hash=t.hash,this.cipher=t.cipher,this.node=t.node&&b[this.name],this.web=t.web&&b[this.name],this.payloadSize=t.payloadSize,this.web&&o.default.getWebCrypto()?this.type="web":this.node&&o.default.getNodeCrypto()?this.type="node":"curve25519"===this.name?this.type="curve25519":"ed25519"===this.name&&(this.type="ed25519")}function g(e){const t=o.default.b64_to_Uint8Array(e.x),r=o.default.b64_to_Uint8Array(e.y),n=new Uint8Array(t.length+r.length+1);return n[0]=4,n.set(t,1),n.set(r,t.length+1),n}function w(e,t,r){const n=e,i=r.slice(1,n+1),a=r.slice(n+1,2*n+1);return{kty:"EC",crv:t,x:o.default.Uint8Array_to_b64(i,!0),y:o.default.Uint8Array_to_b64(a,!0),ext:!0}}m.prototype.genKeyPair=async function(){let e;switch(this.type){case"web":try{return await async function(e){const t=await d.generateKey({name:"ECDSA",namedCurve:h[e]},!0,["sign","verify"]),r=await d.exportKey("jwk",t.privateKey);return{publicKey:g(await d.exportKey("jwk",t.publicKey)),privateKey:o.default.b64_to_Uint8Array(r.d,!0)}}(this.name)}catch(r){o.default.print_debug_error("Browser did not support generating ec key "+r.message);break}case"node":return async function(e){const t=l.createECDH(y[e]);return await t.generateKeys(),{publicKey:new Uint8Array(t.getPublicKey()),privateKey:new Uint8Array(t.getPrivateKey())}}(this.name);case"curve25519":{const t=await a.default.getRandomBytes(32);t[0]=127&t[0]|64,t[31]&=248;const r=t.slice().reverse();return e=i.default.box.keyPair.fromSecretKey(r),{publicKey:o.default.concatUint8Array([new Uint8Array([64]),e.publicKey]),privateKey:t}}case"ed25519":{const e=await a.default.getRandomBytes(32),t=i.default.sign.keyPair.fromSeed(e);return{publicKey:o.default.concatUint8Array([new Uint8Array([64]),t.publicKey]),privateKey:e}}}const t=await(0,c.getIndutnyCurve)(this.name);return e=await t.genKeyPair({entropy:o.default.Uint8Array_to_str(await a.default.getRandomBytes(32))}),{publicKey:new Uint8Array(e.getPublic("array",!1)),privateKey:e.getPrivate().toArrayLike(Uint8Array)}},r.default=m,r.curves=b,r.webCurves=h,r.nodeCurves=y,r.generate=async function(e){e=new m(e);const t=await e.genKeyPair();return{oid:e.oid,Q:new n.default(t.publicKey),d:new n.default(t.privateKey),hash:e.hash,cipher:e.cipher}},r.getPreferredHashAlgo=function(e){return b[s.default.write(s.default.curve,e.toHex())].hash},r.jwkToRawPublic=g,r.rawPublicToJwk=w,r.privateToJwk=function(e,t,r,n){const i=w(e,t,r);return i.d=o.default.Uint8Array_to_b64(n,!0),i},r.validateStandardParams=async function(e,t,r,a){const u={p256:!0,p384:!0,p521:!0,secp256k1:!0,curve25519:e===s.default.publicKey.ecdh,brainpoolP256r1:!0,brainpoolP384r1:!0,brainpoolP512r1:!0},f=t.getName();if(!u[f])return!1;if("curve25519"===f){a=a.slice().reverse();const e=i.default.box.keyPair.fromSecretKey(a).publicKey;r=new Uint8Array(r);const t=new Uint8Array([64,...e]);return!!o.default.equalsUint8Array(t,r)}const d=await(0,c.getIndutnyCurve)(f);try{r=(0,c.keyFromPublic)(d,r).getPublic()}catch(l){return!1}return a=new n.default(a),!!(0,c.keyFromPrivate)(d,a).getPublic().eq(r)}},{"../../../enums":113,"../../../type/oid":156,"../../../util":158,"../../random":109,"./indutnyKey":105,"bn.js":16,"tweetnacl/nacl-fast-light.js":72}],101:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,a=void 0;try{for(var s,o=e[Symbol.iterator]();!(n=(s=o.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(u){i=!0,a=u}finally{try{!n&&o.return&&o.return()}finally{if(i)throw a}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=y(e("bn.js")),a=y(e("tweetnacl/nacl-fast-light.js")),s=e("./curves"),o=y(s),u=y(e("../../aes_kw")),c=y(e("../../cipher")),f=y(e("../../random")),d=y(e("../../hash")),l=y(e("../../../enums")),h=y(e("../../../util")),p=e("./indutnyKey");function y(e){return e&&e.__esModule?e:{default:e}}const b=h.default.getWebCrypto(),m=h.default.getNodeCrypto();function g(e,t,r,n){return h.default.concatUint8Array([t.write(),new Uint8Array([e]),r.write(),h.default.str_to_Uint8Array("Anonymous Sender "),n.subarray(0,20)])}async function w(e,t,r,n,i=!1,a=!1){let s;if(i){for(s=0;s=0&&0===t[s];s--);t=t.subarray(0,s+1)}return(await d.default.digest(e,h.default.concatUint8Array([new Uint8Array([0,0,0,1]),t,n]))).subarray(0,r)}async function _(e,t){switch(e.type){case"curve25519":{const n=await f.default.getRandomBytes(32);var r=await v(e,t,null,n);const i=r.secretKey,s=r.sharedKey;let o=a.default.box.keyPair.fromSecretKey(i).publicKey;return{publicKey:o=h.default.concatUint8Array([new Uint8Array([64]),o]),sharedKey:s}}case"web":if(e.web&&h.default.getWebCrypto())try{return await A(e,t)}catch(n){h.default.print_debug_error(n)}break;case"node":return x(e,t)}return E(e,t)}async function v(e,t,r,n){if(n.length!==e.payloadSize){const t=new Uint8Array(e.payloadSize);t.set(n,e.payloadSize-n.length),n=t}switch(e.type){case"curve25519":{const e=n.slice().reverse();return{secretKey:e,sharedKey:a.default.scalarMult(e,t.subarray(1))}}case"web":if(e.web&&h.default.getWebCrypto())try{return await k(e,t,r,n)}catch(i){h.default.print_debug_error(i)}break;case"node":return P(e,t,n)}return S(e,t,n)}async function k(e,t,r,i){const a=(0,s.privateToJwk)(e.payloadSize,e.web.web,r,i);let o=b.importKey("jwk",a,{name:"ECDH",namedCurve:e.web.web},!0,["deriveKey","deriveBits"]);const u=(0,s.rawPublicToJwk)(e.payloadSize,e.web.web,t);let c=b.importKey("jwk",u,{name:"ECDH",namedCurve:e.web.web},!0,[]);var f=await Promise.all([o,c]),d=n(f,2);o=d[0],c=d[1];let l=b.deriveBits({name:"ECDH",namedCurve:e.web.web,public:c},o,e.web.sharedSize),p=b.exportKey("jwk",o);var y=await Promise.all([l,p]),m=n(y,2);l=m[0],p=m[1];const g=new Uint8Array(l);return{secretKey:h.default.b64_to_Uint8Array(p.d,!0),sharedKey:g}}async function A(e,t){const r=(0,s.rawPublicToJwk)(e.payloadSize,e.web.web,t);let i=b.generateKey({name:"ECDH",namedCurve:e.web.web},!0,["deriveKey","deriveBits"]),a=b.importKey("jwk",r,{name:"ECDH",namedCurve:e.web.web},!1,[]);var o=await Promise.all([i,a]),u=n(o,2);i=u[0],a=u[1];let c=b.deriveBits({name:"ECDH",namedCurve:e.web.web,public:a},i.privateKey,e.web.sharedSize),f=b.exportKey("jwk",i.publicKey);var d=await Promise.all([c,f]),l=n(d,2);c=l[0],f=l[1];const h=new Uint8Array(c);return{publicKey:new Uint8Array((0,s.jwkToRawPublic)(f)),sharedKey:h}}async function S(e,t,r){const n=await(0,p.getIndutnyCurve)(e.name);t=(0,p.keyFromPublic)(n,t),r=(0,p.keyFromPrivate)(n,r);const i=new Uint8Array(r.getPrivate()),a=r.derive(t.getPublic()),s=n.curve.p.byteLength();return{secretKey:i,sharedKey:a.toArrayLike(Uint8Array,"be",s)}}async function E(e,t){const r=await(0,p.getIndutnyCurve)(e.name),n=await e.genKeyPair();t=(0,p.keyFromPublic)(r,t);const i=(0,p.keyFromPrivate)(r,n.privateKey),a=n.publicKey,s=i.derive(t.getPublic()),o=r.curve.p.byteLength();return{publicKey:a,sharedKey:s.toArrayLike(Uint8Array,"be",o)}}async function P(e,t,r){const n=m.createECDH(e.node.node);n.setPrivateKey(r);const i=new Uint8Array(n.computeSecret(t));return{secretKey:new Uint8Array(n.getPrivateKey()),sharedKey:i}}async function x(e,t){const r=m.createECDH(e.node.node);r.generateKeys();const n=new Uint8Array(r.computeSecret(t));return{publicKey:new Uint8Array(r.getPublicKey()),sharedKey:n}}r.default={encrypt:async function(e,t,r,n,i){const a=new o.default(e);var s=await _(a,n);const f=s.publicKey,d=s.sharedKey,h=g(l.default.publicKey.ecdh,e,t,i),p=l.default.read(l.default.symmetric,t.cipher),y=await w(t.hash,d,c.default[p].keySize,h);return{publicKey:f,wrappedKey:u.default.wrap(y,r.toString())}},decrypt:async function(e,t,r,n,a,s,f){const d=new o.default(e),h=(await v(d,r,a,s)).sharedKey,p=g(l.default.publicKey.ecdh,e,t,f),y=l.default.read(l.default.symmetric,t.cipher);let b;for(let o=0;o<3;o++)try{const e=await w(t.hash,h,c.default[y].keySize,p,1===o,2===o);return new i.default(u.default.unwrap(e,n))}catch(m){b=m}throw b},genPublicEphemeralKey:_,genPrivateEphemeralKey:v,buildEcdhParam:g,kdf:w,webPublicEphemeralKey:A,webPrivateEphemeralKey:k,ellipticPublicEphemeralKey:E,ellipticPrivateEphemeralKey:S,nodePublicEphemeralKey:x,nodePrivateEphemeralKey:P,validateParams:async function(e,t,r){return(0,s.validateStandardParams)(l.default.publicKey.ecdh,e,t,r)},parseParams:function(e){if(e.length<3||e.length>4)throw new Error("Unexpected number of parameters");const t=e[0],r=new o.default(t),n={oid:t};return n.Q=e[1].toUint8Array(),n.kdfParams=e[2],4===e.length&&(n.d=e[3].toUint8Array("be",r.payloadSize)),n}}},{"../../../enums":113,"../../../util":158,"../../aes_kw":80,"../../cipher":86,"../../hash":92,"../../random":109,"./curves":100,"./indutnyKey":105,"bn.js":16,"tweetnacl/nacl-fast-light.js":72}],102:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=d(e("bn.js")),i=d(e("../../../enums")),a=d(e("../../../util")),s=d(e("../../random")),o=d(e("../../hash")),u=e("./curves"),c=d(u),f=e("./indutnyKey");function d(e){return e&&e.__esModule?e:{default:e}}const l=a.default.getWebCrypto(),h=a.default.getNodeCrypto();async function p(e,t,r,n,s,o){const f=new c.default(e);if(r&&!a.default.isStream(r)){const e={publicKey:n,privateKey:s};switch(f.type){case"web":try{return await async function(e,t,r,n){const a=e.payloadSize,s=(0,u.privateToJwk)(e.payloadSize,u.webCurves[e.name],n.publicKey,n.privateKey),o=await l.importKey("jwk",s,{name:"ECDSA",namedCurve:u.webCurves[e.name],hash:{name:i.default.read(i.default.webHash,e.hash)}},!1,["sign"]),c=new Uint8Array(await l.sign({name:"ECDSA",namedCurve:u.webCurves[e.name],hash:{name:i.default.read(i.default.webHash,t)}},o,r));return{r:c.slice(0,a),s:c.slice(a,a<<1)}}(f,t,r,e)}catch(d){if("p521"!==f.name&&("DataError"===d.name||"OperationError"===d.name))throw d;a.default.print_debug_error("Browser did not support verifying: "+d.message)}break;case"node":{const n=await async function(e,t,r,n){const a=h.createSign(i.default.read(i.default.hash,t));a.write(r),a.end();const s=_.encode({version:1,parameters:e.oid,privateKey:Array.from(n.privateKey),publicKey:{unused:0,data:Array.from(n.publicKey)}},"pem",{label:"EC PRIVATE KEY"});return w.decode(a.sign(s),"der")}(f,t,r,e);return{r:n.r.toArrayLike(Uint8Array),s:n.s.toArrayLike(Uint8Array)}}}}return b(f,o,s)}async function y(e,t,r,s,o,f){const d=new c.default(e);if(s&&!a.default.isStream(s))switch(d.type){case"web":try{return await async function(e,t,{r:r,s:n},s,o){const c=e.payloadSize,f=(0,u.rawPublicToJwk)(e.payloadSize,u.webCurves[e.name],o),d=await l.importKey("jwk",f,{name:"ECDSA",namedCurve:u.webCurves[e.name],hash:{name:i.default.read(i.default.webHash,e.hash)}},!1,["verify"]),h=a.default.concatUint8Array([new Uint8Array(c-r.length),r,new Uint8Array(c-n.length),n]).buffer;return l.verify({name:"ECDSA",namedCurve:u.webCurves[e.name],hash:{name:i.default.read(i.default.webHash,t)}},d,h,s)}(d,t,r,s,o)}catch(p){if("p521"!==d.name&&("DataError"===p.name||"OperationError"===p.name))throw p;a.default.print_debug_error("Browser did not support verifying: "+p.message)}break;case"node":return async function(e,t,{r:r,s:a},s,o){const u=h.createVerify(i.default.read(i.default.hash,t));u.write(s),u.end();const c=k.encode({algorithm:{algorithm:[1,2,840,10045,2,1],parameters:e.oid},subjectPublicKey:{unused:0,data:Array.from(o)}},"pem",{label:"PUBLIC KEY"}),f=w.encode({r:new n.default(r),s:new n.default(a)},"der");try{return u.verify(c,f)}catch(p){return!1}}(d,t,r,s,o)}return m(d,r,void 0===t?s:f,o)}async function b(e,t,r){const n=await(0,f.getIndutnyCurve)(e.name),i=(0,f.keyFromPrivate)(n,r).sign(t);return{r:i.r.toArrayLike(Uint8Array),s:i.s.toArrayLike(Uint8Array)}}async function m(e,t,r,n){const i=await(0,f.getIndutnyCurve)(e.name);return(0,f.keyFromPublic)(i,n).verify(r,t)}r.default={sign:p,verify:y,ellipticVerify:m,ellipticSign:b,validateParams:async function(e,t,r){const n=new c.default(e);if(n.keyType!==i.default.publicKey.ecdsa)return!1;switch(n.type){case"web":case"node":{const n=await s.default.getRandomBytes(8),u=i.default.hash.sha256,c=await o.default.digest(u,n);try{const i=await p(e,u,n,t,r,c);return await y(e,u,i,n,t,c)}catch(a){return!1}}default:return(0,u.validateStandardParams)(i.default.publicKey.ecdsa,e,t,r)}},parseParams:function(e){if(e.length<2||e.length>3)throw new Error("Unexpected number of parameters");const t=e[0],r=new c.default(t),n={oid:t};return n.Q=e[1].toUint8Array(),3===e.length&&(n.d=e[2].toUint8Array("be",r.payloadSize)),n}};const g=h?e("asn1.js"):void 0,w=h?g.define("ECDSASignature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())}):void 0,_=h?g.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").explicit(0).optional().any(),this.key("publicKey").explicit(1).optional().bitstr())}):void 0,v=h?g.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional().any())}):void 0,k=h?g.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(v),this.key("subjectPublicKey").bitstr())}):void 0},{"../../../enums":113,"../../../util":158,"../../hash":92,"../../random":109,"./curves":100,"./indutnyKey":105,"asn1.js":"asn1.js","bn.js":16}],103:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=s(e("hash.js/lib/hash/sha/512")),i=s(e("tweetnacl/nacl-fast-light.js")),a=s(e("../../../util"));function s(e){return e&&e.__esModule?e:{default:e}}i.default.hash=(e=>new Uint8Array((0,n.default)().update(e).digest())),r.default={sign:async function(e,t,r,n,s,o){const u=a.default.concatUint8Array([s,n.subarray(1)]),c=i.default.sign.detached(o,u);return{R:c.subarray(0,32),S:c.subarray(32)}},verify:async function(e,t,{R:r,S:n},s,o,u){const c=a.default.concatUint8Array([r,n]);return i.default.sign.detached.verify(u,c,o.subarray(1))},validateParams:async function(e,t,r){if("ed25519"!==e.getName())return!1;const n=i.default.sign.keyPair.fromSeed(r).publicKey,s=new Uint8Array([64,...n]);return a.default.equalsUint8Array(t,s)},parseParams:function(e){if(e.length<2||e.length>3)throw new Error("Unexpected number of parameters");const t={oid:e[0],Q:e[1].toUint8Array("be",33)};return 3===e.length&&(t.seed=e[2].toUint8Array("be",32)),t}}},{"../../../util":158,"hash.js/lib/hash/sha/512":43,"tweetnacl/nacl-fast-light.js":72}],104:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("./curves"),i=u(n),a=u(e("./ecdsa")),s=u(e("./eddsa")),o=u(e("./ecdh"));function u(e){return e&&e.__esModule?e:{default:e}}r.default={Curve:i.default,ecdh:o.default,ecdsa:a.default,eddsa:s.default,generate:n.generate,getPreferredHashAlgo:n.getPreferredHashAlgo}},{"./curves":100,"./ecdh":101,"./ecdsa":102,"./eddsa":103}],105:[function(e,t,r){(function(t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.keyFromPrivate=function(e,t){return e.keyPair({priv:t})},r.keyFromPublic=function(e,t){const r=e.keyPair({pub:t});if(!0!==r.validate().result)throw new Error("Invalid elliptic public key");return r},r.getIndutnyCurve=async function(r){if(!i.default.use_indutny_elliptic)throw new Error("This curve is only supported in the full build of OpenPGP.js");return new((await function(){if(!i.default.external_indutny_elliptic)return e("elliptic");if(a.default.detectNode())return e(i.default.indutny_elliptic_path);o||(o=async function(){const e=i.default.indutny_elliptic_path,r=i.default.indutny_elliptic_fetch_options,a=(0,n.dl)(e,r).catch(()=>(0,n.dl)(e,r)),s=await a,o=URL.createObjectURL(new Blob([s],{type:"text/javascript"}));if(await(0,n.loadScript)(o),URL.revokeObjectURL(o),!t.openpgp.elliptic)throw new Error("Elliptic library failed to load correctly");return t.openpgp.elliptic}().catch(e=>{throw o=void 0,e}));return o}()).ec)(r)};var n=e("../../../lightweight_helper"),i=s(e("../../../config")),a=s(e("../../../util"));function s(e){return e&&e.__esModule?e:{default:e}}let o}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../../config":79,"../../../lightweight_helper":125,"../../../util":158,elliptic:18}],106:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=u(e("tweetnacl/nacl-fast-light.js")),i=u(e("./rsa")),a=u(e("./elgamal")),s=u(e("./elliptic")),o=u(e("./dsa"));function u(e){return e&&e.__esModule?e:{default:e}}r.default={rsa:i.default,elgamal:a.default,elliptic:s.default,dsa:o.default,nacl:n.default}},{"./dsa":98,"./elgamal":99,"./elliptic":104,"./rsa":108,"tweetnacl/nacl-fast-light.js":72}],107:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=a(e("bn.js")),i=a(e("../random"));function a(e){return e&&e.__esModule?e:{default:e}}async function s(e,t,r){return!(t&&!e.subn(1).gcd(t).eqn(1))&&(!!u(e)&&(!!o(e)&&!!(await f(e,r))))}function o(e,t){return 0===(t=t||new n.default(2)).toRed(n.default.mont(e)).redPow(e.subn(1)).fromRed().cmpn(1)}function u(e){return c.every(t=>0!==e.modn(t))}r.default={randomProbablePrime:async function(e,t,r){const a=new n.default(1).shln(e-1),o=new n.default(30),u=[1,6,5,4,3,2,1,4,3,2,1,2,1,4,3,2,1,2,1,4,3,2,1,6,5,4,3,2,1,2];let c=await i.default.getRandomBN(a,a.shln(1)),f=c.mod(o).toNumber();do{c.iaddn(u[f]),f=(f+u[f])%u.length,c.bitLength()>e&&(c=c.mod(a.shln(1)).iadd(a),f=c.mod(o).toNumber())}while(!(await s(c,t,r)));return c},isProbablePrime:s,fermat:o,millerRabin:f,divisionTest:u};const c=[7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997,1009,1013,1019,1021,1031,1033,1039,1049,1051,1061,1063,1069,1087,1091,1093,1097,1103,1109,1117,1123,1129,1151,1153,1163,1171,1181,1187,1193,1201,1213,1217,1223,1229,1231,1237,1249,1259,1277,1279,1283,1289,1291,1297,1301,1303,1307,1319,1321,1327,1361,1367,1373,1381,1399,1409,1423,1427,1429,1433,1439,1447,1451,1453,1459,1471,1481,1483,1487,1489,1493,1499,1511,1523,1531,1543,1549,1553,1559,1567,1571,1579,1583,1597,1601,1607,1609,1613,1619,1621,1627,1637,1657,1663,1667,1669,1693,1697,1699,1709,1721,1723,1733,1741,1747,1753,1759,1777,1783,1787,1789,1801,1811,1823,1831,1847,1861,1867,1871,1873,1877,1879,1889,1901,1907,1913,1931,1933,1949,1951,1973,1979,1987,1993,1997,1999,2003,2011,2017,2027,2029,2039,2053,2063,2069,2081,2083,2087,2089,2099,2111,2113,2129,2131,2137,2141,2143,2153,2161,2179,2203,2207,2213,2221,2237,2239,2243,2251,2267,2269,2273,2281,2287,2293,2297,2309,2311,2333,2339,2341,2347,2351,2357,2371,2377,2381,2383,2389,2393,2399,2411,2417,2423,2437,2441,2447,2459,2467,2473,2477,2503,2521,2531,2539,2543,2549,2551,2557,2579,2591,2593,2609,2617,2621,2633,2647,2657,2659,2663,2671,2677,2683,2687,2689,2693,2699,2707,2711,2713,2719,2729,2731,2741,2749,2753,2767,2777,2789,2791,2797,2801,2803,2819,2833,2837,2843,2851,2857,2861,2879,2887,2897,2903,2909,2917,2927,2939,2953,2957,2963,2969,2971,2999,3001,3011,3019,3023,3037,3041,3049,3061,3067,3079,3083,3089,3109,3119,3121,3137,3163,3167,3169,3181,3187,3191,3203,3209,3217,3221,3229,3251,3253,3257,3259,3271,3299,3301,3307,3313,3319,3323,3329,3331,3343,3347,3359,3361,3371,3373,3389,3391,3407,3413,3433,3449,3457,3461,3463,3467,3469,3491,3499,3511,3517,3527,3529,3533,3539,3541,3547,3557,3559,3571,3581,3583,3593,3607,3613,3617,3623,3631,3637,3643,3659,3671,3673,3677,3691,3697,3701,3709,3719,3727,3733,3739,3761,3767,3769,3779,3793,3797,3803,3821,3823,3833,3847,3851,3853,3863,3877,3881,3889,3907,3911,3917,3919,3923,3929,3931,3943,3947,3967,3989,4001,4003,4007,4013,4019,4021,4027,4049,4051,4057,4073,4079,4091,4093,4099,4111,4127,4129,4133,4139,4153,4157,4159,4177,4201,4211,4217,4219,4229,4231,4241,4243,4253,4259,4261,4271,4273,4283,4289,4297,4327,4337,4339,4349,4357,4363,4373,4391,4397,4409,4421,4423,4441,4447,4451,4457,4463,4481,4483,4493,4507,4513,4517,4519,4523,4547,4549,4561,4567,4583,4591,4597,4603,4621,4637,4639,4643,4649,4651,4657,4663,4673,4679,4691,4703,4721,4723,4729,4733,4751,4759,4783,4787,4789,4793,4799,4801,4813,4817,4831,4861,4871,4877,4889,4903,4909,4919,4931,4933,4937,4943,4951,4957,4967,4969,4973,4987,4993,4999];async function f(e,t,r){const a=e.bitLength(),s=n.default.mont(e),o=new n.default(1).toRed(s);t||(t=Math.max(1,a/48|0));const u=e.subn(1),c=u.toRed(s);let f=0;for(;!u.testn(f);)f++;const d=e.shrn(f);for(;t>0;t--){let e,t=(r?r():await i.default.getRandomBN(new n.default(2),u)).toRed(s).redPow(d);if(!t.eq(o)&&!t.eq(c)){for(e=1;eh.generateKeyPair("rsa",t,(t,n,i)=>{t?r(t):e(b.decode(i,"der"))}));return{n:n.modulus,e:n.publicExponent,d:n.privateExponent,p:n.prime2,q:n.prime1,u:n.coefficient}}let s=await i.default.randomProbablePrime(e-(e>>1),r,40),u=await i.default.randomProbablePrime(e>>1,r,40);if(s.cmp(u)<0){var c=[s,u];u=c[0],s=c[1]}const f=u.subn(1).mul(s.subn(1));return{n:u.mul(s),e:r,d:r.invm(f),p:u,q:s,u:u.invm(s)}},validateParams:async function(e,t,r,i,s,o){if(e=new n.default(e),i=new n.default(i),s=new n.default(s),!i.mul(s).eq(e))return!1;const u=new n.default(1),c=new n.default(2);if(o=new n.default(o),!i.mul(o).umod(s).eq(u))return!1;t=new n.default(t),r=new n.default(r);const f=await a.default.getRandomBN(c,c.shln(e.bitLength()/3)),d=f.mul(r).mul(t);return!(!d.umod(i.sub(u)).eq(f)||!d.umod(s.sub(u)).eq(f))},bnSign:async function(e,t,r,i){t=new n.default(t);const a=new n.default(await u.default.emsa.encode(e,i,t.byteLength()),16);if(r=new n.default(r),t.cmp(a)<=0)throw new Error("Message size cannot exceed modulus size");const s=new n.default.red(t);return a.toRed(s).redPow(r).toArrayLike(Uint8Array,"be",t.byteLength())},webSign:async function(e,t,r,i,a,s,u,c){const f=function(e,t,r,i,a,s){const u=new n.default(i),c=new n.default(a),f=new n.default(r);let d=f.mod(c.subn(1)),l=f.mod(u.subn(1));return l=l.toArrayLike(Uint8Array),d=d.toArrayLike(Uint8Array),{kty:"RSA",n:o.default.Uint8Array_to_b64(e,!0),e:o.default.Uint8Array_to_b64(t,!0),d:o.default.Uint8Array_to_b64(r,!0),p:o.default.Uint8Array_to_b64(a,!0),q:o.default.Uint8Array_to_b64(i,!0),dp:o.default.Uint8Array_to_b64(d,!0),dq:o.default.Uint8Array_to_b64(l,!0),qi:o.default.Uint8Array_to_b64(s,!0),ext:!0}}(r,i,a,s,u,c),d={name:"RSASSA-PKCS1-v1_5",hash:{name:e}},h=await l.importKey("jwk",f,d,!1,["sign"]);return new Uint8Array(await l.sign({name:"RSASSA-PKCS1-v1_5",hash:e},h,t))},nodeSign:async function(e,t,r,i,a,s,o,u){const f=new n.default(s),d=new n.default(o),l=new n.default(a),p=l.mod(d.subn(1)),y=l.mod(f.subn(1)),m=h.createSign(c.default.read(c.default.hash,e));m.write(t),m.end();const g={version:0,modulus:new n.default(r),publicExponent:new n.default(i),privateExponent:new n.default(a),prime1:new n.default(o),prime2:new n.default(s),exponent1:p,exponent2:y,coefficient:new n.default(u)};if(void 0!==h.createPrivateKey){const e=b.encode(g,"der");return new Uint8Array(m.sign({key:e,format:"der",type:"pkcs1"}))}const w=b.encode(g,"pem",{label:"RSA PRIVATE KEY"});return new Uint8Array(m.sign(w))},bnVerify:async function(e,t,r,i,a){if(r=new n.default(r),t=new n.default(t),i=new n.default(i),r.cmp(t)<=0)throw new Error("Signature size cannot exceed modulus size");const s=new n.default.red(r),c=t.toRed(s).redPow(i).toArrayLike(Uint8Array,"be",r.byteLength()),f=await u.default.emsa.encode(e,a,r.byteLength());return o.default.Uint8Array_to_hex(c)===f},webVerify:async function(e,t,r,n,i){const a=function(e,t){return{kty:"RSA",n:o.default.Uint8Array_to_b64(e,!0),e:o.default.Uint8Array_to_b64(t,!0),ext:!0}}(n,i),s=await l.importKey("jwk",a,{name:"RSASSA-PKCS1-v1_5",hash:{name:e}},!1,["verify"]);return l.verify({name:"RSASSA-PKCS1-v1_5",hash:e},s,r,t)},nodeVerify:async function(e,t,r,i,a){const s=h.createVerify(c.default.read(c.default.hash,e));s.write(t),s.end();const o={modulus:new n.default(i),publicExponent:new n.default(a)};let u;if(void 0!==h.createPrivateKey){u={key:m.encode(o,"der"),format:"der",type:"pkcs1"}}else u=m.encode(o,"pem",{label:"RSA PUBLIC KEY"});try{return await s.verify(u,r)}catch(f){return!1}},nodeEncrypt:async function(e,t,r){const i={modulus:new n.default(t),publicExponent:new n.default(r)};let a;if(void 0!==h.createPrivateKey){a={key:m.encode(i,"der"),format:"der",type:"pkcs1",padding:h.constants.RSA_PKCS1_PADDING}}else{a={key:m.encode(i,"pem",{label:"RSA PUBLIC KEY"}),padding:h.constants.RSA_PKCS1_PADDING}}return new Uint8Array(h.publicEncrypt(a,e))},bnEncrypt:async function(e,t,r){if(t=new n.default(t),e=(e=new f.default(await u.default.eme.encode(o.default.Uint8Array_to_str(e),t.byteLength()))).toBN(),r=new n.default(r),t.cmp(e)<=0)throw new Error("Message size cannot exceed modulus size");const i=new n.default.red(t);return e.toRed(i).redPow(r).toArrayLike(Uint8Array,"be",t.byteLength())},nodeDecrypt:function(e,t,r,i,a,s,u){const c=new n.default(a),f=new n.default(s),d=new n.default(i),l=d.mod(f.subn(1)),p=d.mod(c.subn(1)),y={version:0,modulus:new n.default(t),publicExponent:new n.default(r),privateExponent:new n.default(i),prime1:new n.default(s),prime2:new n.default(a),exponent1:l,exponent2:p,coefficient:new n.default(u)};let m;if(void 0!==h.createPrivateKey){m={key:b.encode(y,"der"),format:"der",type:"pkcs1",padding:h.constants.RSA_PKCS1_PADDING}}else{m={key:b.encode(y,"pem",{label:"RSA PRIVATE KEY"}),padding:h.constants.RSA_PKCS1_PADDING}}return o.default.Uint8Array_to_str(h.privateDecrypt(m,e))},bnDecrypt:async function(e,t,r,i,o,c,d){if(e=new n.default(e),t=new n.default(t),r=new n.default(r),i=new n.default(i),o=new n.default(o),c=new n.default(c),d=new n.default(d),t.cmp(e)<=0)throw new Error("Data too large.");const l=i.mod(c.subn(1)),h=i.mod(o.subn(1)),p=new n.default.red(o),y=new n.default.red(c),b=new n.default.red(t);let m,g;s.default.rsa_blinding&&(m=(g=(await a.default.getRandomBN(new n.default(2),t)).toRed(b)).redInvm().redPow(r),e=e.toRed(b).redMul(m).fromRed());const w=e.toRed(p).redPow(h),_=e.toRed(y).redPow(l).redSub(w.fromRed().toRed(y));let v=d.toRed(y).redMul(_).fromRed().mul(o).add(w).toRed(b);return s.default.rsa_blinding&&(v=v.redMul(g)),u.default.eme.decode(new f.default(v).toString())},prime:i.default}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../../config":79,"../../enums":113,"../../type/mpi":155,"../../util":158,"../pkcs1":96,"../random":109,"./prime":107,"asn1.js":"asn1.js","bn.js":16}],109:[function(e,t,r){(function(t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=i(e("bn.js"));function i(e){return e&&e.__esModule?e:{default:e}}const a=i(e("../util")).default.detectNode()&&e("crypto");function s(){this.buffer=null,this.size=null,this.callback=null}r.default={getRandomBytes:async function(e){const r=new Uint8Array(e);if("undefined"!=typeof crypto&&crypto.getRandomValues)crypto.getRandomValues(r);else if(void 0!==t&&"object"==typeof t.msCrypto&&"function"==typeof t.msCrypto.getRandomValues)t.msCrypto.getRandomValues(r);else if(a){const e=a.randomBytes(r.length);r.set(e)}else{if(!this.randomBuffer.buffer)throw new Error("No secure random number generator available.");await this.randomBuffer.get(r)}return r},getRandomBN:async function(e,t){if(t.cmp(e)<=0)throw new Error("Illegal parameter value: max <= min");const r=t.sub(e),i=r.byteLength();return new n.default(await this.getRandomBytes(i+8)).mod(r).add(e)},randomBuffer:new s},s.prototype.init=function(e,t){this.buffer=new Uint8Array(e),this.size=0,this.callback=t},s.prototype.set=function(e){if(!this.buffer)throw new Error("RandomBuffer is not initialized");if(!(e instanceof Uint8Array))throw new Error("Invalid type: buf not an Uint8Array");const t=this.buffer.length-this.size;e.length>t&&(e=e.subarray(0,t)),this.buffer.set(e,this.size),this.size+=e.length},s.prototype.get=async function(e){if(!this.buffer)throw new Error("RandomBuffer is not initialized");if(!(e instanceof Uint8Array))throw new Error("Invalid type: buf not an Uint8Array");if(this.size{const r=h?Math.floor(e.length/4):0,n=new Uint32Array(e.buffer,e.byteOffset,r);for(let i=0;i>24&255]^l[1][t>>16&255]^l[2][t>>8&255]^l[3][t>>0&255];for(let i=4*r;i>8^l[0][255&t^e[i]]},()=>new Uint8Array([t,t>>8,t>>16]))}(e);return i.default.encode(t)}const l=[new Array(255),new Array(255),new Array(255),new Array(255)];for(let b=0;b<=255;b++){let e=b<<16;for(let t=0;t<8;t++)e=e<<1^(0!=(8388608&e)?8801531:0);l[0][b]=(16711680&e)>>16|65280&e|(255&e)<<16}for(let b=0;b<=255;b++)l[1][b]=l[0][b]>>8^l[0][255&l[0][b]];for(let b=0;b<=255;b++)l[2][b]=l[1][b]>>8^l[0][255&l[1][b]];for(let b=0;b<=255;b++)l[3][b]=l[2][b]>>8^l[0][255&l[2][b]];const h=function(){const e=new ArrayBuffer(2);return new DataView(e).setInt16(0,255,!0),255===new Int16Array(e)[0]}();function p(e){for(let t=0;t=0&&n!==e.length-1&&(t=e.slice(0,n),r=e.slice(n+1).substr(0,4)),{body:t,checksum:r}}r.default={encode:function(e,t,r,s,u){let c,l;e===a.default.armor.signed&&(c=t.text,l=t.hash,t=t.data);const h=n.default.passiveClone(t),p=[];switch(e){case a.default.armor.multipart_section:p.push("-----BEGIN PGP MESSAGE, PART "+r+"/"+s+"-----\r\n"),p.push(f(u)),p.push(i.default.encode(t)),p.push("=",d(h)),p.push("-----END PGP MESSAGE, PART "+r+"/"+s+"-----\r\n");break;case a.default.armor.multipart_last:p.push("-----BEGIN PGP MESSAGE, PART "+r+"-----\r\n"),p.push(f(u)),p.push(i.default.encode(t)),p.push("=",d(h)),p.push("-----END PGP MESSAGE, PART "+r+"-----\r\n");break;case a.default.armor.signed:p.push("\r\n-----BEGIN PGP SIGNED MESSAGE-----\r\n"),p.push("Hash: "+l+"\r\n\r\n"),p.push(c.replace(/^-/gm,"- -")),p.push("\r\n-----BEGIN PGP SIGNATURE-----\r\n"),p.push(f(u)),p.push(i.default.encode(t)),p.push("=",d(h)),p.push("-----END PGP SIGNATURE-----\r\n");break;case a.default.armor.message:p.push("-----BEGIN PGP MESSAGE-----\r\n"),p.push(f(u)),p.push(i.default.encode(t)),p.push("=",d(h)),p.push("-----END PGP MESSAGE-----\r\n");break;case a.default.armor.public_key:p.push("-----BEGIN PGP PUBLIC KEY BLOCK-----\r\n"),p.push(f(u)),p.push(i.default.encode(t)),p.push("=",d(h)),p.push("-----END PGP PUBLIC KEY BLOCK-----\r\n");break;case a.default.armor.private_key:p.push("-----BEGIN PGP PRIVATE KEY BLOCK-----\r\n"),p.push(f(u)),p.push(i.default.encode(t)),p.push("=",d(h)),p.push("-----END PGP PRIVATE KEY BLOCK-----\r\n");break;case a.default.armor.signature:p.push("-----BEGIN PGP SIGNATURE-----\r\n"),p.push(f(u)),p.push(i.default.encode(t)),p.push("=",d(h)),p.push("-----END PGP SIGNATURE-----\r\n")}return o.default.concat(p)},decode:function(e){return new Promise(async(t,r)=>{try{const u=/^-----[^-]+-----$/m,f=/^[ \f\r\t\u00a0\u2000-\u200a\u202f\u205f\u3000]*$/;let l;const h=[];let b,m,g,w=h,_=[],v=i.default.decode(n.default.transformPair(e,async(e,i)=>{const a=n.default.getReader(e);try{for(;;){let e=await a.readLine();if(void 0===e)throw new Error("Misformed armored text");if(e=o.default.removeTrailingSpaces(e.replace(/[\r\n]/g,"")),l)if(b)m||2!==l||(u.test(e)?(_=_.join("\r\n"),m=!0,p(w),w=[],b=!1):_.push(e.replace(/^- /,"")));else if(u.test(e)&&r(new Error("Mandatory blank line missing between armor headers and armor data")),f.test(e)){if(p(w),b=!0,m||2!==l){t({text:_,data:v,headers:h,type:l});break}}else w.push(e);else u.test(e)&&(l=c(e))}}catch(k){return void r(k)}const s=n.default.getWriter(i);try{for(;;){await s.ready;var d=await a.read();const e=d.done,t=d.value;if(e)throw new Error("Misformed armored text");const r=t+"";if(-1!==r.indexOf("=")||-1!==r.indexOf("-")){let e=await a.readToEnd();e.length||(e=""),e=r+e;const t=(e=o.default.removeTrailingSpaces(e.replace(/\r/g,""))).split(u);if(1===t.length)throw new Error("Misformed armored text");const n=y(t[0].slice(0,-1));g=n.checksum,await s.write(n.body);break}await s.write(r)}await s.ready,await s.close()}catch(k){await s.abort(k)}}));v=n.default.transformPair(v,async(e,t)=>{const r=n.default.readToEnd(d(n.default.passiveClone(e)));r.catch(()=>{}),await n.default.pipe(e,t,{preventClose:!0});const i=n.default.getWriter(t);try{const e=(await r).replace("\r\n","");if(g!==e&&(g||s.default.checksum_required))throw new Error("Ascii armor integrity check on message failed: '"+g+"' should be '"+e+"'");await i.ready,await i.close()}catch(a){await i.abort(a)}})}catch(a){r(a)}})}}},{"../config":79,"../enums.js":113,"../util":158,"./base64.js":112,"web-stream-tools":75}],112:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=a(e("web-stream-tools")),i=a(e("../util"));function a(e){return e&&e.__esModule?e:{default:e}}const s=i.default.getNodeBuffer();let o,u;s?(o=(e=>s.from(e).toString("base64")),u=(e=>{const t=s.from(e,"base64");return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)})):(o=(e=>btoa(i.default.Uint8Array_to_str(e))),u=(e=>i.default.str_to_Uint8Array(atob(e)))),r.default={encode:function(e){let t=new Uint8Array;return n.default.transform(e,e=>{t=i.default.concatUint8Array([t,e]);const r=[],n=Math.floor(t.length/45),a=45*n,s=o(t.subarray(0,a));for(let t=0;tt.length?o(t)+"\r\n":"")},decode:function(e){let t="";return n.default.transform(e,e=>{t+=e;let r=0;const n=[" ","\t","\r","\n"];for(let s=0;s0&&(i-r)%4!=0;i--)n.includes(t[i])&&r--;const a=u(t.substr(0,i));return t=t.substr(i),a},()=>u(t))}}},{"../util":158,"web-stream-tools":75}],113:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const n=Symbol("byValue");r.default={curve:{p256:"p256","P-256":"p256",secp256r1:"p256",prime256v1:"p256","1.2.840.10045.3.1.7":"p256","2a8648ce3d030107":"p256","2A8648CE3D030107":"p256",p384:"p384","P-384":"p384",secp384r1:"p384","1.3.132.0.34":"p384","2b81040022":"p384","2B81040022":"p384",p521:"p521","P-521":"p521",secp521r1:"p521","1.3.132.0.35":"p521","2b81040023":"p521","2B81040023":"p521",secp256k1:"secp256k1","1.3.132.0.10":"secp256k1","2b8104000a":"secp256k1","2B8104000A":"secp256k1",ED25519:"ed25519",ed25519:"ed25519",Ed25519:"ed25519","1.3.6.1.4.1.11591.15.1":"ed25519","2b06010401da470f01":"ed25519","2B06010401DA470F01":"ed25519",X25519:"curve25519",cv25519:"curve25519",curve25519:"curve25519",Curve25519:"curve25519","1.3.6.1.4.1.3029.1.5.1":"curve25519","2b060104019755010501":"curve25519","2B060104019755010501":"curve25519",brainpoolP256r1:"brainpoolP256r1","1.3.36.3.3.2.8.1.1.7":"brainpoolP256r1","2b2403030208010107":"brainpoolP256r1","2B2403030208010107":"brainpoolP256r1",brainpoolP384r1:"brainpoolP384r1","1.3.36.3.3.2.8.1.1.11":"brainpoolP384r1","2b240303020801010b":"brainpoolP384r1","2B240303020801010B":"brainpoolP384r1",brainpoolP512r1:"brainpoolP512r1","1.3.36.3.3.2.8.1.1.13":"brainpoolP512r1","2b240303020801010d":"brainpoolP512r1","2B240303020801010D":"brainpoolP512r1"},s2k:{simple:0,salted:1,iterated:3,gnu:101},publicKey:{rsa_encrypt_sign:1,rsa_encrypt:2,rsa_sign:3,elgamal:16,dsa:17,ecdh:18,ecdsa:19,eddsa:22,aedh:23,aedsa:24},symmetric:{plaintext:0,idea:1,"3des":2,tripledes:2,cast5:3,blowfish:4,aes128:7,aes192:8,aes256:9,twofish:10},compression:{uncompressed:0,zip:1,zlib:2,bzip2:3},hash:{md5:1,sha1:2,ripemd:3,sha256:8,sha384:9,sha512:10,sha224:11},webHash:{"SHA-1":2,"SHA-256":8,"SHA-384":9,"SHA-512":10},aead:{eax:1,ocb:2,experimental_gcm:100},packet:{publicKeyEncryptedSessionKey:1,signature:2,symEncryptedSessionKey:3,onePassSignature:4,secretKey:5,publicKey:6,secretSubkey:7,compressed:8,symmetricallyEncrypted:9,marker:10,literal:11,trust:12,userid:13,publicSubkey:14,userAttribute:17,symEncryptedIntegrityProtected:18,modificationDetectionCode:19,symEncryptedAEADProtected:20},literal:{binary:"b".charCodeAt(),text:"t".charCodeAt(),utf8:"u".charCodeAt(),mime:"m".charCodeAt()},signature:{binary:0,text:1,standalone:2,cert_generic:16,cert_persona:17,cert_casual:18,cert_positive:19,cert_revocation:48,subkey_binding:24,key_binding:25,key:31,key_revocation:32,subkey_revocation:40,timestamp:64,third_party:80},signatureSubpacket:{signature_creation_time:2,signature_expiration_time:3,exportable_certification:4,trust_signature:5,regular_expression:6,revocable:7,key_expiration_time:9,placeholder_backwards_compatibility:10,preferred_symmetric_algorithms:11,revocation_key:12,issuer:16,notation_data:20,preferred_hash_algorithms:21,preferred_compression_algorithms:22,key_server_preferences:23,preferred_key_server:24,primary_user_id:25,policy_uri:26,key_flags:27,signers_user_id:28,reason_for_revocation:29,features:30,signature_target:31,embedded_signature:32,issuer_fingerprint:33,preferred_aead_algorithms:34},keyFlags:{certify_keys:1,sign_data:2,encrypt_communication:4,encrypt_storage:8,split_private_key:16,authentication:32,shared_private_key:128},armor:{multipart_section:0,multipart_last:1,signed:2,message:3,public_key:4,private_key:5,signature:6},reasonForRevocation:{no_reason:0,key_superseded:1,key_compromised:2,key_retired:3,userid_invalid:32},features:{modification_detection:1,aead:2,v5_keys:4},write:function(e,t){if("number"==typeof t&&(t=this.read(e,t)),void 0!==e[t])return e[t];throw new Error("Invalid enum value.")},read:function(e,t){if(e[n]||(e[n]=[],Object.entries(e).forEach(([t,r])=>{e[n][r]=t})),void 0!==e[n][t])return e[n][t];throw new Error("Invalid enum value.")}}},{}],114:[function(e,t,r){(function(t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n,i=e("./config"),a=(n=i)&&n.__esModule?n:{default:n};function s(r){this._baseUrl=r||a.default.keyserver,this._fetch="function"==typeof t.fetch?t.fetch:e("node-fetch")}s.prototype.lookup=function(e){let t=this._baseUrl+"/pks/lookup?op=get&options=mr&search=";const r=this._fetch;if(e.keyId)t+="0x"+encodeURIComponent(e.keyId);else{if(!e.query)throw new Error("You must provide a query parameter!");t+=encodeURIComponent(e.query)}return r(t).then(function(e){if(200===e.status)return e.text()}).then(function(e){if(e&&!(e.indexOf("-----END PGP PUBLIC KEY BLOCK-----")<0))return e.trim()})},s.prototype.upload=function(e){const t=this._baseUrl+"/pks/add";return(0,this._fetch)(t,{method:"post",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},body:"keytext="+encodeURIComponent(e)})},r.default=s}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./config":79,"node-fetch":"node-fetch"}],115:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.lightweight=r.WKD=r.HKP=r.AsyncProxy=r.Keyring=r.crypto=r.config=r.enums=r.armor=r.stream=r.OID=r.KDFParams=r.ECDHSymmetricKey=r.Keyid=r.S2K=r.MPI=r.packet=r.util=r.cleartext=r.message=r.signature=r.key=r.destroyWorker=r.getWorker=r.initWorker=r.decryptSessionKeys=r.encryptSessionKey=r.decryptKey=r.revokeKey=r.reformatKey=r.generateKey=r.verify=r.sign=r.decrypt=r.encrypt=void 0;var n=e("./openpgp");Object.defineProperty(r,"encrypt",{enumerable:!0,get:function(){return n.encrypt}}),Object.defineProperty(r,"decrypt",{enumerable:!0,get:function(){return n.decrypt}}),Object.defineProperty(r,"sign",{enumerable:!0,get:function(){return n.sign}}),Object.defineProperty(r,"verify",{enumerable:!0,get:function(){return n.verify}}),Object.defineProperty(r,"generateKey",{enumerable:!0,get:function(){return n.generateKey}}),Object.defineProperty(r,"reformatKey",{enumerable:!0,get:function(){return n.reformatKey}}),Object.defineProperty(r,"revokeKey",{enumerable:!0,get:function(){return n.revokeKey}}),Object.defineProperty(r,"decryptKey",{enumerable:!0,get:function(){return n.decryptKey}}),Object.defineProperty(r,"encryptSessionKey",{enumerable:!0,get:function(){return n.encryptSessionKey}}),Object.defineProperty(r,"decryptSessionKeys",{enumerable:!0,get:function(){return n.decryptSessionKeys}}),Object.defineProperty(r,"initWorker",{enumerable:!0,get:function(){return n.initWorker}}),Object.defineProperty(r,"getWorker",{enumerable:!0,get:function(){return n.getWorker}}),Object.defineProperty(r,"destroyWorker",{enumerable:!0,get:function(){return n.destroyWorker}});var i=e("./util");Object.defineProperty(r,"util",{enumerable:!0,get:function(){return M(i).default}});var a=e("./packet");Object.defineProperty(r,"packet",{enumerable:!0,get:function(){return M(a).default}});var s=e("./type/mpi");Object.defineProperty(r,"MPI",{enumerable:!0,get:function(){return M(s).default}});var o=e("./type/s2k");Object.defineProperty(r,"S2K",{enumerable:!0,get:function(){return M(o).default}});var u=e("./type/keyid");Object.defineProperty(r,"Keyid",{enumerable:!0,get:function(){return M(u).default}});var c=e("./type/ecdh_symkey");Object.defineProperty(r,"ECDHSymmetricKey",{enumerable:!0,get:function(){return M(c).default}});var f=e("./type/kdf_params");Object.defineProperty(r,"KDFParams",{enumerable:!0,get:function(){return M(f).default}});var d=e("./type/oid");Object.defineProperty(r,"OID",{enumerable:!0,get:function(){return M(d).default}});var l=e("web-stream-tools");Object.defineProperty(r,"stream",{enumerable:!0,get:function(){return M(l).default}});var h=e("./encoding/armor");Object.defineProperty(r,"armor",{enumerable:!0,get:function(){return M(h).default}});var p=e("./enums");Object.defineProperty(r,"enums",{enumerable:!0,get:function(){return M(p).default}});var y=e("./config/config");Object.defineProperty(r,"config",{enumerable:!0,get:function(){return M(y).default}});var b=e("./crypto");Object.defineProperty(r,"crypto",{enumerable:!0,get:function(){return M(b).default}});var m=e("./keyring");Object.defineProperty(r,"Keyring",{enumerable:!0,get:function(){return M(m).default}});var g=e("./worker/async_proxy");Object.defineProperty(r,"AsyncProxy",{enumerable:!0,get:function(){return M(g).default}});var w=e("./hkp");Object.defineProperty(r,"HKP",{enumerable:!0,get:function(){return M(w).default}});var _=e("./wkd");Object.defineProperty(r,"WKD",{enumerable:!0,get:function(){return M(_).default}});var v=x(n),k=x(e("./key")),A=x(e("./signature")),S=x(e("./message")),E=x(e("./cleartext")),P=x(e("./lightweight_helper"));function x(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function M(e){return e&&e.__esModule?e:{default:e}}r.default=v;r.key=k,r.signature=A,r.message=S,r.cleartext=E,r.lightweight=P},{"./cleartext":77,"./config/config":78,"./crypto":94,"./encoding/armor":111,"./enums":113,"./hkp":114,"./key":118,"./keyring":122,"./lightweight_helper":125,"./message":126,"./openpgp":127,"./packet":131,"./signature":151,"./type/ecdh_symkey":152,"./type/kdf_params":153,"./type/keyid":154,"./type/mpi":155,"./type/oid":156,"./type/s2k":157,"./util":158,"./wkd":159,"./worker/async_proxy":160,"web-stream-tools":75}],116:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.generate=async function(e){e.sign=!0,(e=a.sanitizeKeyOptions(e)).subkeys=e.subkeys.map(function(t,r){return a.sanitizeKeyOptions(e.subkeys[r],e)});let t=[a.generateSecretKey(e)];return t=t.concat(e.subkeys.map(a.generateSecretSubkey)),Promise.all(t).then(t=>d(t[0],t.slice(1),e))},r.reformat=async function(e){e=i(e);try{const t=e.privateKey.getKeys().every(e=>e.isDecrypted());t||await e.privateKey.decrypt()}catch(a){throw new Error("Key not decrypted")}const t=e.privateKey.toPacketlist();let r;const n=[];for(let o=0;o({sign:await e.privateKey.getSigningKey(t.getKeyId(),null).catch(()=>{})&&!(await e.privateKey.getEncryptionKey(t.getKeyId(),null).catch(()=>{}))}))));if(e.subkeys.length!==n.length)throw new Error("Number of subkey options does not match number of subkeys");return e.subkeys=e.subkeys.map(function(t,r){return i(e.subkeys[r],e)}),d(r,n,e);function i(e,t={}){return e.keyExpirationTime=e.keyExpirationTime||t.keyExpirationTime,e.passphrase=o.default.isString(e.passphrase)?e.passphrase:t.passphrase,e.date=e.date||t.date,e}},r.read=l,r.readArmored=async function(e){try{const r=await c.default.decode(e);if(r.type!==s.default.armor.public_key&&r.type!==s.default.armor.private_key)throw new Error("Armored text not of type key");return l(r.data)}catch(t){const e={keys:[],err:[]};return e.err.push(t),e}};var n=f(e("../packet")),i=f(e("./key")),a=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("./helper")),s=f(e("../enums")),o=f(e("../util")),u=f(e("../config")),c=f(e("../encoding/armor"));function f(e){return e&&e.__esModule?e:{default:e}}async function d(e,t,r){r.passphrase&&await e.encrypt(r.passphrase),await Promise.all(t.map(async function(e,t){const n=r.subkeys[t].passphrase;n&&await e.encrypt(n)}));const o=new n.default.List;o.push(e),await Promise.all(r.userIds.map(async function(t,i){function o(e,t){if(t){const r=e.indexOf(t);r>=1&&e.splice(r,1),0!==r&&e.unshift(t)}return e}const c=new n.default.Userid;c.format(t);const f={};f.userId=c,f.key=e;const d=new n.default.Signature(r.date);return d.signatureType=s.default.signature.cert_generic,d.publicKeyAlgorithm=e.algorithm,d.hashAlgorithm=await a.getPreferredHashAlgo(null,e),d.keyFlags=[s.default.keyFlags.certify_keys|s.default.keyFlags.sign_data],d.preferredSymmetricAlgorithms=o([s.default.symmetric.aes256,s.default.symmetric.aes128,s.default.symmetric.aes192,s.default.symmetric.cast5,s.default.symmetric.tripledes],u.default.encryption_cipher),u.default.aead_protect&&(d.preferredAeadAlgorithms=o([s.default.aead.eax,s.default.aead.ocb],u.default.aead_mode)),d.preferredHashAlgorithms=o([s.default.hash.sha256,s.default.hash.sha512,s.default.hash.sha1],u.default.prefer_hash_algorithm),d.preferredCompressionAlgorithms=o([s.default.compression.zlib,s.default.compression.zip,s.default.compression.uncompressed],u.default.compression),0===i&&(d.isPrimaryUserID=!0),u.default.integrity_protect&&(d.features=[0],d.features[0]|=s.default.features.modification_detection),u.default.aead_protect&&(d.features||(d.features=[0]),d.features[0]|=s.default.features.aead),u.default.v5_keys&&(d.features||(d.features=[0]),d.features[0]|=s.default.features.v5_keys),r.keyExpirationTime>0&&(d.keyExpirationTime=r.keyExpirationTime,d.keyNeverExpires=!1),await d.sign(e,f),{userIdPacket:c,signaturePacket:d}})).then(e=>{e.forEach(({userIdPacket:e,signaturePacket:t})=>{o.push(e),o.push(t)})}),await Promise.all(t.map(async function(t,n){const i=r.subkeys[n];return{secretSubkeyPacket:t,subkeySignaturePacket:await a.createBindingSignature(t,e,i)}})).then(e=>{e.forEach(({secretSubkeyPacket:e,subkeySignaturePacket:t})=>{o.push(e),o.push(t)})});const c={key:e};return o.push(await a.createSignaturePacket(c,null,e,{signatureType:s.default.signature.key_revocation,reasonForRevocationFlag:s.default.reasonForRevocation.no_reason,reasonForRevocationString:""},r.date)),r.passphrase&&e.clearPrivateParams(),await Promise.all(t.map(async function(e,t){r.subkeys[t].passphrase&&e.clearPrivateParams()})),new i.default(o)}async function l(e){const t={keys:[]},r=[];try{const o=new n.default.List;await o.read(e);const u=o.indexOfTag(s.default.packet.publicKey,s.default.packet.secretKey);if(0===u.length)throw new Error("No key packet found");for(let e=0;e=0;a--)try{s&&!(e[a].created>=s.created)||e[a].isExpired(i)||!e[a].verified&&!(await e[a].verify(t,r,n))||(s=e[a])}catch(c){o=c}if(!s)throw u.default.wrapError(`Could not find valid ${a.default.read(a.default.signature,r)} signature in key ${t.getKeyId().toHex()}`.replace("cert_generic ","self-").replace("_"," "),o);return s},r.isDataExpired=function(e,t,r=new Date){const n=u.default.normalizeDate(r);if(null!==n){const i=l(e,t);return!(e.created<=n&&n<=i)||t&&t.isExpired(r)}return!1},r.createBindingSignature=async function(e,t,r){const n={};n.key=t,n.bind=e;const s=new i.default.Signature(r.date);s.signatureType=a.default.signature.subkey_binding,s.publicKeyAlgorithm=t.algorithm,s.hashAlgorithm=await f(null,e),r.sign?(s.keyFlags=[a.default.keyFlags.sign_data],s.embeddedSignature=await d(n,null,e,{signatureType:a.default.signature.key_binding},r.date)):s.keyFlags=[a.default.keyFlags.encrypt_communication|a.default.keyFlags.encrypt_storage];r.keyExpirationTime>0&&(s.keyExpirationTime=r.keyExpirationTime,s.keyNeverExpires=!1);return await s.sign(t,n),s},r.getPreferredHashAlgo=f,r.getPreferredAlgo=async function(e,t,r=new Date,n=[]){const i="symmetric"===e?"preferredSymmetricAlgorithms":"preferredAeadAlgorithms",s="symmetric"===e?a.default.symmetric.aes128:a.default.aead.eax,o={};await Promise.all(t.map(async function(e,t){const a=await e.getPrimaryUser(r,n[t]);if(!a.selfCertification[i])return s;a.selfCertification[i].forEach(function(e,t){const r=o[e]||(o[e]={prio:0,count:0,algo:e});r.prio+=64>>t,r.count++})}));let u={prio:0,algo:s};return Object.values(o).forEach(({prio:r,count:n,algo:i})=>{try{i!==a.default[e].plaintext&&i!==a.default[e].idea&&a.default.read(a.default[e],i)&&n===t.length&&r>u.prio&&(u=o[i])}catch(s){}}),u.algo},r.createSignaturePacket=d,r.mergeSignatures=async function(e,t,r,n){(e=e[r])&&(t[r].length?await Promise.all(e.map(async function(e){e.isExpired()||n&&!(await n(e))||t[r].some(function(t){return u.default.equalsUint8Array(t.signature,e.signature)})||t[r].push(e)})):t[r]=e)},r.isDataRevoked=async function(e,t,r,n,i,a,o=new Date){a=a||e;const c=u.default.normalizeDate(o),f=[];if(await Promise.all(n.map(async function(e){try{i&&!e.issuerKeyId.equals(i.issuerKeyId)||s.default.revocations_expire&&e.isExpired(c)||!e.verified&&!(await e.verify(a,t,r))||f.push(e.issuerKeyId)}catch(n){}})),i)return i.revoked=!!f.some(e=>e.equals(i.issuerKeyId))||(i.revoked||!1),i.revoked;return f.length>0},r.getExpirationTime=l,r.isAeadSupported=async function(e,t=new Date,r=[]){let n=!0;return await Promise.all(e.map(async function(e,i){const s=await e.getPrimaryUser(t,r[i]);s.selfCertification.features&&s.selfCertification.features[0]&a.default.features.aead||(n=!1)})),n},r.sanitizeKeyOptions=function(e,t={}){if(e.curve=e.curve||t.curve,e.rsaBits=e.rsaBits||t.rsaBits,e.keyExpirationTime=void 0!==e.keyExpirationTime?e.keyExpirationTime:t.keyExpirationTime,e.passphrase=u.default.isString(e.passphrase)?e.passphrase:t.passphrase,e.date=e.date||t.date,e.sign=e.sign||!1,e.curve){try{e.curve=a.default.write(a.default.curve,e.curve)}catch(r){throw new Error("Not valid curve.")}e.curve!==a.default.curve.ed25519&&e.curve!==a.default.curve.curve25519||(e.curve=e.sign?a.default.curve.ed25519:a.default.curve.curve25519),e.sign?e.algorithm=e.curve===a.default.curve.ed25519?a.default.publicKey.eddsa:a.default.publicKey.ecdsa:e.algorithm=a.default.publicKey.ecdh}else{if(!e.rsaBits)throw new Error("Unrecognized key type");e.algorithm=a.default.publicKey.rsa_encrypt_sign}return e},r.isValidSigningKeyPacket=function(e,t){if(!t.verified||!1!==t.revoked)throw new Error("Signature not verified");return e.algorithm!==a.default.read(a.default.publicKey,a.default.publicKey.rsa_encrypt)&&e.algorithm!==a.default.read(a.default.publicKey,a.default.publicKey.elgamal)&&e.algorithm!==a.default.read(a.default.publicKey,a.default.publicKey.ecdh)&&(!t.keyFlags||0!=(t.keyFlags[0]&a.default.keyFlags.sign_data))},r.isValidEncryptionKeyPacket=function(e,t){if(!t.verified||!1!==t.revoked)throw new Error("Signature not verified");return e.algorithm!==a.default.read(a.default.publicKey,a.default.publicKey.dsa)&&e.algorithm!==a.default.read(a.default.publicKey,a.default.publicKey.rsa_sign)&&e.algorithm!==a.default.read(a.default.publicKey,a.default.publicKey.ecdsa)&&e.algorithm!==a.default.read(a.default.publicKey,a.default.publicKey.eddsa)&&(!t.keyFlags||0!=(t.keyFlags[0]&a.default.keyFlags.encrypt_communication)||0!=(t.keyFlags[0]&a.default.keyFlags.encrypt_storage))};var i=c(e("../packet")),a=c(e("../enums")),s=c(e("../config")),o=c(e("../crypto")),u=c(e("../util"));function c(e){return e&&e.__esModule?e:{default:e}}async function f(e,t,r=new Date,a={}){let u=s.default.prefer_hash_algorithm,c=u;if(e){const t=await e.getPrimaryUser(r,a);if(t.selfCertification.preferredHashAlgorithms)c=n(t.selfCertification.preferredHashAlgorithms,1)[0],u=o.default.hash.getHashByteLength(u)<=o.default.hash.getHashByteLength(c)?c:u}switch(Object.getPrototypeOf(t)){case i.default.SecretKey.prototype:case i.default.PublicKey.prototype:case i.default.SecretSubkey.prototype:case i.default.PublicSubkey.prototype:switch(t.algorithm){case"ecdh":case"ecdsa":case"eddsa":c=o.default.publicKey.elliptic.getPreferredHashAlgo(t.params[0])}}return o.default.hash.getHashByteLength(u)<=o.default.hash.getHashByteLength(c)?c:u}async function d(e,t,r,n,a,s,o=!1,u=!1){if(!r.isDecrypted())throw new Error("Private key is not decrypted.");const c=new i.default.Signature(a);return Object.assign(c,n),c.publicKeyAlgorithm=r.algorithm,c.hashAlgorithm=await f(t,r,a,s),await c.sign(r,e,o,u),c}function l(e,t){let r;return!1===t.keyNeverExpires&&(r=e.created.getTime()+1e3*t.keyExpirationTime),r?new Date(r):1/0}},{"../config":79,"../crypto":94,"../enums":113,"../packet":131,"../util":158}],118:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.Key=r.createSignaturePacket=r.getPreferredHashAlgo=r.isAeadSupported=r.getPreferredAlgo=r.reformat=r.read=r.generate=r.readArmored=void 0;var n,i=e("./factory"),a=e("./helper"),s=e("./key.js"),o=(n=s)&&n.__esModule?n:{default:n};r.readArmored=i.readArmored,r.generate=i.generate,r.read=i.read,r.reformat=i.reformat,r.getPreferredAlgo=a.getPreferredAlgo,r.isAeadSupported=a.isAeadSupported,r.getPreferredHashAlgo=a.getPreferredHashAlgo,r.createSignaturePacket=a.createSignaturePacket,r.Key=o.default},{"./factory":116,"./helper":117,"./key.js":119}],119:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=d;var n=f(e("../encoding/armor")),i=f(e("../packet")),a=f(e("../enums")),s=f(e("../util")),o=f(e("./user")),u=f(e("./subkey")),c=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("./helper"));function f(e){return e&&e.__esModule?e:{default:e}}function d(e){if(!(this instanceof d))return new d(e);if(this.keyPacket=null,this.revocationSignatures=[],this.directSignatures=[],this.users=[],this.subKeys=[],this.packetlist2structure(e),!this.keyPacket||!this.users.length)throw new Error("Invalid key: need at least key and user ID packet")}Object.defineProperty(d.prototype,"primaryKey",{get(){return this.keyPacket},configurable:!0,enumerable:!0}),d.prototype.packetlist2structure=function(e){let t,r,n;for(let i=0;ie.concat(t.toPacketlist())),this.subKeys.map(t=>e.concat(t.toPacketlist())),e},d.prototype.getSubkeys=function(e=null){const t=[];return this.subKeys.forEach(r=>{e&&!r.getKeyId().equals(e,!0)||t.push(r)}),t},d.prototype.getKeys=function(e=null){const t=[];return e&&!this.getKeyId().equals(e,!0)||t.push(this),t.concat(this.getSubkeys(e))},d.prototype.getKeyIds=function(){return this.getKeys().map(e=>e.getKeyId())},d.prototype.getUserIds=function(){return this.users.map(e=>e.userId?e.userId.userid:null).filter(e=>null!==e)},d.prototype.isPublic=function(){return this.keyPacket.tag===a.default.packet.publicKey},d.prototype.isPrivate=function(){return this.keyPacket.tag===a.default.packet.secretKey},d.prototype.toPublic=function(){const e=new i.default.List,t=this.toPacketlist();let r,n,s;for(let o=0;ot.keyPacket.created-e.keyPacket.created);let o;for(let s=0;st.keyPacket.created-e.keyPacket.created);let o;for(let s=0;s!0===e)},d.prototype.validate=async function(){if(!this.isPrivate())throw new Error("Cannot validate a public key");let e;if(this.keyPacket.isDummy()){const t=await this.getSigningKey(null,null);t&&!t.keyPacket.isDummy()&&(e=t.keyPacket)}else e=this.primaryKey;if(e)return e.validate();{const e=this.getKeys();if(e.map(e=>e.keyPacket.isDummy()).every(Boolean))throw new Error("Cannot validate an all-gnu-dummy key");return Promise.all(e.map(async e=>e.keyPacket.validate()))}},d.prototype.clearPrivateParams=function(){if(!this.isPrivate())throw new Error("Can't clear private parameters of a public key");this.getKeys().forEach(({keyPacket:e})=>{e.isDecrypted()&&e.clearPrivateParams()})},d.prototype.isRevoked=async function(e,t,r=new Date){return c.isDataRevoked(this.keyPacket,a.default.signature.key_revocation,{key:this.keyPacket},this.revocationSignatures,e,t,r)},d.prototype.verifyPrimaryKey=async function(e=new Date,t={}){const r=this.keyPacket;if(await this.isRevoked(null,null,e))throw new Error("Primary key is revoked");if(!this.users.some(e=>e.userId&&e.selfCertifications.length))throw new Error("No self-certifications");const n=(await this.getPrimaryUser(e,t)).selfCertification;if(c.isDataExpired(r,n,e))throw new Error("Primary key is expired")},d.prototype.getExpirationTime=async function(e,t,r){const n=(await this.getPrimaryUser(null,r)).selfCertification,i=c.getExpirationTime(this.keyPacket,n),a=n.getExpirationTime();let s=i{})||await this.getEncryptionKey(t,null,r).catch(()=>{});if(!e)return null;const n=await e.getExpirationTime(this.keyPacket);n{})||await this.getSigningKey(t,null,r).catch(()=>{});if(!e)return null;const n=await e.getExpirationTime(this.keyPacket);ne.subKeys.some(e=>t.hasSameFingerprintAs(e)))))throw new Error("Cannot update public key with private key if subkey mismatch");this.keyPacket=e.keyPacket}await c.mergeSignatures(e,this,"revocationSignatures",t=>c.isDataRevoked(this.keyPacket,a.default.signature.key_revocation,this,[t],null,e.keyPacket)),await c.mergeSignatures(e,this,"directSignatures"),await Promise.all(e.users.map(async e=>{let t=!1;await Promise.all(this.users.map(async r=>{(e.userId&&r.userId&&e.userId.userid===r.userId.userid||e.userAttribute&&e.userAttribute.equals(r.userAttribute))&&(await r.update(e,this.keyPacket),t=!0)})),t||this.users.push(e)})),await Promise.all(e.subKeys.map(async e=>{let t=!1;await Promise.all(this.subKeys.map(async r=>{r.hasSameFingerprintAs(e)&&(await r.update(e,this.keyPacket),t=!0)})),t||this.subKeys.push(e)}))},d.prototype.revoke=async function({flag:e=a.default.reasonForRevocation.no_reason,string:t=""}={},r=new Date){if(this.isPublic())throw new Error("Need private key for revoking");const n={key:this.keyPacket},i=new d(this.toPacketlist());return i.revocationSignatures.push(await c.createSignaturePacket(n,null,this.keyPacket,{signatureType:a.default.signature.key_revocation,reasonForRevocationFlag:a.default.write(a.default.reasonForRevocation,e),reasonForRevocationString:t},r)),i},d.prototype.getRevocationCertificate=async function(e=new Date){const t={key:this.keyPacket},r=await c.getLatestValidSignature(this.revocationSignatures,this.keyPacket,a.default.signature.key_revocation,t,e),s=new i.default.List;return s.push(r),n.default.encode(a.default.armor.public_key,s.write(),null,null,"This is a revocation certificate")},d.prototype.applyRevocationCertificate=async function(e){const t=await n.default.decode(e),r=new i.default.List;await r.read(t.data);const o=r.findPacket(a.default.packet.signature);if(!o||o.signatureType!==a.default.signature.key_revocation)throw new Error("Could not find revocation signature packet");if(!o.issuerKeyId.equals(this.getKeyId()))throw new Error("Revocation signature does not match key");if(o.isExpired())throw new Error("Revocation signature is expired");try{await o.verify(this.keyPacket,a.default.signature.key_revocation,{key:this.keyPacket})}catch(c){throw s.default.wrapError("Could not verify revocation signature",c)}const u=new d(this.toPacketlist());return u.revocationSignatures.push(o),u},d.prototype.signPrimaryUser=async function(e,t,r){var n=await this.getPrimaryUser(t,r);const i=n.index,a=n.user,s=await a.sign(this.keyPacket,e),o=new d(this.toPacketlist());return o.users[i]=s,o},d.prototype.signAllUsers=async function(e){const t=this,r=new d(this.toPacketlist());return r.users=await Promise.all(this.users.map(function(r){return r.sign(t.keyPacket,e)})),r},d.prototype.verifyPrimaryUser=async function(e,t,r){const n=this.keyPacket;const i=(await this.getPrimaryUser(t,r)).user;return e?await i.verifyAllCertifications(n,e):[{keyid:n.keyid,valid:await i.verify(n).catch(()=>!1)}]},d.prototype.verifyAllUsers=async function(e){const t=[],r=this.keyPacket;return await Promise.all(this.users.map(async function(n){(e?await n.verifyAllCertifications(r,e):[{keyid:r.keyid,valid:await n.verify(r).catch(()=>!1)}]).forEach(e=>{t.push({userid:n.userId.userid,keyid:e.keyid,valid:e.valid})})})),t},d.prototype.addSubkey=async function(e={}){if(!this.isPrivate())throw new Error("Cannot add a subkey to a public key");if(e.passphrase)throw new Error("Subkey could not be encrypted here, please encrypt whole key");if(s.default.getWebCryptoAll()&&e.rsaBits<2048)throw new Error("When using webCrypto rsaBits should be 2048 or 4096, found: "+e.rsaBits);const t=this.primaryKey;if(!t.isDecrypted())throw new Error("Key is not decrypted");const r=t.getAlgorithmInfo();e=c.sanitizeKeyOptions(e,r);const n=await c.generateSecretSubkey(e),i=await c.createBindingSignature(n,t,e),a=this.toPacketlist();return a.push(n),a.push(i),new d(a)},["getKeyId","getFingerprint","getAlgorithmInfo","getCreationTime","isDecrypted","hasSameFingerprintAs"].forEach(e=>{d.prototype[e]=u.default.prototype[e]})},{"../encoding/armor":111,"../enums":113,"../packet":131,"../util":158,"./helper":117,"./subkey":120,"./user":121}],120:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=o;var n=s(e("../enums")),i=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("./helper")),a=s(e("../packet"));function s(e){return e&&e.__esModule?e:{default:e}}function o(e){if(!(this instanceof o))return new o(e);this.keyPacket=e,this.bindingSignatures=[],this.revocationSignatures=[]}o.prototype.toPacketlist=function(){const e=new a.default.List;return e.push(this.keyPacket),e.concat(this.revocationSignatures),e.concat(this.bindingSignatures),e},o.prototype.isRevoked=async function(e,t,r,a=new Date){return i.isDataRevoked(e,n.default.signature.subkey_revocation,{key:e,bind:this.keyPacket},this.revocationSignatures,t,r,a)},o.prototype.verify=async function(e,t=new Date){const r={key:e,bind:this.keyPacket},a=await i.getLatestValidSignature(this.bindingSignatures,e,n.default.signature.subkey_binding,r,t);if(a.revoked||await this.isRevoked(e,a,null,t))throw new Error("Subkey is revoked");if(i.isDataExpired(this.keyPacket,a,t))throw new Error("Subkey is expired")},o.prototype.getExpirationTime=async function(e,t=new Date){const r={key:e,bind:this.keyPacket};let a;try{a=await i.getLatestValidSignature(this.bindingSignatures,e,n.default.signature.subkey_binding,r,t)}catch(u){return null}const s=i.getExpirationTime(this.keyPacket,a),o=a.getExpirationTime();return sr.bindingSignatures[t].created&&(r.bindingSignatures[t]=e),!1;try{return e.verified||await e.verify(t,n.default.signature.subkey_binding,a)}catch(i){return!1}}),await i.mergeSignatures(e,this,"revocationSignatures",function(e){return i.isDataRevoked(t,n.default.signature.subkey_revocation,a,[e])})},o.prototype.revoke=async function(e,{flag:t=n.default.reasonForRevocation.no_reason,string:r=""}={},a=new Date){const s={key:e,bind:this.keyPacket},u=new o(this.keyPacket);return u.revocationSignatures.push(await i.createSignaturePacket(s,null,e,{signatureType:n.default.signature.subkey_revocation,reasonForRevocationFlag:n.default.write(n.default.reasonForRevocation,t),reasonForRevocationString:r},a)),await u.update(this,e),u},["getKeyId","getFingerprint","getAlgorithmInfo","getCreationTime","isDecrypted"].forEach(e=>{o.prototype[e]=function(){return this.keyPacket[e]()}}),o.prototype.hasSameFingerprintAs=function(e){return this.keyPacket.hasSameFingerprintAs(e.keyPacket||e)}},{"../enums":113,"../packet":131,"./helper":117}],121:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=u;var n=o(e("../enums")),i=o(e("../util")),a=o(e("../packet")),s=e("./helper");function o(e){return e&&e.__esModule?e:{default:e}}function u(e){if(!(this instanceof u))return new u(e);this.userId=e.tag===n.default.packet.userid?e:null,this.userAttribute=e.tag===n.default.packet.userAttribute?e:null,this.selfCertifications=[],this.otherCertifications=[],this.revocationSignatures=[]}u.prototype.toPacketlist=function(){const e=new a.default.List;return e.push(this.userId||this.userAttribute),e.concat(this.revocationSignatures),e.concat(this.selfCertifications),e.concat(this.otherCertifications),e},u.prototype.sign=async function(e,t){const r={userId:this.userId,userAttribute:this.userAttribute,key:e},i=new u(r.userId||r.userAttribute);return i.otherCertifications=await Promise.all(t.map(async function(t){if(t.isPublic())throw new Error("Need private key for signing");if(t.hasSameFingerprintAs(e))throw new Error("Not implemented for self signing");const i=await t.getSigningKey();return(0,s.createSignaturePacket)(r,t,i.keyPacket,{signatureType:n.default.signature.cert_generic,keyFlags:[n.default.keyFlags.certify_keys|n.default.keyFlags.sign_data]})})),await i.update(this,e),i},u.prototype.isRevoked=async function(e,t,r,i=new Date){return(0,s.isDataRevoked)(e,n.default.signature.cert_revocation,{key:e,userId:this.userId,userAttribute:this.userAttribute},this.revocationSignatures,t,r,i)},u.prototype.verifyCertificate=async function(e,t,r,a=new Date){const s=this,o=t.issuerKeyId,u={userId:this.userId,userAttribute:this.userAttribute,key:e};return(await Promise.all(r.map(async function(r){if(!r.getKeyIds().some(e=>e.equals(o)))return null;const c=await r.getSigningKey(o,a);if(t.revoked||await s.isRevoked(e,t,c.keyPacket,a))throw new Error("User certificate is revoked");try{t.verified||await t.verify(c.keyPacket,n.default.signature.cert_generic,u)}catch(f){throw i.default.wrapError("User certificate is invalid",f)}if(t.isExpired(a))throw new Error("User certificate is expired");return!0}))).find(e=>null!==e)||null},u.prototype.verifyAllCertifications=async function(e,t,r=new Date){const n=this,i=this.selfCertifications.concat(this.otherCertifications);return Promise.all(i.map(async function(i){return{keyid:i.issuerKeyId,valid:await n.verifyCertificate(e,i,t,r).catch(()=>!1)}}))},u.prototype.verify=async function(e,t=new Date){if(!this.selfCertifications.length)throw new Error("No self-certifications");const r=this,a={userId:this.userId,userAttribute:this.userAttribute,key:e};let s;for(let u=this.selfCertifications.length-1;u>=0;u--)try{const c=this.selfCertifications[u];if(c.revoked||await r.isRevoked(e,c,void 0,t))throw new Error("Self-certification is revoked");try{c.verified||await c.verify(e,n.default.signature.cert_generic,a)}catch(o){throw i.default.wrapError("Self-certification is invalid",o)}if(c.isExpired(t))throw new Error("Self-certification is expired");return!0}catch(o){s=o}throw s},u.prototype.update=async function(e,t){const r={userId:this.userId,userAttribute:this.userAttribute,key:t};await(0,s.mergeSignatures)(e,this,"selfCertifications",async function(e){try{return e.verified||e.verify(t,n.default.signature.cert_generic,r)}catch(i){return!1}}),await(0,s.mergeSignatures)(e,this,"otherCertifications"),await(0,s.mergeSignatures)(e,this,"revocationSignatures",function(e){return(0,s.isDataRevoked)(t,n.default.signature.cert_revocation,r,[e])})}},{"../enums":113,"../packet":131,"../util":158,"./helper":117}],122:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=a(e("./keyring.js")),i=a(e("./localstore.js"));function a(e){return e&&e.__esModule?e:{default:e}}n.default.localstore=i.default,r.default=n.default},{"./keyring.js":123,"./localstore.js":124}],123:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n,i=e("../key"),a=e("./localstore"),s=(n=a)&&n.__esModule?n:{default:n};function o(e){this.storeHandler=e||new s.default}function u(e){this.keys=e}function c(e,t){const r=(e=e.toLowerCase()).replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),n=new RegExp("<"+r+">"),i=t.getUserIds();for(let a=0;an.default.readToEnd(e.armor())));e.setItem(t,JSON.stringify(i))}else e.removeItem(t)}u.prototype.publicKeysItem="public-keys",u.prototype.privateKeysItem="private-keys",u.prototype.loadPublic=async function(){return c(this.storage,this.publicKeysItem)},u.prototype.loadPrivate=async function(){return c(this.storage,this.privateKeysItem)},u.prototype.storePublic=async function(e){await f(this.storage,this.publicKeysItem,e)},u.prototype.storePrivate=async function(e){await f(this.storage,this.privateKeysItem,e)},r.default=u}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../config":79,"../key":118,"../util":158,"node-localstorage":"node-localstorage","web-stream-tools":75}],125:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.loadScript=(e=>"undefined"!=typeof importScripts?importScripts(e):new Promise((t,r)=>{const n=document.createElement("script");n.src=e,n.onload=(()=>t()),n.onerror=(e=>r(new Error(e.message))),document.head.appendChild(n)})),r.dl=async function(e,t){return(await fetch(e,t)).arrayBuffer()}},{}],126:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.Message=p,r.encryptSessionKey=y,r.createSignaturePackets=b,r.createVerificationObjects=m,r.readArmored=async function(e){const t=c.default.isStream(e);"node"===t&&(e=n.default.nodeToWeb(e));return g((await i.default.decode(e)).data,t)},r.read=g,r.fromText=function(e,t,r=new Date,i="utf8"){const a=c.default.isStream(e);"node"===a&&(e=n.default.nodeToWeb(e));const s=new f.default.Literal(r);s.setText(e,i),void 0!==t&&s.setFilename(t);const o=new f.default.List;o.push(s);const u=new p(o);return u.fromStream=a,u},r.fromBinary=function(e,t,r=new Date,i="binary"){const a=c.default.isStream(e);if(!c.default.isUint8Array(e)&&!a)throw new Error("Data must be in the form of a Uint8Array or Stream");"node"===a&&(e=n.default.nodeToWeb(e));const s=new f.default.Literal(r);s.setBytes(e,i),void 0!==t&&s.setFilename(t);const o=new f.default.List;o.push(s);const u=new p(o);return u.fromStream=a,u};var n=h(e("web-stream-tools")),i=h(e("./encoding/armor")),a=h(e("./type/keyid")),s=h(e("./config")),o=h(e("./crypto")),u=h(e("./enums")),c=h(e("./util")),f=h(e("./packet")),d=e("./signature"),l=e("./key");function h(e){return e&&e.__esModule?e:{default:e}}function p(e){if(!(this instanceof p))return new p(e);this.packets=e||new f.default.List}async function y(e,t,r,n,i,o=!1,u=new Date,c=[]){const d=new f.default.List;if(n){const r=await Promise.all(n.map(async function(r){const n=await r.getEncryptionKey(void 0,u,c),i=new f.default.PublicKeyEncryptedSessionKey;return i.publicKeyId=o?a.default.wildcard():n.getKeyId(),i.publicKeyAlgorithm=n.keyPacket.algorithm,i.sessionKey=e,i.sessionKeyAlgorithm=t,await i.encrypt(n.keyPacket),delete i.sessionKey,i}));d.concat(r)}if(i){const n=async function(e,t){try{return await e.decrypt(t),1}catch(r){return 0}},a=(e,t)=>e+t,o=async function e(t,r,o,u){const c=new f.default.SymEncryptedSessionKey;if(c.sessionKey=t,c.sessionKeyAlgorithm=r,o&&(c.aeadAlgorithm=o),await c.encrypt(u),s.default.password_collision_check){if(1!==(await Promise.all(i.map(e=>n(c,e)))).reduce(a))return e(t,r,u)}return delete c.sessionKey,c},u=await Promise.all(i.map(n=>o(e,t,r,n)));d.concat(u)}return new p(d)}async function b(e,t,r=null,n=new Date,i=[],a=!1,s=!1){const o=new f.default.List,c=null===e.text?u.default.signature.binary:u.default.signature.text;if(await Promise.all(t.map(async(t,r)=>{const o=i[r];if(t.isPublic())throw new Error("Need private key for signing");const u=await t.getSigningKey(void 0,n,o);return(0,l.createSignaturePacket)(e,t,u.keyPacket,{signatureType:c},n,o,a,s)})).then(e=>{e.forEach(e=>o.push(e))}),r){const e=r.packets.filterByTag(u.default.packet.signature);o.concat(e)}return o}async function m(e,t,r,n=new Date,i=!1,a=!1){return Promise.all(e.filter(function(e){return["text","binary"].includes(u.default.read(u.default.signature,e.signatureType))}).map(async function(e){return async function(e,t,r,n=new Date,i=!1,a=!1){let s=null,o=null;await Promise.all(r.map(async function(t){try{o=await t.getSigningKey(e.issuerKeyId,null),s=t}catch(r){}}));const u=e.correspondingSig||e,c={keyid:e.issuerKeyId,verified:(async()=>{if(!o)return null;const r=await e.verify(o.keyPacket,e.signatureType,t[0],i,a),c=await u;if(c.isExpired(n)||!(c.created>=o.getCreationTime()&&c.created{const e=await u,t=new f.default.List;return t.push(e),new d.Signature(t)})()};return c.signature.catch(()=>{}),c.verified.catch(()=>{}),c}(e,t,r,n,i,a)}))}async function g(e,t=c.default.isStream(e)){"node"===c.default.isStream(e)&&(e=n.default.nodeToWeb(e));const r=new f.default.List;await r.read(e,t);const i=new p(r);return i.fromStream=t,i}p.prototype.getEncryptionKeyIds=function(){const e=[];return this.packets.filterByTag(u.default.packet.publicKeyEncryptedSessionKey).forEach(function(t){e.push(t.publicKeyId)}),e},p.prototype.getSigningKeyIds=function(){const e=[],t=this.unwrapCompressed();if(t.packets.filterByTag(u.default.packet.onePassSignature).forEach(function(t){e.push(t.issuerKeyId)}),!e.length){t.packets.filterByTag(u.default.packet.signature).forEach(function(t){e.push(t.issuerKeyId)})}return e},p.prototype.decrypt=async function(e,t,r,i){const a=r||await this.decryptSessionKeys(e,t),s=this.packets.filterByTag(u.default.packet.symmetricallyEncrypted,u.default.packet.symEncryptedIntegrityProtected,u.default.packet.symEncryptedAEADProtected);if(0===s.length)return this;const o=s[0];let d=null;const l=Promise.all(a.map(async e=>{if(!e||!c.default.isUint8Array(e.data)||!c.default.isString(e.algorithm))throw new Error("Invalid session key for decryption.");try{await o.decrypt(e.algorithm,e.data,i)}catch(t){c.default.print_debug_error(t),d=t}}));if(n.default.cancel(o.encrypted),o.encrypted=null,await l,!o.packets||!o.packets.length)throw d||new Error("Decryption failed.");const h=new p(o.packets);return o.packets=new f.default.List,h},p.prototype.decryptSessionKeys=async function(e,t){let r,i=[];if(t){const e=this.packets.filterByTag(u.default.packet.symEncryptedSessionKey);if(!e)throw new Error("No symmetrically encrypted session key packet found.");await Promise.all(t.map(async function(t,r){let n;r?(n=new f.default.List,await n.read(e.write())):n=e,await Promise.all(n.map(async function(e){try{await e.decrypt(t),i.push(e)}catch(r){c.default.print_debug_error(r)}}))}))}else{if(!e)throw new Error("No key or password specified.");{const t=this.packets.filterByTag(u.default.packet.publicKeyEncryptedSessionKey);if(!t)throw new Error("No public key encrypted session key packet found.");await Promise.all(t.map(async function(t){await Promise.all(e.map(async function(e){let n=[u.default.symmetric.aes256,u.default.symmetric.aes128,u.default.symmetric.tripledes,u.default.symmetric.cast5];try{const t=await e.getPrimaryUser();t.selfCertification.preferredSymmetricAlgorithms&&(n=n.concat(t.selfCertification.preferredSymmetricAlgorithms))}catch(s){}const a=(await e.getDecryptionKeys(t.publicKeyId,null)).map(e=>e.keyPacket);await Promise.all(a.map(async function(e){if(e){if(!e.isDecrypted())throw new Error("Private key is not decrypted.");try{if(await t.decrypt(e),!n.includes(u.default.write(u.default.symmetric,t.sessionKeyAlgorithm)))throw new Error("A non-preferred symmetric algorithm was used.");i.push(t)}catch(a){c.default.print_debug_error(a),r=a}}}))})),n.default.cancel(t.encrypted),t.encrypted=null}))}}if(i.length){if(i.length>1){const e={};i=i.filter(function(t){const r=t.sessionKeyAlgorithm+c.default.Uint8Array_to_str(t.sessionKey);return!e.hasOwnProperty(r)&&(e[r]=!0,!0)})}return i.map(e=>({data:e.sessionKey,algorithm:e.sessionKeyAlgorithm}))}throw r||new Error("Session key decryption failed.")},p.prototype.getLiteralData=function(){const e=this.unwrapCompressed().packets.findPacket(u.default.packet.literal);return e&&e.getBytes()||null},p.prototype.getFilename=function(){const e=this.unwrapCompressed().packets.findPacket(u.default.packet.literal);return e&&e.getFilename()||null},p.prototype.getText=function(){const e=this.unwrapCompressed().packets.findPacket(u.default.packet.literal);return e?e.getText():null},p.prototype.encrypt=async function(e,t,r,n=!1,i=new Date,a=[],d){let h,p,b;if(r){if(!c.default.isUint8Array(r.data)||!c.default.isString(r.algorithm))throw new Error("Invalid session key for encryption.");h=r.algorithm,p=r.aeadAlgorithm,r=r.data}else if(e&&e.length)h=u.default.read(u.default.symmetric,await(0,l.getPreferredAlgo)("symmetric",e,i,a)),s.default.aead_protect&&await(0,l.isAeadSupported)(e,i,a)&&(p=u.default.read(u.default.aead,await(0,l.getPreferredAlgo)("aead",e,i,a)));else{if(!t||!t.length)throw new Error("No keys, passwords, or session key provided.");h=u.default.read(u.default.symmetric,s.default.encryption_cipher),p=u.default.read(u.default.aead,s.default.aead_mode)}r||(r=await o.default.generateSessionKey(h));const m=await y(r,h,p,e,t,n,i,a);return s.default.aead_protect&&p?(b=new f.default.SymEncryptedAEADProtected).aeadAlgorithm=p:b=s.default.integrity_protect?new f.default.SymEncryptedIntegrityProtected:new f.default.SymmetricallyEncrypted,b.packets=this.packets,await b.encrypt(h,r,d),m.packets.push(b),b.packets=new f.default.List,{message:m,sessionKey:{data:r,algorithm:h,aeadAlgorithm:p}}},p.prototype.sign=async function(e=[],t=null,r=new Date,n=[],i=!1){const a=new f.default.List,s=this.packets.findPacket(u.default.packet.literal);if(!s)throw new Error("No literal data packet to sign.");let o,c;const d=null===s.text?u.default.signature.binary:u.default.signature.text;if(t)for(o=(c=t.packets.filterByTag(u.default.packet.signature)).length-1;o>=0;o--){const t=c[o],r=new f.default.OnePassSignature;r.signatureType=t.signatureType,r.hashAlgorithm=t.hashAlgorithm,r.publicKeyAlgorithm=t.publicKeyAlgorithm,r.issuerKeyId=t.issuerKeyId,e.length||0!==o||(r.flags=1),a.push(r)}return await Promise.all(Array.from(e).reverse().map(async function(t,i){if(t.isPublic())throw new Error("Need private key for signing");const a=await t.getSigningKey(void 0,r,n),s=new f.default.OnePassSignature;return s.signatureType=d,s.hashAlgorithm=await(0,l.getPreferredHashAlgo)(t,a.keyPacket,r,n),s.publicKeyAlgorithm=a.keyPacket.algorithm,s.issuerKeyId=a.getKeyId(),i===e.length-1&&(s.flags=1),s})).then(e=>{e.forEach(e=>a.push(e))}),a.push(s),a.concat(await b(s,e,t,r,n,!1,i)),new p(a)},p.prototype.compress=function(e){if(e===u.default.compression.uncompressed)return this;const t=new f.default.Compressed;t.packets=this.packets,t.algorithm=u.default.read(u.default.compression,e);const r=new f.default.List;return r.push(t),new p(r)},p.prototype.signDetached=async function(e=[],t=null,r=new Date,n=[],i=!1){const a=this.packets.findPacket(u.default.packet.literal);if(!a)throw new Error("No literal data packet to sign.");return new d.Signature(await b(a,e,t,r,n,!0,i))},p.prototype.verify=async function(e,t=new Date,r){const i=this.unwrapCompressed(),a=i.packets.filterByTag(u.default.packet.literal);if(1!==a.length)throw new Error("Can only verify message with one literal data packet.");r||i.packets.concat(await n.default.readToEnd(i.packets.stream,e=>e));const s=i.packets.filterByTag(u.default.packet.onePassSignature).reverse(),o=i.packets.filterByTag(u.default.packet.signature);return r&&s.length&&!o.length&&i.packets.stream?(await Promise.all(s.map(async e=>{e.correspondingSig=new Promise((t,r)=>{e.correspondingSigResolve=t,e.correspondingSigReject=r}),e.signatureData=n.default.fromAsync(async()=>(await e.correspondingSig).signatureData),e.hashed=n.default.readToEnd(await e.hash(e.signatureType,a[0],void 0,!1,r)),e.hashed.catch(()=>{})})),i.packets.stream=n.default.transformPair(i.packets.stream,async(e,t)=>{const r=n.default.getReader(e),i=n.default.getWriter(t);try{for(let e=0;e{e.correspondingSigReject(a)}),await i.abort(a)}}),m(s,a,e,t,!1,r)):m(o,a,e,t,!1,r)},p.prototype.verifyDetached=function(e,t,r=new Date){const n=this.unwrapCompressed().packets.filterByTag(u.default.packet.literal);if(1!==n.length)throw new Error("Can only verify message with one literal data packet.");return m(e.packets,n,t,r,!0)},p.prototype.unwrapCompressed=function(){const e=this.packets.filterByTag(u.default.packet.compressed);return e.length?new p(e[0].packets):this},p.prototype.appendSignature=async function(e){await this.packets.read(c.default.isUint8Array(e)?e:(await i.default.decode(e)).data)},p.prototype.armor=function(){return i.default.encode(u.default.armor.message,this.packets.write())}},{"./config":79,"./crypto":94,"./encoding/armor":111,"./enums":113,"./key":118,"./packet":131,"./signature":151,"./type/keyid":154,"./util":158,"web-stream-tools":75}],127:[function(e,t,r){(function(t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.initWorker=async function({path:e="openpgp.worker.min.js",n:r=1,workers:n=[]}={}){if(n.length||void 0!==t&&t.Worker&&t.MessageChannel){const t=new f.default({path:e,n:r,workers:n,config:o.default}),i=await t.loaded();if(i)return l=t,!0}return!1},r.getWorker=function(){return l},r.destroyWorker=async function(){const e=l;l=void 0,e&&(await e.clearKeyCache(),e.terminate())},r.generateKey=function({userIds:e=[],passphrase:t="",numBits:r=2048,rsaBits:n=r,keyExpirationTime:i=0,curve:a="",date:o=new Date,subkeys:u=[{}]}){const f={userIds:e=y(e),passphrase:t,rsaBits:n,keyExpirationTime:i,curve:a,date:o,subkeys:u};if(c.default.getWebCryptoAll()&&n<2048)throw new Error("rsaBits should be 2048 or 4096, found: "+n);if(!c.default.getWebCryptoAll()&&l)return l.delegate("generateKey",f);return(0,s.generate)(f).then(async e=>{const t=await e.getRevocationCertificate(o);return e.revocationSignatures=[],m({key:e,privateKeyArmored:e.armor(),publicKeyArmored:e.toPublic().armor(),revocationCertificate:t})}).catch(_.bind(null,"Error generating keypair"))},r.reformatKey=function({privateKey:e,userIds:t=[],passphrase:r="",keyExpirationTime:n=0,date:i}){t=y(t);const a={privateKey:e,userIds:t,passphrase:r,keyExpirationTime:n,date:i};if(l)return l.delegate("reformatKey",a);return(0,s.reformat)(a).then(async e=>{const t=await e.getRevocationCertificate(i);return e.revocationSignatures=[],m({key:e,privateKeyArmored:e.armor(),publicKeyArmored:e.toPublic().armor(),revocationCertificate:t})}).catch(_.bind(null,"Error reformatting keypair"))},r.revokeKey=function({key:e,revocationCertificate:t,reasonForRevocation:r}={}){const n={key:e,revocationCertificate:t,reasonForRevocation:r};if(!c.default.getWebCryptoAll()&&l)return l.delegate("revokeKey",n);return Promise.resolve().then(()=>t?e.applyRevocationCertificate(t):e.revoke(r)).then(async e=>{if(await m(e),e.isPrivate()){const t=e.toPublic();return{privateKey:e,privateKeyArmored:e.armor(),publicKey:t,publicKeyArmored:t.armor()}}return{publicKey:e,publicKeyArmored:e.armor()}}).catch(_.bind(null,"Error revoking key"))},r.decryptKey=function({privateKey:e,passphrase:t}){if(l)return l.delegate("decryptKey",{privateKey:e,passphrase:t});return Promise.resolve().then(async function(){return await e.decrypt(t),{key:e}}).catch(_.bind(null,"Error decrypting private key"))},r.encryptKey=function({privateKey:e,passphrase:t}){if(l)return l.delegate("encryptKey",{privateKey:e,passphrase:t});return Promise.resolve().then(async function(){return await e.encrypt(t),{key:e}}).catch(_.bind(null,"Error decrypting private key"))},r.encrypt=function({message:e,publicKeys:t,privateKeys:r,passwords:n,sessionKey:i,compression:a=o.default.compression,armor:s=!0,streaming:u=e&&e.fromStream,detached:c=!1,signature:f=null,returnSessionKey:d=!1,wildcard:p=!1,date:b=new Date,fromUserIds:g=[],toUserIds:w=[]}){if(h(e),t=y(t),r=y(r),n=y(n),g=y(g),w=y(w),!v()&&l)return l.delegate("encrypt",{message:e,publicKeys:t,privateKeys:r,passwords:n,sessionKey:i,compression:a,armor:s,streaming:u,detached:c,signature:f,returnSessionKey:d,wildcard:p,date:b,fromUserIds:g,toUserIds:w});const k={};return Promise.resolve().then(async function(){if(r||(r=[]),r.length||f)if(c){const t=await e.signDetached(r,f,b,g,e.fromStream);k.signature=s?t.armor():t}else e=await e.sign(r,f,b,g,e.fromStream);return(e=e.compress(a)).encrypt(t,n,i,p,b,w,u)}).then(async e=>(s?k.data=e.message.armor():k.message=e.message,d&&(k.sessionKey=e.sessionKey),m(k,u,s?["signature","data"]:[]))).catch(_.bind(null,"Error encrypting message"))},r.decrypt=function({message:e,privateKeys:t,passwords:r,sessionKeys:n,publicKeys:i,format:a="utf8",streaming:s=e&&e.fromStream,signature:o=null,date:u=new Date}){if(h(e),i=y(i),t=y(t),r=y(r),n=y(n),!v()&&l)return l.delegate("decrypt",{message:e,privateKeys:t,passwords:r,sessionKeys:n,publicKeys:i,format:a,streaming:s,signature:o,date:u});return e.decrypt(t,r,n,s).then(async function(t){i||(i=[]);const r={};return r.signatures=o?await t.verifyDetached(o,i,u,s):await t.verify(i,u,s),r.data="binary"===a?t.getLiteralData():t.getText(),r.filename=t.getFilename(),s&&g(r,e),r.data=await b(r.data,s),s||await w(r.signatures),r}).catch(_.bind(null,"Error decrypting message"))},r.sign=function({message:e,privateKeys:t,armor:r=!0,streaming:i=e&&e.fromStream,detached:a=!1,date:s=new Date,fromUserIds:o=[]}){if(p(e),t=y(t),o=y(o),l)return l.delegate("sign",{message:e,privateKeys:t,armor:r,streaming:i,detached:a,date:s,fromUserIds:o});const u={};return Promise.resolve().then(async function(){if(a){const i=await e.signDetached(t,void 0,s,o,e.fromStream);u.signature=r?i.armor():i,e.packets&&(u.signature=n.default.transformPair(e.packets.write(),async(e,t)=>{await Promise.all([n.default.pipe(u.signature,t),n.default.readToEnd(e).catch(()=>{})])}))}else e=await e.sign(t,void 0,s,o,e.fromStream),r?u.data=e.armor():u.message=e;return m(u,i,r?["signature","data"]:[])}).catch(_.bind(null,"Error signing cleartext message"))},r.verify=function({message:e,publicKeys:t,streaming:r=e&&e.fromStream,signature:n=null,date:i=new Date}){if(p(e),t=y(t),l)return l.delegate("verify",{message:e,publicKeys:t,streaming:r,signature:n,date:i});return Promise.resolve().then(async function(){const s={};return s.signatures=n?await e.verifyDetached(n,t,i,r):await e.verify(t,i,r),s.data=e instanceof a.CleartextMessage?e.getText():e.getLiteralData(),r&&g(s,e),s.data=await b(s.data,r),r||await w(s.signatures),s}).catch(_.bind(null,"Error verifying cleartext signed message"))},r.encryptSessionKey=function({data:e,algorithm:t,aeadAlgorithm:r,publicKeys:n,passwords:a,wildcard:s=!1,date:o=new Date,toUserIds:u=[]}){if(function(e,t){if(!c.default.isUint8Array(e))throw new Error("Parameter ["+(t||"data")+"] must be of type Uint8Array")}(e),function(e,t){if(!c.default.isString(e))throw new Error("Parameter ["+(t||"data")+"] must be of type String")}(t,"algorithm"),n=y(n),a=y(a),u=y(u),l)return l.delegate("encryptSessionKey",{data:e,algorithm:t,aeadAlgorithm:r,publicKeys:n,passwords:a,wildcard:s,date:o,toUserIds:u});return Promise.resolve().then(async function(){return{message:await i.encryptSessionKey(e,t,r,n,a,s,o,u)}}).catch(_.bind(null,"Error encrypting session key"))},r.decryptSessionKeys=function({message:e,privateKeys:t,passwords:r}){if(h(e),t=y(t),r=y(r),l)return l.delegate("decryptSessionKeys",{message:e,privateKeys:t,passwords:r});return Promise.resolve().then(async function(){return e.decryptSessionKeys(t,r)}).catch(_.bind(null,"Error decrypting session keys"))};var n=d(e("web-stream-tools")),i=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("./message")),a=e("./cleartext"),s=e("./key"),o=d(e("./config/config")),u=d(e("./enums"));e("./polyfills");var c=d(e("./util")),f=d(e("./worker/async_proxy"));function d(e){return e&&e.__esModule?e:{default:e}}let l;function h(e){if(!(e instanceof i.Message))throw new Error("Parameter [message] needs to be of type Message")}function p(e){if(!(e instanceof a.CleartextMessage||e instanceof i.Message))throw new Error("Parameter [message] needs to be of type Message or CleartextMessage")}function y(e){return e&&!c.default.isArray(e)&&(e=[e]),e}async function b(e,t){return!t&&c.default.isStream(e)?n.default.readToEnd(e):(t&&!c.default.isStream(e)&&(e=new ReadableStream({start(t){t.enqueue(e),t.close()}})),"node"===t&&(e=n.default.webToNode(e)),e)}async function m(e,t,r=[]){return Object.prototype.isPrototypeOf(e)&&!Uint8Array.prototype.isPrototypeOf(e)&&await Promise.all(Object.entries(e).map(async([n,i])=>{c.default.isStream(i)||r.includes(n)?e[n]=await b(i,t):await m(e[n],t)})),e}function g(e,t){e.data=n.default.transformPair(t.packets.stream,async(t,r)=>{await n.default.pipe(e.data,r)})}async function w(e){await Promise.all(e.map(async e=>{e.signature=await e.signature;try{e.valid=await e.verified}catch(t){e.valid=!1,e.error=t,c.default.print_debug_error(t)}}))}function _(e,t){c.default.print_debug_error(t);try{t.message=e+": "+t.message}catch(r){}throw t}function v(){return o.default.aead_protect&&(o.default.aead_mode===u.default.aead.eax||o.default.aead_mode===u.default.aead.experimental_gcm)&&c.default.getWebCrypto()}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./cleartext":77,"./config/config":78,"./enums":113,"./key":118,"./message":126,"./polyfills":150,"./util":158,"./worker/async_proxy":160,"web-stream-tools":75}],128:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.Trust=r.Signature=r.SecretSubkey=r.Userid=r.SecretKey=r.OnePassSignature=r.UserAttribute=r.PublicSubkey=r.Marker=r.SymmetricallyEncrypted=r.PublicKey=r.Literal=r.SymEncryptedSessionKey=r.PublicKeyEncryptedSessionKey=r.SymEncryptedAEADProtected=r.SymEncryptedIntegrityProtected=r.Compressed=void 0;var n=e("./compressed.js");Object.defineProperty(r,"Compressed",{enumerable:!0,get:function(){return k(n).default}});var i=e("./sym_encrypted_integrity_protected.js");Object.defineProperty(r,"SymEncryptedIntegrityProtected",{enumerable:!0,get:function(){return k(i).default}});var a=e("./sym_encrypted_aead_protected.js");Object.defineProperty(r,"SymEncryptedAEADProtected",{enumerable:!0,get:function(){return k(a).default}});var s=e("./public_key_encrypted_session_key.js");Object.defineProperty(r,"PublicKeyEncryptedSessionKey",{enumerable:!0,get:function(){return k(s).default}});var o=e("./sym_encrypted_session_key.js");Object.defineProperty(r,"SymEncryptedSessionKey",{enumerable:!0,get:function(){return k(o).default}});var u=e("./literal.js");Object.defineProperty(r,"Literal",{enumerable:!0,get:function(){return k(u).default}});var c=e("./public_key.js");Object.defineProperty(r,"PublicKey",{enumerable:!0,get:function(){return k(c).default}});var f=e("./symmetrically_encrypted.js");Object.defineProperty(r,"SymmetricallyEncrypted",{enumerable:!0,get:function(){return k(f).default}});var d=e("./marker.js");Object.defineProperty(r,"Marker",{enumerable:!0,get:function(){return k(d).default}});var l=e("./public_subkey.js");Object.defineProperty(r,"PublicSubkey",{enumerable:!0,get:function(){return k(l).default}});var h=e("./user_attribute.js");Object.defineProperty(r,"UserAttribute",{enumerable:!0,get:function(){return k(h).default}});var p=e("./one_pass_signature.js");Object.defineProperty(r,"OnePassSignature",{enumerable:!0,get:function(){return k(p).default}});var y=e("./secret_key.js");Object.defineProperty(r,"SecretKey",{enumerable:!0,get:function(){return k(y).default}});var b=e("./userid.js");Object.defineProperty(r,"Userid",{enumerable:!0,get:function(){return k(b).default}});var m=e("./secret_subkey.js");Object.defineProperty(r,"SecretSubkey",{enumerable:!0,get:function(){return k(m).default}});var g=e("./signature.js");Object.defineProperty(r,"Signature",{enumerable:!0,get:function(){return k(g).default}});var w=e("./trust.js");Object.defineProperty(r,"Trust",{enumerable:!0,get:function(){return k(w).default}}),r.newPacketFromTag=A,r.fromStructuredClone=function(e){const t=A(_.default.read(_.default.packet,e.tag));Object.assign(t,e),t.postCloneTypeFix&&t.postCloneTypeFix();return t};var _=k(e("../enums.js")),v=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("./all_packets.js"));function k(e){return e&&e.__esModule?e:{default:e}}function A(e){return new(v[function(e){return e.substr(0,1).toUpperCase()+e.substr(1)}(e)])}},{"../enums.js":113,"./all_packets.js":128,"./compressed.js":130,"./literal.js":132,"./marker.js":133,"./one_pass_signature.js":134,"./public_key.js":137,"./public_key_encrypted_session_key.js":138,"./public_subkey.js":139,"./secret_key.js":140,"./secret_subkey.js":141,"./signature.js":142,"./sym_encrypted_aead_protected.js":143,"./sym_encrypted_integrity_protected.js":144,"./sym_encrypted_session_key.js":145,"./symmetrically_encrypted.js":146,"./trust.js":147,"./user_attribute.js":148,"./userid.js":149}],129:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.clonePackets=function(e){e.publicKeys&&(e.publicKeys=e.publicKeys.map(e=>e.toPacketlist()));e.privateKeys&&(e.privateKeys=e.privateKeys.map(e=>e.toPacketlist()));e.publicKey&&(e.publicKey=e.publicKey.toPacketlist());e.privateKey&&(e.privateKey=e.privateKey.toPacketlist());e.key&&(e.key=e.key.toPacketlist());e.message&&(e.message instanceof a.Message?e.message={packets:e.message.packets,fromStream:e.message.fromStream}:e.message instanceof s.CleartextMessage&&(e.message={text:e.message.text,signature:e.message.signature.packets}));e.signature&&e.signature instanceof o.Signature&&(e.signature=e.signature.packets);e.signatures&&e.signatures.forEach(l);return e},r.parseClonedPackets=function(e){e.publicKeys&&(e.publicKeys=e.publicKeys.map(h));e.privateKeys&&(e.privateKeys=e.privateKeys.map(h));e.publicKey&&(e.publicKey=h(e.publicKey));e.privateKey&&(e.privateKey=h(e.privateKey));e.key&&(e.key=h(e.key));e.message&&e.message.signature?e.message=function(e){const t=u.default.fromStructuredClone(e.signature);return new s.CleartextMessage(e.text,new o.Signature(t))}(e.message):e.message&&(e.message=function(e){const t=u.default.fromStructuredClone(e.packets),r=new a.Message(t);return r.fromStream=e.fromStream,r}(e.message));e.signatures&&(e.signatures=e.signatures.map(p));e.signature&&(e.signature=function(e){if(f.default.isString(e)||f.default.isStream(e))return e;const t=u.default.fromStructuredClone(e);return new o.Signature(t)}(e.signature));return e};var n=d(e("web-stream-tools")),i=e("../key"),a=e("../message"),s=e("../cleartext"),o=e("../signature"),u=d(e("./packetlist")),c=d(e("../type/keyid")),f=d(e("../util"));function d(e){return e&&e.__esModule?e:{default:e}}function l(e){const t=e.verified;if(e.verified=n.default.fromAsync(()=>t),e.signature instanceof Promise){const r=e.signature;e.signature=n.default.fromAsync(async()=>{const e=(await r).packets;try{await t}catch(n){}return e&&e[0]&&(delete e[0].signature,delete e[0].hashed),e})}else e.signature=e.signature.packets;return e.error&&(e.error=e.error.message),e}function h(e){const t=u.default.fromStructuredClone(e);return new i.Key(t)}function p(e){return e.keyid=c.default.fromClone(e.keyid),f.default.isStream(e.signature)?(e.signature=n.default.readToEnd(e.signature,([e])=>new o.Signature(u.default.fromStructuredClone(e))),e.signature.catch(()=>{})):e.signature=new o.Signature(u.default.fromStructuredClone(e.signature)),e.verified=n.default.readToEnd(e.verified,([e])=>e),e.verified.catch(()=>{}),e.error&&(e.error=new Error(e.error)),e}},{"../cleartext":77,"../key":118,"../message":126,"../signature":151,"../type/keyid":154,"../util":158,"./packetlist":136,"web-stream-tools":75}],130:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=c(e("pako")),i=c(e("seek-bzip")),a=c(e("web-stream-tools")),s=c(e("../config")),o=c(e("../enums")),u=c(e("../util"));function c(e){return e&&e.__esModule?e:{default:e}}function f(){this.tag=o.default.packet.compressed,this.packets=null,this.algorithm="zip",this.compressed=null}f.prototype.read=async function(e,t){await a.default.parse(e,async e=>{this.algorithm=o.default.read(o.default.compression,await e.readByte()),this.compressed=e.remainder(),await this.decompress(t)})},f.prototype.write=function(){return null===this.compressed&&this.compress(),u.default.concat([new Uint8Array([o.default.write(o.default.compression,this.algorithm)]),this.compressed])},f.prototype.decompress=async function(e){if(!m[this.algorithm])throw new Error(this.algorithm+" decompression not supported");await this.packets.read(m[this.algorithm](this.compressed),e)},f.prototype.compress=function(){if(!b[this.algorithm])throw new Error(this.algorithm+" compression not supported");this.compressed=b[this.algorithm](this.packets.write())},r.default=f;const d=u.default.getNodeZlib();function l(e){return e}function h(e,t={}){return function(r){return a.default.nodeToWeb(a.default.webToNode(r).pipe(e(t)))}}function p(e,t={}){return function(r){const i=new e(t);return a.default.transform(r,e=>{if(e.length)return i.push(e,n.default.Z_SYNC_FLUSH),i.result},()=>{if(e===n.default.Deflate)return i.push([],n.default.Z_FINISH),i.result})}}function y(e){return function(t){return a.default.fromAsync(async()=>e(await a.default.readToEnd(t)))}}let b,m;d?(b={zip:h(d.createDeflateRaw,{level:s.default.deflate_level}),zlib:h(d.createDeflate,{level:s.default.deflate_level})},m={uncompressed:l,zip:h(d.createInflateRaw),zlib:h(d.createInflate),bzip2:y(i.default.decode)}):(b={zip:p(n.default.Deflate,{raw:!0,level:s.default.deflate_level}),zlib:p(n.default.Deflate,{level:s.default.deflate_level})},m={uncompressed:l,zip:p(n.default.Inflate,{raw:!0}),zlib:p(n.default.Inflate),bzip2:y(i.default.decode)})},{"../config":79,"../enums":113,"../util":158,pako:50,"seek-bzip":69,"web-stream-tools":75}],131:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n,i=o(e("./all_packets")),a=o(e("./clone")),s=e("./packetlist");function o(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}const u={List:((n=s)&&n.__esModule?n:{default:n}).default,clone:a};Object.assign(u,i),r.default=u},{"./all_packets":128,"./clone":129,"./packetlist":136}],132:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=s(e("web-stream-tools")),i=s(e("../enums")),a=s(e("../util"));function s(e){return e&&e.__esModule?e:{default:e}}function o(e=new Date){this.tag=i.default.packet.literal,this.format="utf8",this.date=a.default.normalizeDate(e),this.text=null,this.data=null,this.filename="msg.txt"}o.prototype.setText=function(e,t="utf8"){this.format=t,this.text=e,this.data=null},o.prototype.getText=function(e=!1){return(null===this.text||a.default.isStream(this.text))&&(this.text=a.default.decode_utf8(a.default.nativeEOL(this.getBytes(e)))),this.text},o.prototype.setBytes=function(e,t){this.format=t,this.data=e,this.text=null},o.prototype.getBytes=function(e=!1){return null===this.data&&(this.data=a.default.canonicalizeEOL(a.default.encode_utf8(this.text))),e?n.default.passiveClone(this.data):this.data},o.prototype.setFilename=function(e){this.filename=e},o.prototype.getFilename=function(){return this.filename},o.prototype.read=async function(e){await n.default.parse(e,async e=>{const t=i.default.read(i.default.literal,await e.readByte()),r=await e.readByte();this.filename=a.default.decode_utf8(await e.readBytes(r)),this.date=a.default.readDate(await e.readBytes(4));const n=e.remainder();this.setBytes(n,t)})},o.prototype.writeHeader=function(){const e=a.default.encode_utf8(this.filename),t=new Uint8Array([e.length]),r=new Uint8Array([i.default.write(i.default.literal,this.format)]),n=a.default.writeDate(this.date);return a.default.concatUint8Array([r,t,e,n])},o.prototype.write=function(){const e=this.writeHeader(),t=this.getBytes();return a.default.concat([e,t])},r.default=o},{"../enums":113,"../util":158,"web-stream-tools":75}],133:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n,i=e("../enums"),a=(n=i)&&n.__esModule?n:{default:n};function s(){this.tag=a.default.packet.marker}s.prototype.read=function(e){return 80===e[0]&&71===e[1]&&80===e[2]},r.default=s},{"../enums":113}],134:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=u(e("web-stream-tools")),i=u(e("./signature")),a=u(e("../type/keyid")),s=u(e("../enums")),o=u(e("../util"));function u(e){return e&&e.__esModule?e:{default:e}}function c(){this.tag=s.default.packet.onePassSignature,this.version=null,this.signatureType=null,this.hashAlgorithm=null,this.publicKeyAlgorithm=null,this.issuerKeyId=null,this.flags=null}c.prototype.read=function(e){let t=0;return this.version=e[t++],this.signatureType=e[t++],this.hashAlgorithm=e[t++],this.publicKeyAlgorithm=e[t++],this.issuerKeyId=new a.default,this.issuerKeyId.read(e.subarray(t,t+8)),t+=8,this.flags=e[t++],this},c.prototype.write=function(){const e=new Uint8Array([3,s.default.write(s.default.signature,this.signatureType),s.default.write(s.default.hash,this.hashAlgorithm),s.default.write(s.default.publicKey,this.publicKeyAlgorithm)]),t=new Uint8Array([this.flags]);return o.default.concatUint8Array([e,this.issuerKeyId.write(),t])},c.prototype.postCloneTypeFix=function(){this.issuerKeyId=a.default.fromClone(this.issuerKeyId)},c.prototype.hash=i.default.prototype.hash,c.prototype.toHash=i.default.prototype.toHash,c.prototype.toSign=i.default.prototype.toSign,c.prototype.calculateTrailer=function(...e){return n.default.fromAsync(async()=>i.default.prototype.calculateTrailer.apply(await this.correspondingSig,e))},c.prototype.verify=async function(){const e=await this.correspondingSig;if(!e||e.tag!==s.default.packet.signature)throw new Error("Corresponding signature packet missing");if(e.signatureType!==this.signatureType||e.hashAlgorithm!==this.hashAlgorithm||e.publicKeyAlgorithm!==this.publicKeyAlgorithm||!e.issuerKeyId.equals(this.issuerKeyId))throw new Error("Corresponding signature packet does not match one-pass signature packet");return e.hashed=this.hashed,e.verify.apply(e,arguments)},r.default=c},{"../enums":113,"../type/keyid":154,"../util":158,"./signature":142,"web-stream-tools":75}],135:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,i=!1,a=void 0;try{for(var s,o=e[Symbol.iterator]();!(n=(s=o.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(u){i=!0,a=u}finally{try{!n&&o.return&&o.return()}finally{if(i)throw a}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=o(e("web-stream-tools")),a=o(e("../enums")),s=o(e("../util"));function o(e){return e&&e.__esModule?e:{default:e}}r.default={readSimpleLength:function(e){let t,r=0;const i=e[0];i<192?(r=n(e,1)[0],t=1):i<255?(r=(e[0]-192<<8)+e[1]+192,t=2):255===i&&(r=s.default.readNumber(e.subarray(1,5)),t=5);return{len:r,offset:t}},writeSimpleLength:function(e){return e<192?new Uint8Array([e]):e>191&&e<8384?new Uint8Array([192+(e-192>>8),e-192&255]):s.default.concatUint8Array([new Uint8Array([255]),s.default.writeNumber(e,4)])},writePartialLength:function(e){if(e<0||e>30)throw new Error("Partial Length power must be between 1 and 30");return new Uint8Array([224+e])},writeTag:function(e){return new Uint8Array([192|e])},writeHeader:function(e,t){return s.default.concatUint8Array([this.writeTag(e),this.writeSimpleLength(t)])},supportsStreaming:function(e){return[a.default.packet.literal,a.default.packet.compressed,a.default.packet.symmetricallyEncrypted,a.default.packet.symEncryptedIntegrityProtected,a.default.packet.symEncryptedAEADProtected].includes(e)},read:async function(e,t,r){const n=i.default.getReader(e);let a,o;try{const e=await n.peekBytes(2);if(!e||e.length<2||0==(128&e[0]))throw new Error("Error during parsing. This message / key probably does not conform to a valid OpenPGP format.");const f=await n.readByte();let d,l,h=-1,p=-1;p=0,0!=(64&f)&&(p=1),p?h=63&f:(h=(63&f)>>2,l=3&f);const y=this.supportsStreaming(h);let b,m=null;if(t&&y){const e=new TransformStream;a=i.default.getWriter(e.writable),o=r({tag:h,packet:m=e.readable})}else m=[];do{if(p){const e=await n.readByte();if(b=!1,e<192)d=e;else if(e>=192&&e<224)d=(e-192<<8)+await n.readByte()+192;else if(e>223&&e<255){if(d=1<<(31&e),b=!0,!y)throw new TypeError("This packet type does not support partial lengths.")}else d=await n.readByte()<<24|await n.readByte()<<16|await n.readByte()<<8|await n.readByte()}else switch(l){case 0:d=await n.readByte();break;case 1:d=await n.readByte()<<8|await n.readByte();break;case 2:d=await n.readByte()<<24|await n.readByte()<<16|await n.readByte()<<8|await n.readByte();break;default:d=1/0}if(d>0){let e=0;for(;;){a&&await a.ready;var u=await n.read();const t=u.done,r=u.value;if(t){if(d===1/0)break;throw new Error("Unexpected end of packet")}const i=d===1/0?r:r.subarray(0,d-e);if(a?await a.write(i):m.push(i),(e+=r.length)>=d){n.unshift(r.subarray(d-e+r.length));break}}}}while(b);const g=await n.peekBytes(y?1/0:2);return a?(await a.ready,await a.close()):(m=s.default.concatUint8Array(m),await r({tag:h,packet:m})),!g||!g.length}catch(c){if(a)return await a.abort(c),!0;throw c}finally{a&&await o,n.releaseLock()}}}},{"../enums":113,"../util":158,"web-stream-tools":75}],136:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=c(e("web-stream-tools")),i=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(e("./all_packets")),a=c(e("./packet")),s=c(e("../config")),o=c(e("../enums")),u=c(e("../util"));function c(e){return e&&e.__esModule?e:{default:e}}function f(){this.length=0}f.prototype=[],f.prototype.read=async function(e,t){this.stream=n.default.transformPair(e,async(e,r)=>{const c=n.default.getWriter(r);try{for(;;){if(await c.ready,await a.default.read(e,t,async e=>{try{const n=o.default.read(o.default.packet,e.tag),d=i.newPacketFromTag(n);d.packets=new f,d.fromStream=u.default.isStream(e.packet),await d.read(e.packet,t),await c.write(d)}catch(r){s.default.tolerant&&!a.default.supportsStreaming(e.tag)||await c.abort(r),u.default.print_debug_error(r)}}))return await c.ready,void(await c.close())}}catch(d){await c.abort(d)}});const r=n.default.getReader(this.stream);for(;;){var c=await r.read();const e=c.done,t=c.value;if(e?this.stream=null:this.push(t),e||a.default.supportsStreaming(t.tag))break}r.releaseLock()},f.prototype.write=function(){const e=[];for(let t=0;t{if(i.push(e),(s+=e.length)>=o){const e=Math.min(Math.log(s)/Math.LN2|0,30),t=2**e,r=u.default.concat([a.default.writePartialLength(e)].concat(i));return i=[r.subarray(1+t)],s=i[0].length,r.subarray(0,1+t)}},()=>u.default.concat([a.default.writeSimpleLength(s)].concat(i))))}else{if(u.default.isStream(r)){let i=0;e.push(n.default.transform(n.default.clone(r),e=>{i+=e.length},()=>a.default.writeHeader(this[t].tag,i)))}else e.push(a.default.writeHeader(this[t].tag,r.length));e.push(r)}}return u.default.concat(e)},f.prototype.push=function(e){e&&(e.packets=e.packets||new f,this[this.length]=e,this.length++)},f.prototype.filterByTag=function(...e){const t=new f,r=e=>t=>e===t;for(let n=0;nt.tag===e)},f.prototype.indexOfTag=function(...e){const t=[],r=this,n=e=>t=>e===t;for(let i=0;ii.fromStructuredClone(e))),t},r.default=f},{"../config":79,"../enums":113,"../util":158,"./all_packets":128,"./packet":135,"web-stream-tools":75}],137:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e("asmcrypto.js/dist_es5/hash/sha1/sha1"),i=e("asmcrypto.js/dist_es5/hash/sha256/sha256"),a=d(e("../type/keyid")),s=d(e("../type/mpi")),o=d(e("../config")),u=d(e("../crypto")),c=d(e("../enums")),f=d(e("../util"));function d(e){return e&&e.__esModule?e:{default:e}}function l(e=new Date){this.tag=c.default.packet.publicKey,this.version=o.default.v5_keys?5:4,this.created=f.default.normalizeDate(e),this.algorithm=null,this.params=[],this.expirationTimeV3=0,this.fingerprint=null,this.keyid=null}l.prototype.read=function(e){let t=0;if(this.version=e[t++],4===this.version||5===this.version){this.created=f.default.readDate(e.subarray(t,t+4)),t+=4,this.algorithm=c.default.read(c.default.publicKey,e[t++]);const r=c.default.write(c.default.publicKey,this.algorithm);5===this.version&&(t+=4);const n=u.default.getPubKeyParamTypes(r);this.params=u.default.constructParams(n);for(let i=0;ie.length)throw new Error("Error reading MPI @:"+t);return t}throw new Error("Version "+this.version+" of the key packet is unsupported.")},l.prototype.readPublicKey=l.prototype.read,l.prototype.write=function(){const e=[];e.push(new Uint8Array([this.version])),e.push(f.default.writeDate(this.created));const t=c.default.write(c.default.publicKey,this.algorithm);e.push(new Uint8Array([t]));const r=u.default.getPubKeyParamTypes(t).length,n=f.default.concatUint8Array(this.params.slice(0,r).map(e=>e.write()));return 5===this.version&&e.push(f.default.writeNumber(n.length,4)),e.push(n),f.default.concatUint8Array(e)},l.prototype.writePublicKey=l.prototype.write,l.prototype.writeForHash=function(e){const t=this.writePublicKey();return 5===e?f.default.concatUint8Array([new Uint8Array([154]),f.default.writeNumber(t.length,4),t]):f.default.concatUint8Array([new Uint8Array([153]),f.default.writeNumber(t.length,2),t])},l.prototype.isDecrypted=function(){return null},l.prototype.getCreationTime=function(){return this.created},l.prototype.getKeyId=function(){return this.keyid?this.keyid:(this.keyid=new a.default,5===this.version?this.keyid.read(f.default.hex_to_Uint8Array(this.getFingerprint()).subarray(0,8)):4===this.version&&this.keyid.read(f.default.hex_to_Uint8Array(this.getFingerprint()).subarray(12,20)),this.keyid)},l.prototype.getFingerprintBytes=function(){if(this.fingerprint)return this.fingerprint;const e=this.writeForHash(this.version);return 5===this.version?this.fingerprint=i.Sha256.bytes(e):4===this.version&&(this.fingerprint=n.Sha1.bytes(e)),this.fingerprint},l.prototype.getFingerprint=function(){return f.default.Uint8Array_to_hex(this.getFingerprintBytes())},l.prototype.hasSameFingerprintAs=function(e){return this.version===e.version&&f.default.equalsUint8Array(this.writePublicKey(),e.writePublicKey())},l.prototype.getAlgorithmInfo=function(){const e={};return e.algorithm=this.algorithm,this.params[0]instanceof s.default?(e.rsaBits=8*this.params[0].byteLength(),e.bits=e.rsaBits):e.curve=this.params[0].getName(),e},l.prototype.postCloneTypeFix=function(){const e=c.default.write(c.default.publicKey,this.algorithm),t=u.default.getPubKeyParamTypes(e);for(let r=0;re.length)throw new Error("Error reading param @:"+a);return i}function l(e,t){const r=[],n=o.default.write(o.default.publicKey,t);for(let i=s.default.getPubKeyParamTypes(n).length;i{e.data.fill(0)}),this.params.length=t,this.isEncrypted=!0},f.prototype.postCloneTypeFix=function(){const e=o.default.write(o.default.publicKey,this.algorithm),t=[].concat(s.default.getPubKeyParamTypes(e),s.default.getPrivKeyParamTypes(e));for(let r=0;ro.default.signature.sign(s,f,p,l,await n.default.readToEnd(h));return i?this.signature=n.default.fromAsync(y):(this.signature=await y(),this.verified=!0),!0},l.prototype.write_hashed_sub_packets=function(){const e=u.default.signatureSubpacket,t=[];let r;null!==this.created&&t.push(h(e.signature_creation_time,c.default.writeDate(this.created))),null!==this.signatureExpirationTime&&t.push(h(e.signature_expiration_time,c.default.writeNumber(this.signatureExpirationTime,4))),null!==this.exportable&&t.push(h(e.exportable_certification,new Uint8Array([this.exportable?1:0]))),null!==this.trustLevel&&(r=new Uint8Array([this.trustLevel,this.trustAmount]),t.push(h(e.trust_signature,r))),null!==this.regularExpression&&t.push(h(e.regular_expression,this.regularExpression)),null!==this.revocable&&t.push(h(e.revocable,new Uint8Array([this.revocable?1:0]))),null!==this.keyExpirationTime&&t.push(h(e.key_expiration_time,c.default.writeNumber(this.keyExpirationTime,4))),null!==this.preferredSymmetricAlgorithms&&(r=c.default.str_to_Uint8Array(c.default.Uint8Array_to_str(this.preferredSymmetricAlgorithms)),t.push(h(e.preferred_symmetric_algorithms,r))),null!==this.revocationKeyClass&&(r=new Uint8Array([this.revocationKeyClass,this.revocationKeyAlgorithm]),r=c.default.concat([r,this.revocationKeyFingerprint]),t.push(h(e.revocation_key,r))),this.notations.forEach(([n,i])=>{(r=[new Uint8Array([128,0,0,0])]).push(c.default.writeNumber(n.length,2)),r.push(c.default.writeNumber(i.length,2)),r.push(c.default.str_to_Uint8Array(n+i)),r=c.default.concat(r),t.push(h(e.notation_data,r))}),null!==this.preferredHashAlgorithms&&(r=c.default.str_to_Uint8Array(c.default.Uint8Array_to_str(this.preferredHashAlgorithms)),t.push(h(e.preferred_hash_algorithms,r))),null!==this.preferredCompressionAlgorithms&&(r=c.default.str_to_Uint8Array(c.default.Uint8Array_to_str(this.preferredCompressionAlgorithms)),t.push(h(e.preferred_compression_algorithms,r))),null!==this.keyServerPreferences&&(r=c.default.str_to_Uint8Array(c.default.Uint8Array_to_str(this.keyServerPreferences)),t.push(h(e.key_server_preferences,r))),null!==this.preferredKeyServer&&t.push(h(e.preferred_key_server,c.default.str_to_Uint8Array(this.preferredKeyServer))),null!==this.isPrimaryUserID&&t.push(h(e.primary_user_id,new Uint8Array([this.isPrimaryUserID?1:0]))),null!==this.policyURI&&t.push(h(e.policy_uri,c.default.str_to_Uint8Array(this.policyURI))),null!==this.keyFlags&&(r=c.default.str_to_Uint8Array(c.default.Uint8Array_to_str(this.keyFlags)),t.push(h(e.key_flags,r))),null!==this.signersUserId&&t.push(h(e.signers_user_id,c.default.str_to_Uint8Array(this.signersUserId))),null!==this.reasonForRevocationFlag&&(r=c.default.str_to_Uint8Array(String.fromCharCode(this.reasonForRevocationFlag)+this.reasonForRevocationString),t.push(h(e.reason_for_revocation,r))),null!==this.features&&(r=c.default.str_to_Uint8Array(c.default.Uint8Array_to_str(this.features)),t.push(h(e.features,r))),null!==this.signatureTargetPublicKeyAlgorithm&&((r=[new Uint8Array([this.signatureTargetPublicKeyAlgorithm,this.signatureTargetHashAlgorithm])]).push(c.default.str_to_Uint8Array(this.signatureTargetHash)),r=c.default.concat(r),t.push(h(e.signature_target,r))),null!==this.preferredAeadAlgorithms&&(r=c.default.str_to_Uint8Array(c.default.Uint8Array_to_str(this.preferredAeadAlgorithms)),t.push(h(e.preferred_aead_algorithms,r)));const n=c.default.concat(t),i=c.default.writeNumber(n.length,2);return c.default.concat([i,n])},l.prototype.write_unhashed_sub_packets=function(){const e=u.default.signatureSubpacket,t=[];let r;this.issuerKeyId.isNull()||5===this.issuerKeyVersion||t.push(h(e.issuer,this.issuerKeyId.write())),null!==this.embeddedSignature&&t.push(h(e.embedded_signature,this.embeddedSignature.write())),null!==this.issuerFingerprint&&(r=[new Uint8Array([this.issuerKeyVersion]),this.issuerFingerprint],r=c.default.concat(r),t.push(h(e.issuer_fingerprint,r))),this.unhashedSubpackets.forEach(e=>{t.push(i.default.writeSimpleLength(e.length)),t.push(e)});const n=c.default.concat(t),a=c.default.writeNumber(n.length,2);return c.default.concat([a,n])},l.prototype.read_sub_packet=function(e,t=!0){let r=0;const n=(e,t)=>{this[e]=[];for(let r=0;r{r+=e.length},()=>{const n=[];return 5!==this.version||this.signatureType!==u.default.signature.binary&&this.signatureType!==u.default.signature.text||(t?n.push(new Uint8Array(6)):n.push(e.writeHeader())),n.push(new Uint8Array([this.version,255])),5===this.version&&n.push(new Uint8Array(4)),n.push(c.default.writeNumber(r,4)),c.default.concat(n)})},l.prototype.toHash=function(e,t,r=!1){const n=this.toSign(e,t);return c.default.concat([n,this.signatureData,this.calculateTrailer(t,r)])},l.prototype.hash=async function(e,t,r,i=!1,a=!0){const s=u.default.write(u.default.hash,this.hashAlgorithm);return r||(r=this.toHash(e,t,i)),!a&&c.default.isStream(r)?n.default.fromAsync(async()=>this.hash(e,t,await n.default.readToEnd(r),i)):o.default.hash.digest(s,r)},l.prototype.verify=async function(e,t,r,i=!1,a=!1){const c=u.default.write(u.default.publicKey,this.publicKeyAlgorithm),d=u.default.write(u.default.hash,this.hashAlgorithm);if(c!==u.default.write(u.default.publicKey,e.algorithm))throw new Error("Public key algorithm used to sign signature does not match issuer key algorithm.");let l,h;if(this.hashed?h=await this.hashed:(l=this.toHash(t,r,i),a||(l=await n.default.readToEnd(l)),h=await this.hash(t,r,l)),h=await n.default.readToEnd(h),this.signedHashValue[0]!==h[0]||this.signedHashValue[1]!==h[1])throw new Error("Message digest did not match");let p=0;c>0&&c<4?p=1:c!==u.default.publicKey.dsa&&c!==u.default.publicKey.ecdsa&&c!==u.default.publicKey.eddsa||(p=2);const y=c===u.default.publicKey.eddsa?"le":"be",b=[];let m=0;this.signature=await n.default.readToEnd(this.signature);for(let n=0;n{if(await e.readByte()!==c)throw new Error("Invalid packet version.");this.cipherAlgo=await e.readByte(),this.aeadAlgo=await e.readByte(),this.chunkSizeByte=await e.readByte();const t=a.default[s.default.read(s.default.aead,this.aeadAlgo)];this.iv=await e.readBytes(t.ivLength),this.encrypted=e.remainder()})},f.prototype.write=function(){return o.default.concat([new Uint8Array([this.version,this.cipherAlgo,this.aeadAlgo,this.chunkSizeByte]),this.iv,this.encrypted])},f.prototype.decrypt=async function(e,t,r){return await this.packets.read(await this.crypt("decrypt",t,n.default.clone(this.encrypted),r),r),!0},f.prototype.encrypt=async function(e,t,r){this.cipherAlgo=s.default.write(s.default.symmetric,e),this.aeadAlgo=s.default.write(s.default.aead,this.aeadAlgorithm);const n=a.default[s.default.read(s.default.aead,this.aeadAlgo)];this.iv=await a.default.random.getRandomBytes(n.ivLength),this.chunkSizeByte=i.default.aead_chunk_size_byte;const o=this.packets.write();this.encrypted=await this.crypt("encrypt",t,o,r)},f.prototype.crypt=async function(e,t,r,i){const u=s.default.read(s.default.symmetric,this.cipherAlgo),c=a.default[s.default.read(s.default.aead,this.aeadAlgo)],f=await c(u,t),d="decrypt"===e?c.tagLength:0,l="encrypt"===e?c.tagLength:0,h=2**(this.chunkSizeByte+6)+d,p=new ArrayBuffer(21),y=new Uint8Array(p,0,13),b=new Uint8Array(p),m=new DataView(p),g=new Uint8Array(p,5,8);y.set([192|this.tag,this.version,this.cipherAlgo,this.aeadAlgo,this.chunkSizeByte],0);let w=0,_=Promise.resolve(),v=0,k=0;const A=this.iv;return n.default.transformPair(r,async(t,r)=>{const a=n.default.getReader(t),s=new TransformStream({},{highWaterMark:i?o.default.getHardwareConcurrency()*2**(this.chunkSizeByte+6):1/0,size:e=>e.length});n.default.pipe(s.readable,r);const u=n.default.getWriter(s.writable);try{for(;;){let t=await a.readBytes(h+d)||new Uint8Array;const r=t.subarray(t.length-d);let n,i;if(t=t.subarray(0,t.length-d),!w||t.length?(a.unshift(r),n=f[e](t,c.getNonce(A,g),y),k+=t.length-d+l):(m.setInt32(17,v),n=f[e](r,c.getNonce(A,g),b),k+=l,i=!0),v+=t.length-d,_=_.then(()=>n).then(async e=>{await u.ready,await u.write(e),k-=e.length}).catch(e=>u.abort(e)),(i||k>u.desiredSize)&&await _,i){await u.close();break}m.setInt32(9,++w)}}catch(p){await u.abort(p)}})}},{"../config":79,"../crypto":94,"../enums":113,"../util":158,"web-stream-tools":75}],144:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=u(e("web-stream-tools")),i=u(e("../config")),a=u(e("../crypto")),s=u(e("../enums")),o=u(e("../util"));function u(e){return e&&e.__esModule?e:{default:e}}const c=1;function f(){this.tag=s.default.packet.symEncryptedIntegrityProtected,this.version=c,this.encrypted=null,this.modification=!1,this.packets=null}f.prototype.read=async function(e){await n.default.parse(e,async e=>{if(await e.readByte()!==c)throw new Error("Invalid packet version.");this.encrypted=e.remainder()})},f.prototype.write=function(){return o.default.concat([new Uint8Array([c]),this.encrypted])},f.prototype.encrypt=async function(e,t,r){let i=this.packets.write();r||(i=await n.default.readToEnd(i));const s=await a.default.getPrefixRandom(e),u=new Uint8Array([211,20]),c=o.default.concat([s,i,u]),f=await a.default.hash.sha1(n.default.passiveClone(c)),d=o.default.concat([c,f]);return this.encrypted=await a.default.cfb.encrypt(e,t,d,new Uint8Array(a.default.cipher[e].blockSize)),!0},f.prototype.decrypt=async function(e,t,r){let s=n.default.clone(this.encrypted);r||(s=await n.default.readToEnd(s));const u=await a.default.cfb.decrypt(e,t,s,new Uint8Array(a.default.cipher[e].blockSize)),c=n.default.slice(n.default.passiveClone(u),-20),f=n.default.slice(u,0,-20),d=Promise.all([n.default.readToEnd(await a.default.hash.sha1(n.default.passiveClone(f))),n.default.readToEnd(c)]).then(([e,t])=>{if(!o.default.equalsUint8Array(e,t))throw new Error("Modification detected.");return new Uint8Array}),l=n.default.slice(f,a.default.cipher[e].blockSize+2);let h=n.default.slice(l,0,-2);return h=n.default.concat([h,n.default.fromAsync(()=>d)]),o.default.isStream(s)&&i.default.allow_unauthenticated_stream||(h=await n.default.readToEnd(h)),await this.packets.read(h,r),!0},r.default=f},{"../config":79,"../crypto":94,"../enums":113,"../util":158,"web-stream-tools":75}],145:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=u(e("../type/s2k")),i=u(e("../config")),a=u(e("../crypto")),s=u(e("../enums")),o=u(e("../util"));function u(e){return e&&e.__esModule?e:{default:e}}function c(){this.tag=s.default.packet.symEncryptedSessionKey,this.version=i.default.aead_protect?5:4,this.sessionKey=null,this.sessionKeyEncryptionAlgorithm=null,this.sessionKeyAlgorithm="aes256",this.aeadAlgorithm=s.default.read(s.default.aead,i.default.aead_mode),this.encrypted=null,this.s2k=null,this.iv=null}c.prototype.read=function(e){let t=0;this.version=e[t++];const r=s.default.read(s.default.symmetric,e[t++]);if(5===this.version&&(this.aeadAlgorithm=s.default.read(s.default.aead,e[t++])),this.s2k=new n.default,t+=this.s2k.read(e.subarray(t,e.length)),5===this.version){const r=a.default[this.aeadAlgorithm];this.iv=e.subarray(t,t+=r.ivLength)}5===this.version||t=1){const t=e[0];if(e.length>=1+t)return this.data=e.subarray(1,1+t),1+this.data.length}throw new Error("Invalid symmetric key")},s.prototype.write=function(){return a.default.concatUint8Array([new Uint8Array([this.data.length]),this.data])},s.fromClone=function(e){return new s(e.data)},r.default=s},{"../util":158}],153:[function(e,t,r){"use strict";function n(e){if(e){const t=e.hash,r=e.cipher;this.hash=t,this.cipher=r}else this.hash=null,this.cipher=null}Object.defineProperty(r,"__esModule",{value:!0}),n.prototype.read=function(e){if(e.length<4||3!==e[0]||1!==e[1])throw new Error("Cannot read KDFParams");return this.hash=e[2],this.cipher=e[3],4},n.prototype.write=function(){return new Uint8Array([3,1,this.hash,this.cipher])},n.fromClone=function(e){return new n({hash:e.hash,cipher:e.cipher})},r.default=n},{}],154:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n,i=e("../util.js"),a=(n=i)&&n.__esModule?n:{default:n};function s(){this.bytes=""}s.prototype.read=function(e){this.bytes=a.default.Uint8Array_to_str(e.subarray(0,8))},s.prototype.write=function(){return a.default.str_to_Uint8Array(this.bytes)},s.prototype.toHex=function(){return a.default.str_to_hex(this.bytes)},s.prototype.equals=function(e,t=!1){return t&&(e.isWildcard()||this.isWildcard())||this.bytes===e.bytes},s.prototype.isNull=function(){return""===this.bytes},s.prototype.isWildcard=function(){return/^0+$/.test(this.toHex())},s.mapToHex=function(e){return e.toHex()},s.fromClone=function(e){const t=new s;return t.bytes=e.bytes,t},s.fromId=function(e){const t=new s;return t.read(a.default.hex_to_Uint8Array(e)),t},s.wildcard=function(){const e=new s;return e.read(new Uint8Array(8)),e},r.default=s},{"../util.js":158}],155:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=a(e("bn.js")),i=a(e("../util"));function a(e){return e&&e.__esModule?e:{default:e}}function s(e){e instanceof s?this.data=e.data:n.default.isBN(e)?this.fromBN(e):i.default.isUint8Array(e)?this.fromUint8Array(e):i.default.isString(e)?this.fromString(e):this.data=null}s.prototype.read=function(e,t="be"){i.default.isString(e)&&(e=i.default.str_to_Uint8Array(e));const r=(e[0]<<8|e[1])+7>>>3,n=e.subarray(2,2+r);return this.fromUint8Array(n,t),2+r},s.prototype.write=function(e,t){return i.default.Uint8Array_to_MPI(this.toUint8Array(e,t))},s.prototype.bitLength=function(){return 8*(this.data.length-1)+i.default.nbits(this.data[0])},s.prototype.byteLength=function(){return this.data.length},s.prototype.toUint8Array=function(e,t){e=e||"be",t=t||this.data.length;const r=new Uint8Array(t),n="le"===e?0:t-this.data.length;return r.set(this.data,n),"le"===e&&r.reverse(),r},s.prototype.fromUint8Array=function(e,t="be"){this.data=new Uint8Array(e.length),this.data.set(e),"le"===t&&this.data.reverse()},s.prototype.toString=function(){return i.default.Uint8Array_to_str(this.toUint8Array())},s.prototype.fromString=function(e,t="be"){this.fromUint8Array(i.default.str_to_Uint8Array(e),t)},s.prototype.toBN=function(){return new n.default(this.toUint8Array())},s.prototype.fromBN=function(e){this.data=e.toArrayLike(Uint8Array)},s.fromClone=function(e){return new s(e.data)},r.default=s},{"../util":158,"bn.js":16}],156:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=a(e("../util")),i=a(e("../enums"));function a(e){return e&&e.__esModule?e:{default:e}}function s(e){if(e instanceof s)this.oid=e.oid;else if(n.default.isArray(e)||n.default.isUint8Array(e)){if(6===(e=new Uint8Array(e))[0]){if(e[1]!==e.length-2)throw new Error("Length mismatch in DER encoded oid");e=e.subarray(2)}this.oid=e}else this.oid=""}s.prototype.read=function(e){if(e.length>=1){const t=e[0];if(e.length>=1+t)return this.oid=e.subarray(1,1+t),1+this.oid.length}throw new Error("Invalid oid")},s.prototype.write=function(){return n.default.concatUint8Array([new Uint8Array([this.oid.length]),this.oid])},s.prototype.toHex=function(){return n.default.Uint8Array_to_hex(this.oid)},s.prototype.getName=function(){const e=this.toHex();if(i.default.curve[e])return i.default.write(i.default.curve,e);throw new Error("Unknown curve object identifier.")},s.fromClone=function(e){return new s(e.oid)},r.default=s},{"../enums":113,"../util":158}],157:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=o(e("../config")),i=o(e("../crypto")),a=o(e("../enums.js")),s=o(e("../util.js"));function o(e){return e&&e.__esModule?e:{default:e}}function u(){this.algorithm="sha256",this.type="iterated",this.c=n.default.s2k_iteration_count_byte,this.salt=null}u.prototype.get_count=function(){return 16+(15&this.c)<<6+(this.c>>4)},u.prototype.read=function(e){let t=0;switch(this.type=a.default.read(a.default.s2k,e[t++]),this.algorithm=e[t++],"gnu"!==this.type&&(this.algorithm=a.default.read(a.default.hash,this.algorithm)),this.type){case"simple":break;case"salted":this.salt=e.subarray(t,t+8),t+=8;break;case"iterated":this.salt=e.subarray(t,t+8),t+=8,this.c=e[t++];break;case"gnu":if("GNU"!==s.default.Uint8Array_to_str(e.subarray(t,t+3)))throw new Error("Unknown s2k type.");if(t+=3,1001!==1e3+e[t++])throw new Error("Unknown s2k gnu protection mode.");this.type="gnu-dummy";break;default:throw new Error("Unknown s2k type.")}return t},u.prototype.write=function(){if("gnu-dummy"===this.type)return new Uint8Array([101,0,...s.default.str_to_Uint8Array("GNU"),1]);const e=[new Uint8Array([a.default.write(a.default.s2k,this.type),a.default.write(a.default.hash,this.algorithm)])];switch(this.type){case"simple":break;case"salted":e.push(this.salt);break;case"iterated":e.push(this.salt),e.push(new Uint8Array([this.c]));break;case"gnu":throw new Error("GNU s2k type not supported.");default:throw new Error("Unknown s2k type.")}return s.default.concatUint8Array(e)},u.prototype.produce_key=async function(e,t){e=s.default.encode_utf8(e);const r=a.default.write(a.default.hash,this.algorithm),n=[];let o=0,u=0;for(;o{if(s.default.isStream(a))if(a.locked)e[n]=null;else{const r=i.default.transformPair(a,async a=>{const o=i.default.getReader(a);var u=new MessageChannel;const c=u.port1,f=u.port2;c.onmessage=async function({data:{action:e}}){if("read"===e)try{const e=await o.read();c.postMessage(e,s.default.getTransferables(e))}catch(t){c.postMessage({error:t.message})}else"cancel"===e&&(await r.cancel(),c.postMessage())},e[n]=f,t.push(f)})}else{if("[object MessagePort]"===Object.prototype.toString.call(a))throw new Error("Can't transfer the same stream twice.");s.default.collectTransferables(a,t,r)}}))},restoreStreams:function(e){return Object.prototype.isPrototypeOf(e)&&!Uint8Array.prototype.isPrototypeOf(e)&&Object.entries(e).forEach(([t,r])=>{"[object MessagePort]"!==Object.prototype.toString.call(r)?s.default.restoreStreams(r):e[t]=new ReadableStream({pull:e=>new Promise(t=>{r.onmessage=(r=>{var n=r.data;const i=n.done,a=n.value,s=n.error;s?e.error(new Error(s)):i?e.close():e.enqueue(a),t()}),r.postMessage({action:"read"})}),cancel:()=>new Promise(e=>{r.onmessage=e,r.postMessage({action:"cancel"})})},{highWaterMark:0})}),e},readNumber:function(e){let t=0;for(let r=0;r>8*(t-n-1)&255;return r},readDate:function(e){const t=s.default.readNumber(e);return new Date(1e3*t)},writeDate:function(e){const t=Math.floor(e.getTime()/1e3);return s.default.writeNumber(t,4)},normalizeDate:function(e=Date.now()){return null===e||e===1/0?e:new Date(1e3*Math.floor(+e/1e3))},str_to_hex:function(e){if(null===e)return"";const t=[],r=e.length;let n,i=0;for(;i>8,255&t]);return s.default.concatUint8Array([r,e])},b64_to_Uint8Array:function(e){return o.default.decode(e.replace(/-/g,"+").replace(/_/g,"/"))},Uint8Array_to_b64:function(e,t){let r=o.default.encode(e).replace(/[\r\n]/g,"");return t&&(r=r.replace(/[+]/g,"-").replace(/[/]/g,"_").replace(/[=]/g,"")),r},hex_to_Uint8Array:function(e){const t=new Uint8Array(e.length>>1);for(let r=0;r>1;r++)t[r]=parseInt(e.substr(r<<1,2),16);return t},Uint8Array_to_hex:function(e){const t=[],r=e.length;let n,i=0;for(;i{if(!s.default.isString(e))throw new Error("str_to_Uint8Array: Data must be in the form of a string");const t=new Uint8Array(e.length);for(let r=0;rr("",!0))},decode_utf8:function(e){const t=new TextDecoder("utf-8");function r(e,r=!1){return t.decode(e,{stream:!r})}return i.default.transform(e,r,()=>r(new Uint8Array,!0))},concat:i.default.concat,concatUint8Array:i.default.concatUint8Array,equalsUint8Array:function(e,t){if(!s.default.isUint8Array(e)||!s.default.isUint8Array(t))throw new Error("Data must be in the form of a Uint8Array");if(e.length!==t.length)return!1;for(let r=0;r{console.log(e+": ",t)})},nbits:function(e){let t=1,r=e>>>16;return 0!==r&&(e=r,t+=16),0!==(r=e>>8)&&(e=r,t+=8),0!==(r=e>>4)&&(e=r,t+=4),0!==(r=e>>2)&&(e=r,t+=2),0!==(r=e>>1)&&(e=r,t+=1),t},double:function(e){const t=new Uint8Array(e.length),r=e.length-1;for(let n=0;n