dsig
Version:
Digital Signature with OpenPGP
2 lines • 566 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).DSIG=t()}(this,(function(){"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function r(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,a=[],s=!0,o=!1;try{for(r=r.call(e);!(s=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);s=!0);}catch(e){o=!0,i=e}finally{try{s||null==r.return||r.return()}finally{if(o)throw i}}return a}}(e,r)||function(e,r){if(e){if("string"==typeof e)return t(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(e,r):void 0}}(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function n(e,t,r,n,i,a,s){try{var o=e[a](s),c=o.value}catch(e){return void r(e)}o.done?t(c):Promise.resolve(c).then(n,i)}function i(e){return function(){var t=this,r=arguments;return new Promise((function(i,a){var s=e.apply(t,r);function o(e){n(s,i,a,o,c,"next",e)}function c(e){n(s,i,a,o,c,"throw",e)}o(void 0)}))}}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function s(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})})),t}var o={exports:{}};!function(e){var t=function(e){var t,r=Object.prototype,n=r.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",o=i.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var i=t&&t.prototype instanceof b?t:b,a=Object.create(i.prototype),s=new M(n||[]);return a._invoke=function(e,t,r){var n=f;return function(i,a){if(n===l)throw new Error("Generator is already running");if(n===p){if("throw"===i)throw a;return C()}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var o=E(s,r);if(o){if(o===y)continue;return o}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===f)throw n=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=l;var c=h(e,t,r);if("normal"===c.type){if(n=r.done?p:d,c.arg===y)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n=p,r.method="throw",r.arg=c.arg)}}}(e,r,s),a}function h(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var f="suspendedStart",d="suspendedYield",l="executing",p="completed",y={};function b(){}function g(){}function m(){}var w={};c(w,a,(function(){return this}));var v=Object.getPrototypeOf,_=v&&v(v(K([])));_&&_!==r&&n.call(_,a)&&(w=_);var k=m.prototype=b.prototype=Object.create(w);function A(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function S(e,t){function r(i,a,s,o){var c=h(e[i],e,a);if("throw"!==c.type){var u=c.arg,f=u.value;return f&&"object"==typeof f&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,s,o)}),(function(e){r("throw",e,s,o)})):t.resolve(f).then((function(e){u.value=e,s(u)}),(function(e){return r("throw",e,s,o)}))}o(c.arg)}var i;this._invoke=function(e,n){function a(){return new t((function(t,i){r(e,n,t,i)}))}return i=i?i.then(a,a):a()}}function E(e,r){var n=e.iterator[r.method];if(n===t){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=t,E(e,r),"throw"===r.method))return y;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var i=h(n,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,y;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function P(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function x(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function M(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function K(e){if(e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,s=function r(){for(;++i<e.length;)if(n.call(e,i))return r.value=e[i],r.done=!1,r;return r.value=t,r.done=!0,r};return s.next=s}}return{next:C}}function C(){return{value:t,done:!0}}return g.prototype=m,c(k,"constructor",m),c(m,"constructor",g),g.displayName=c(m,o,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,c(e,o,"GeneratorFunction")),e.prototype=Object.create(k),e},e.awrap=function(e){return{__await:e}},A(S.prototype),c(S.prototype,s,(function(){return this})),e.AsyncIterator=S,e.async=function(t,r,n,i,a){void 0===a&&(a=Promise);var s=new S(u(t,r,n,i),a);return e.isGeneratorFunction(r)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},A(k),c(k,o,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=K,M.prototype={constructor:M,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(x),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function i(n,i){return o.type="throw",o.arg=e,r.next=n,i&&(r.method="next",r.arg=t),!!i}for(var a=this.tryEntries.length-1;a>=0;--a){var s=this.tryEntries[a],o=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var c=n.call(s,"catchLoc"),u=n.call(s,"finallyLoc");if(c&&u){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(c){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var s=a?a.completion:{};return s.type=e,s.arg=t,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),x(r),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;x(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:K(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}(o);var c=o.exports;
/*! OpenPGP.js v5.2.1 - 2022-03-15 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */const u="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},h=Symbol("doneWritingPromise"),f=Symbol("doneWritingResolve"),d=Symbol("doneWritingReject"),l=Symbol("readingIndex");class p extends Array{constructor(){super(),this[h]=new Promise(((e,t)=>{this[f]=e,this[d]=t})),this[h].catch((()=>{}))}}function y(e){return e&&e.getReader&&Array.isArray(e)}function b(e){if(!y(e)){const t=e.getWriter(),r=t.releaseLock;return t.releaseLock=()=>{t.closed.catch((function(){})),r.call(t)},t}this.stream=e}p.prototype.getReader=function(){return void 0===this[l]&&(this[l]=0),{read:async()=>(await this[h],this[l]===this.length?{value:void 0,done:!0}:{value:this[this[l]++],done:!1})}},p.prototype.readToEnd=async function(e){await this[h];const t=e(this.slice(this[l]));return this.length=0,t},p.prototype.clone=function(){const e=new p;return e[h]=this[h].then((()=>{e.push(...this)})),e},b.prototype.write=async function(e){this.stream.push(e)},b.prototype.close=async function(){this.stream[f]()},b.prototype.abort=async function(e){return this.stream[d](e),e},b.prototype.releaseLock=function(){};const g="object"==typeof u.process&&"object"==typeof u.process.versions,m=g&&void 0;function w(e){return y(e)?"array":u.ReadableStream&&u.ReadableStream.prototype.isPrototypeOf(e)?"web":D&&D.prototype.isPrototypeOf(e)?"ponyfill":m&&m.prototype.isPrototypeOf(e)?"node":!(!e||!e.getReader)&&"web-like"}function v(e){return Uint8Array.prototype.isPrototypeOf(e)}function _(e){if(1===e.length)return e[0];let t=0;for(let r=0;r<e.length;r++){if(!v(e[r]))throw Error("concatUint8Array: Data must be in the form of a Uint8Array");t+=e[r].length}const r=new Uint8Array(t);let n=0;return e.forEach((function(e){r.set(e,n),n+=e.length})),r}const k=g&&void 0,A=g&&void 0;let S,E;if(A){S=function(e){let t=!1;return new D({start(r){e.pause(),e.on("data",(n=>{t||(k.isBuffer(n)&&(n=new Uint8Array(n.buffer,n.byteOffset,n.byteLength)),r.enqueue(n),e.pause())})),e.on("end",(()=>{t||r.close()})),e.on("error",(e=>r.error(e)))},pull(){e.resume()},cancel(r){t=!0,e.destroy(r)}})};class e extends A{constructor(e,t){super(t),this._reader=F(e)}async _read(e){try{for(;;){const{done:e,value:t}=await this._reader.read();if(e){this.push(null);break}if(!this.push(t)||this._cancelling){this._reading=!1;break}}}catch(e){this.emit("error",e)}}_destroy(e){this._reader.cancel(e)}}E=function(t,r){return new e(t,r)}}const P=new WeakSet,x=Symbol("externalBuffer");function M(e){if(this.stream=e,e[x]&&(this[x]=e[x].slice()),y(e)){const t=e.getReader();return this._read=t.read.bind(t),this._releaseLock=()=>{},void(this._cancel=()=>{})}let t=w(e);if("node"===t&&(e=S(e)),t){const t=e.getReader();return this._read=t.read.bind(t),this._releaseLock=()=>{t.closed.catch((function(){})),t.releaseLock()},void(this._cancel=t.cancel.bind(t))}let r=!1;this._read=async()=>r||P.has(e)?{value:void 0,done:!0}:(r=!0,{value:e,done:!1}),this._releaseLock=()=>{if(r)try{P.add(e)}catch(e){}}}M.prototype.read=async function(){return this[x]&&this[x].length?{done:!1,value:this[x].shift()}:this._read()},M.prototype.releaseLock=function(){this[x]&&(this.stream[x]=this[x]),this._releaseLock()},M.prototype.cancel=function(e){return this._cancel(e)},M.prototype.readLine=async function(){let e,t=[];for(;!e;){let{done:r,value:n}=await this.read();if(n+="",r)return t.length?q(t):void 0;const i=n.indexOf("\n")+1;i&&(e=q(t.concat(n.substr(0,i))),t=[]),i!==n.length&&t.push(n.substr(i))}return this.unshift(...t),e},M.prototype.readByte=async function(){const{done:e,value:t}=await this.read();if(e)return;const r=t[0];return this.unshift(Y(t,1)),r},M.prototype.readBytes=async function(e){const t=[];let r=0;for(;;){const{done:n,value:i}=await this.read();if(n)return t.length?q(t):void 0;if(t.push(i),r+=i.length,r>=e){const r=q(t);return this.unshift(Y(r,e)),Y(r,0,e)}}},M.prototype.peekBytes=async function(e){const t=await this.readBytes(e);return this.unshift(t),t},M.prototype.unshift=function(...e){this[x]||(this[x]=[]),1===e.length&&v(e[0])&&this[x].length&&e[0].length&&this[x][0].byteOffset>=e[0].length?this[x][0]=new Uint8Array(this[x][0].buffer,this[x][0].byteOffset-e[0].length,this[x][0].byteLength+e[0].length):this[x].unshift(...e.filter((e=>e&&e.length)))},M.prototype.readToEnd=async function(e=q){const t=[];for(;;){const{done:e,value:r}=await this.read();if(e)break;t.push(r)}return e(t)};let K,C,{ReadableStream:D,WritableStream:I,TransformStream:U}=u;async function R(){if(U)return;const[e,t]=await Promise.all([Promise.resolve().then((function(){return Jf})),Promise.resolve().then((function(){return vd}))]);({ReadableStream:D,WritableStream:I,TransformStream:U}=e);const{createReadableStreamWrapper:r}=t;u.ReadableStream&&D!==u.ReadableStream&&(K=r(D),C=r(u.ReadableStream))}const B=g&&void 0;function T(e){let t=w(e);return"node"===t?S(e):"web"===t&&K?K(e):t?e:new D({start(t){t.enqueue(e),t.close()}})}function z(e){if(w(e))return e;const t=new p;return(async()=>{const r=O(t);await r.write(e),await r.close()})(),t}function q(e){return e.some((e=>w(e)&&!y(e)))?function(e){e=e.map(T);const t=N((async function(e){await Promise.all(n.map((t=>X(t,e))))}));let r=Promise.resolve();const n=e.map(((n,i)=>H(n,((n,a)=>(r=r.then((()=>L(n,t.writable,{preventClose:i!==e.length-1}))),r)))));return t.readable}(e):e.some((e=>y(e)))?function(e){const t=new p;let r=Promise.resolve();return e.forEach(((n,i)=>(r=r.then((()=>L(n,t,{preventClose:i!==e.length-1}))),r))),t}(e):"string"==typeof e[0]?e.join(""):B&&B.isBuffer(e[0])?B.concat(e):_(e)}function F(e){return new M(e)}function O(e){return new b(e)}async function L(e,t,{preventClose:r=!1,preventAbort:n=!1,preventCancel:i=!1}={}){if(w(e)&&!y(e)){e=T(e);try{if(e[x]){const r=O(t);for(let t=0;t<e[x].length;t++)await r.ready,await r.write(e[x][t]);r.releaseLock()}await e.pipeTo(t,{preventClose:r,preventAbort:n,preventCancel:i})}catch(e){}return}const a=F(e=z(e)),s=O(t);try{for(;;){await s.ready;const{done:e,value:t}=await a.read();if(e){r||await s.close();break}await s.write(t)}}catch(e){n||await s.abort(e)}finally{a.releaseLock(),s.releaseLock()}}function j(e,t){const r=new U(t);return L(e,r.writable),r.readable}function N(e){let t,r,n=!1;return{readable:new D({start(e){r=e},pull(){t?t():n=!0},cancel:e},{highWaterMark:0}),writable:new I({write:async function(e){r.enqueue(e),n?n=!1:(await new Promise((e=>{t=e})),t=null)},close:r.close.bind(r),abort:r.error.bind(r)})}}function W(e,t=(()=>{}),r=(()=>{})){if(y(e)){const n=new p;return(async()=>{const i=await Q(e),a=t(i),s=r();let o;o=void 0!==a&&void 0!==s?q([a,s]):void 0!==a?a:s;const c=O(n);await c.write(o),await c.close()})(),n}if(w(e))return j(e,{async transform(e,r){try{const n=await t(e);void 0!==n&&r.enqueue(n)}catch(e){r.error(e)}},async flush(e){try{const t=await r();void 0!==t&&e.enqueue(t)}catch(t){e.error(t)}}});const n=t(e),i=r();return void 0!==n&&void 0!==i?q([n,i]):void 0!==n?n:i}function H(e,t){if(w(e)&&!y(e)){let r;const n=new U({start(e){r=e}}),i=L(e,n.writable),a=N((async function(e){r.error(e),await i,await new Promise(setTimeout)}));return t(n.readable,a.writable),a.readable}e=z(e);const r=new p;return t(e,r),r}function G(e,t){let r;const n=H(e,((e,i)=>{const a=F(e);a.remainder=()=>(a.releaseLock(),L(e,i),n),r=t(a)}));return r}function V(e){if(y(e))return e.clone();if(w(e)){const t=function(e){if(y(e))throw Error("ArrayStream cannot be tee()d, use clone() instead");if(w(e)){const t=T(e).tee();return t[0][x]=t[1][x]=e[x],t}return[Y(e),Y(e)]}(e);return Z(e,t[0]),t[1]}return Y(e)}function $(e){return y(e)?V(e):w(e)?new D({start(t){const r=H(e,(async(e,r)=>{const n=F(e),i=O(r);try{for(;;){await i.ready;const{done:r,value:a}=await n.read();if(r){try{t.close()}catch(e){}return void await i.close()}try{t.enqueue(a)}catch(e){}await i.write(a)}}catch(e){t.error(e),await i.abort(e)}}));Z(e,r)}}):Y(e)}function Z(e,t){Object.entries(Object.getOwnPropertyDescriptors(e.constructor.prototype)).forEach((([r,n])=>{"constructor"!==r&&(n.value?n.value=n.value.bind(t):n.get=n.get.bind(t),Object.defineProperty(e,r,n))}))}function Y(e,t=0,r=1/0){if(y(e))throw Error("Not implemented");if(w(e)){if(t>=0&&r>=0){let n=0;return j(e,{transform(e,i){n<r?(n+e.length>=t&&i.enqueue(Y(e,Math.max(t-n,0),r-n)),n+=e.length):i.terminate()}})}if(t<0&&(r<0||r===1/0)){let n=[];return W(e,(e=>{e.length>=-t?n=[e]:n.push(e)}),(()=>Y(q(n),t,r)))}if(0===t&&r<0){let n;return W(e,(e=>{const i=n?q([n,e]):e;if(i.length>=-r)return n=Y(i,r),Y(i,t,r);n=i}))}return console.warn(`stream.slice(input, ${t}, ${r}) not implemented efficiently.`),J((async()=>Y(await Q(e),t,r)))}return e[x]&&(e=q(e[x].concat([e]))),!v(e)||B&&B.isBuffer(e)?e.slice(t,r):(r===1/0&&(r=e.length),e.subarray(t,r))}async function Q(e,t=q){return y(e)?e.readToEnd(t):w(e)?F(e).readToEnd(t):e}async function X(e,t){if(w(e)){if(e.cancel)return e.cancel(t);if(e.destroy)return e.destroy(t),await new Promise(setTimeout),t}}function J(e){const t=new p;return(async()=>{const r=O(t);try{await r.write(await e()),await r.close()}catch(e){await r.abort(e)}})(),t}class ee{constructor(e){if(void 0===e)throw Error("Invalid BigInteger input");if(e instanceof Uint8Array){const t=e,r=Array(t.length);for(let e=0;e<t.length;e++){const n=t[e].toString(16);r[e]=t[e]<=15?"0"+n:n}this.value=BigInt("0x0"+r.join(""))}else this.value=BigInt(e)}clone(){return new ee(this.value)}iinc(){return this.value++,this}inc(){return this.clone().iinc()}idec(){return this.value--,this}dec(){return this.clone().idec()}iadd(e){return this.value+=e.value,this}add(e){return this.clone().iadd(e)}isub(e){return this.value-=e.value,this}sub(e){return this.clone().isub(e)}imul(e){return this.value*=e.value,this}mul(e){return this.clone().imul(e)}imod(e){return this.value%=e.value,this.isNegative()&&this.iadd(e),this}mod(e){return this.clone().imod(e)}modExp(e,t){if(t.isZero())throw Error("Modulo cannot be zero");if(t.isOne())return new ee(0);if(e.isNegative())throw Error("Unsopported negative exponent");let r=e.value,n=this.value;n%=t.value;let i=BigInt(1);for(;r>BigInt(0);){const e=r&BigInt(1);r>>=BigInt(1);const a=i*n%t.value;i=e?a:i,n=n*n%t.value}return new ee(i)}modInv(e){const{gcd:t,x:r}=this._egcd(e);if(!t.isOne())throw Error("Inverse does not exist");return r.add(e).mod(e)}_egcd(e){let t=BigInt(0),r=BigInt(1),n=BigInt(1),i=BigInt(0),a=this.value;for(e=e.value;e!==BigInt(0);){const s=a/e;let o=t;t=n-s*t,n=o,o=r,r=i-s*r,i=o,o=e,e=a%e,a=o}return{x:new ee(n),y:new ee(i),gcd:new ee(a)}}gcd(e){let t=this.value;for(e=e.value;e!==BigInt(0);){const r=e;e=t%e,t=r}return new ee(t)}ileftShift(e){return this.value<<=e.value,this}leftShift(e){return this.clone().ileftShift(e)}irightShift(e){return this.value>>=e.value,this}rightShift(e){return this.clone().irightShift(e)}equal(e){return this.value===e.value}lt(e){return this.value<e.value}lte(e){return this.value<=e.value}gt(e){return this.value>e.value}gte(e){return this.value>=e.value}isZero(){return this.value===BigInt(0)}isOne(){return this.value===BigInt(1)}isNegative(){return this.value<BigInt(0)}isEven(){return!(this.value&BigInt(1))}abs(){const e=this.clone();return this.isNegative()&&(e.value=-e.value),e}toString(){return this.value.toString()}toNumber(){const e=Number(this.value);if(e>Number.MAX_SAFE_INTEGER)throw Error("Number can only safely store up to 53 bits");return e}getBit(e){return(this.value>>BigInt(e)&BigInt(1))===BigInt(0)?0:1}bitLength(){const e=new ee(0),t=new ee(1),r=new ee(-1),n=this.isNegative()?r:e;let i=1;const a=this.clone();for(;!a.irightShift(t).equal(n);)i++;return i}byteLength(){const e=new ee(0),t=new ee(-1),r=this.isNegative()?t:e,n=new ee(8);let i=1;const a=this.clone();for(;!a.irightShift(n).equal(r);)i++;return i}toUint8Array(e="be",t){let r=this.value.toString(16);r.length%2==1&&(r="0"+r);const n=r.length/2,i=new Uint8Array(t||n),a=t?t-n:0;let s=0;for(;s<n;)i[s+a]=parseInt(r.slice(2*s,2*s+2),16),s++;return"be"!==e&&i.reverse(),i}}const te=(()=>{try{return"development"===process.env.NODE_ENV}catch(e){}return!1})(),re={isString:function(e){return"string"==typeof e||String.prototype.isPrototypeOf(e)},isArray:function(e){return Array.prototype.isPrototypeOf(e)},isUint8Array:v,isStream:w,readNumber:function(e){let t=0;for(let r=0;r<e.length;r++)t+=256**r*e[e.length-1-r];return t},writeNumber:function(e,t){const r=new Uint8Array(t);for(let n=0;n<t;n++)r[n]=e>>8*(t-n-1)&255;return r},readDate:function(e){const t=re.readNumber(e);return new Date(1e3*t)},writeDate:function(e){const t=Math.floor(e.getTime()/1e3);return re.writeNumber(t,4)},normalizeDate:function(e=Date.now()){return null===e||e===1/0?e:new Date(1e3*Math.floor(+e/1e3))},readMPI:function(e){const t=7+(e[0]<<8|e[1])>>>3;return e.subarray(2,2+t)},leftPad(e,t){const r=new Uint8Array(t),n=t-e.length;return r.set(e,n),r},uint8ArrayToMPI:function(e){const t=re.uint8ArrayBitLength(e);if(0===t)throw Error("Zero MPI");const r=e.subarray(e.length-Math.ceil(t/8)),n=new Uint8Array([(65280&t)>>8,255&t]);return re.concatUint8Array([n,r])},uint8ArrayBitLength:function(e){let t;for(t=0;t<e.length&&0===e[t];t++);if(t===e.length)return 0;const r=e.subarray(t);return 8*(r.length-1)+re.nbits(r[0])},hexToUint8Array:function(e){const t=new Uint8Array(e.length>>1);for(let r=0;r<e.length>>1;r++)t[r]=parseInt(e.substr(r<<1,2),16);return t},uint8ArrayToHex:function(e){const t=[],r=e.length;let n,i=0;for(;i<r;){for(n=e[i++].toString(16);n.length<2;)n="0"+n;t.push(""+n)}return t.join("")},stringToUint8Array:function(e){return W(e,(e=>{if(!re.isString(e))throw Error("stringToUint8Array: Data must be in the form of a string");const t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}))},uint8ArrayToString:function(e){const t=[],r=16384,n=(e=new Uint8Array(e)).length;for(let i=0;i<n;i+=r)t.push(String.fromCharCode.apply(String,e.subarray(i,i+r<n?i+r:n)));return t.join("")},encodeUTF8:function(e){const t=new TextEncoder("utf-8");function r(e,r=!1){return t.encode(e,{stream:!r})}return W(e,r,(()=>r("",!0)))},decodeUTF8:function(e){const t=new TextDecoder("utf-8");function r(e,r=!1){return t.decode(e,{stream:!r})}return W(e,r,(()=>r(new Uint8Array,!0)))},concat:q,concatUint8Array:_,equalsUint8Array:function(e,t){if(!re.isUint8Array(e)||!re.isUint8Array(t))throw Error("Data must be in the form of a Uint8Array");if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0},writeChecksum:function(e){let t=0;for(let r=0;r<e.length;r++)t=t+e[r]&65535;return re.writeNumber(t,2)},printDebug:function(e){te&&console.log(e)},printDebugError:function(e){te&&console.error(e)},nbits:function(e){let t=1,r=e>>>16;return 0!==r&&(e=r,t+=16),r=e>>8,0!==r&&(e=r,t+=8),r=e>>4,0!==r&&(e=r,t+=4),r=e>>2,0!==r&&(e=r,t+=2),r=e>>1,0!==r&&(e=r,t+=1),t},double:function(e){const t=new Uint8Array(e.length),r=e.length-1;for(let n=0;n<r;n++)t[n]=e[n]<<1^e[n+1]>>7;return t[r]=e[r]<<1^135*(e[0]>>7),t},shiftRight:function(e,t){if(t)for(let r=e.length-1;r>=0;r--)e[r]>>=t,r>0&&(e[r]|=e[r-1]<<8-t);return e},getWebCrypto:function(){return void 0!==u&&u.crypto&&u.crypto.subtle},detectNode:function(){return"object"==typeof u.process&&"object"==typeof u.process.versions},detectBigInt:()=>"undefined"!=typeof BigInt,getBigInteger:async function(){if(re.detectBigInt())return ee;{const{default:e}=await Promise.resolve().then((function(){return Ed}));return e}},getNodeCrypto:function(){},getNodeZlib:function(){},getNodeBuffer:function(){return{}.Buffer},getHardwareConcurrency:function(){return re.detectNode()?(void 0).cpus().length:"undefined"!=typeof navigator&&navigator.hardwareConcurrency||1},isEmailAddress:function(e){return!!re.isString(e)&&/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+([a-zA-Z]{2,}|xn--[a-zA-Z\-0-9]+)))$/.test(e)},canonicalizeEOL:function(e){let t=!1;return W(e,(e=>{let r;t&&(e=re.concatUint8Array([new Uint8Array([13]),e])),13===e[e.length-1]?(t=!0,e=e.subarray(0,-1)):t=!1;const n=[];for(let t=0;r=e.indexOf(10,t)+1,r;t=r)13!==e[r-2]&&n.push(r);if(!n.length)return e;const i=new Uint8Array(e.length+n.length);let a=0;for(let t=0;t<n.length;t++){const r=e.subarray(n[t-1]||0,n[t]);i.set(r,a),a+=r.length,i[a-1]=13,i[a]=10,a++}return i.set(e.subarray(n[n.length-1]||0),a),i}),(()=>t?new Uint8Array([13]):void 0))},nativeEOL:function(e){let t=!1;return W(e,(e=>{let r;13===(e=t&&10!==e[0]?re.concatUint8Array([new Uint8Array([13]),e]):new Uint8Array(e))[e.length-1]?(t=!0,e=e.subarray(0,-1)):t=!1;let n=0;for(let t=0;t!==e.length;t=r){r=e.indexOf(13,t)+1,r||(r=e.length);const i=r-(10===e[r]?1:0);t&&e.copyWithin(n,t,i),n+=i-t}return e.subarray(0,n)}),(()=>t?new Uint8Array([13]):void 0))},removeTrailingSpaces:function(e){return e.split("\n").map((e=>{let t=e.length-1;for(;t>=0&&(" "===e[t]||"\t"===e[t]);t--);return e.substr(0,t+1)})).join("\n")},wrapError:function(e,t){if(!t)return Error(e);try{t.message=e+": "+t.message}catch(e){}return t},constructAllowedPackets:function(e){const t={};return e.forEach((e=>{if(!e.tag)throw Error("Invalid input: expected a packet class");t[e.tag]=e})),t},anyPromise:function(e){return new Promise((async(t,r)=>{let n;await Promise.all(e.map((async e=>{try{t(await e)}catch(e){n=e}}))),r(n)}))},selectUint8Array:function(e,t,r){const n=Math.max(t.length,r.length),i=new Uint8Array(n);let a=0;for(let n=0;n<i.length;n++)i[n]=t[n]&256-e|r[n]&255+e,a+=e&n<t.length|1-e&n<r.length;return i.subarray(0,a)},selectUint8:function(e,t,r){return t&256-e|r&255+e}},ne=re.getNodeBuffer();let ie,ae;function se(e){let t=new Uint8Array;return W(e,(e=>{t=re.concatUint8Array([t,e]);const r=[],n=Math.floor(t.length/45),i=45*n,a=ie(t.subarray(0,i));for(let e=0;e<n;e++)r.push(a.substr(60*e,60)),r.push("\n");return t=t.subarray(i),r.join("")}),(()=>t.length?ie(t)+"\n":""))}function oe(e){let t="";return W(e,(e=>{t+=e;let r=0;const n=[" ","\t","\r","\n"];for(let e=0;e<n.length;e++){const i=n[e];for(let e=t.indexOf(i);-1!==e;e=t.indexOf(i,e+1))r++}let i=t.length;for(;i>0&&(i-r)%4!=0;i--)n.includes(t[i])&&r--;const a=ae(t.substr(0,i));return t=t.substr(i),a}),(()=>ae(t)))}function ce(e){return oe(e.replace(/-/g,"+").replace(/_/g,"/"))}function ue(e,t){let r=se(e).replace(/[\r\n]/g,"");return t&&(r=r.replace(/[+]/g,"-").replace(/[/]/g,"_").replace(/[=]/g,"")),r}ne?(ie=e=>ne.from(e).toString("base64"),ae=e=>{const t=ne.from(e,"base64");return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}):(ie=e=>btoa(re.uint8ArrayToString(e)),ae=e=>re.stringToUint8Array(atob(e)));const he=Symbol("byValue");var fe={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:{rsaEncryptSign:1,rsaEncrypt:2,rsaSign:3,elgamal:16,dsa:17,ecdh:18,ecdsa:19,eddsa:22,aedh:23,aedsa:24},symmetric:{plaintext:0,idea:1,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,experimentalGCM:100},packet:{publicKeyEncryptedSessionKey:1,signature:2,symEncryptedSessionKey:3,onePassSignature:4,secretKey:5,publicKey:6,secretSubkey:7,compressedData:8,symmetricallyEncryptedData:9,marker:10,literalData:11,trust:12,userID:13,publicSubkey:14,userAttribute:17,symEncryptedIntegrityProtectedData:18,modificationDetectionCode:19,aeadEncryptedData:20},literal:{binary:98,text:116,utf8:117,mime:109},signature:{binary:0,text:1,standalone:2,certGeneric:16,certPersona:17,certCasual:18,certPositive:19,certRevocation:48,subkeyBinding:24,keyBinding:25,key:31,keyRevocation:32,subkeyRevocation:40,timestamp:64,thirdParty:80},signatureSubpacket:{signatureCreationTime:2,signatureExpirationTime:3,exportableCertification:4,trustSignature:5,regularExpression:6,revocable:7,keyExpirationTime:9,placeholderBackwardsCompatibility:10,preferredSymmetricAlgorithms:11,revocationKey:12,issuer:16,notationData:20,preferredHashAlgorithms:21,preferredCompressionAlgorithms:22,keyServerPreferences:23,preferredKeyServer:24,primaryUserID:25,policyURI:26,keyFlags:27,signersUserID:28,reasonForRevocation:29,features:30,signatureTarget:31,embeddedSignature:32,issuerFingerprint:33,preferredAEADAlgorithms:34},keyFlags:{certifyKeys:1,signData:2,encryptCommunication:4,encryptStorage:8,splitPrivateKey:16,authentication:32,sharedPrivateKey:128},armor:{multipartSection:0,multipartLast:1,signed:2,message:3,publicKey:4,privateKey:5,signature:6},reasonForRevocation:{noReason:0,keySuperseded:1,keyCompromised:2,keyRetired:3,userIDInvalid:32},features:{modificationDetection:1,aead:2,v5Keys:4},write:function(e,t){if("number"==typeof t&&(t=this.read(e,t)),void 0!==e[t])return e[t];throw Error("Invalid enum value.")},read:function(e,t){if(e[he]||(e[he]=[],Object.entries(e).forEach((([t,r])=>{e[he][r]=t}))),void 0!==e[he][t])return e[he][t];throw Error("Invalid enum value.")}},de={preferredHashAlgorithm:fe.hash.sha256,preferredSymmetricAlgorithm:fe.symmetric.aes256,preferredCompressionAlgorithm:fe.compression.uncompressed,deflateLevel:6,aeadProtect:!1,preferredAEADAlgorithm:fe.aead.eax,aeadChunkSizeByte:12,v5Keys:!1,s2kIterationCountByte:224,allowUnauthenticatedMessages:!1,allowUnauthenticatedStream:!1,checksumRequired:!1,minRSABits:2047,passwordCollisionCheck:!1,revocationsExpire:!1,allowInsecureDecryptionWithSigningKeys:!1,allowInsecureVerificationWithReformattedKeys:!1,constantTimePKCS1Decryption:!1,constantTimePKCS1DecryptionSupportedSymmetricAlgorithms:new Set([fe.symmetric.aes128,fe.symmetric.aes192,fe.symmetric.aes256]),minBytesForWebCrypto:1e3,ignoreUnsupportedPackets:!0,ignoreMalformedPackets:!1,showVersion:!1,showComment:!1,versionString:"OpenPGP.js 5.2.1",commentString:"https://openpgpjs.org",maxUserIDLength:5120,knownNotations:["preferred-email-encoding@pgp.com","pka-address@gnupg.org"],useIndutnyElliptic:!0,rejectHashAlgorithms:new Set([fe.hash.md5,fe.hash.ripemd]),rejectMessageHashAlgorithms:new Set([fe.hash.md5,fe.hash.ripemd,fe.hash.sha1]),rejectPublicKeyAlgorithms:new Set([fe.publicKey.elgamal,fe.publicKey.dsa]),rejectCurves:new Set([fe.curve.brainpoolP256r1,fe.curve.brainpoolP384r1,fe.curve.brainpoolP512r1,fe.curve.secp256k1])};function le(e){const t=e.match(/^-----BEGIN PGP (MESSAGE, PART \d+\/\d+|MESSAGE, PART \d+|SIGNED MESSAGE|MESSAGE|PUBLIC KEY BLOCK|PRIVATE KEY BLOCK|SIGNATURE)-----$/m);if(!t)throw Error("Unknown ASCII armor type");return/MESSAGE, PART \d+\/\d+/.test(t[1])?fe.armor.multipartSection:/MESSAGE, PART \d+/.test(t[1])?fe.armor.multipartLast:/SIGNED MESSAGE/.test(t[1])?fe.armor.signed:/MESSAGE/.test(t[1])?fe.armor.message:/PUBLIC KEY BLOCK/.test(t[1])?fe.armor.publicKey:/PRIVATE KEY BLOCK/.test(t[1])?fe.armor.privateKey:/SIGNATURE/.test(t[1])?fe.armor.signature:void 0}function pe(e,t){let r="";return t.showVersion&&(r+="Version: "+t.versionString+"\n"),t.showComment&&(r+="Comment: "+t.commentString+"\n"),e&&(r+="Comment: "+e+"\n"),r+="\n",r}function ye(e){return se(function(e){let t=13501623;return W(e,(e=>{const r=ge?Math.floor(e.length/4):0,n=new Uint32Array(e.buffer,e.byteOffset,r);for(let e=0;e<r;e++)t^=n[e],t=be[0][t>>24&255]^be[1][t>>16&255]^be[2][t>>8&255]^be[3][t>>0&255];for(let n=4*r;n<e.length;n++)t=t>>8^be[0][255&t^e[n]]}),(()=>new Uint8Array([t,t>>8,t>>16])))}(e))}const be=[Array(255),Array(255),Array(255),Array(255)];for(let e=0;e<=255;e++){let t=e<<16;for(let e=0;e<8;e++)t=t<<1^(0!=(8388608&t)?8801531:0);be[0][e]=(16711680&t)>>16|65280&t|(255&t)<<16}for(let e=0;e<=255;e++)be[1][e]=be[0][e]>>8^be[0][255&be[0][e]];for(let e=0;e<=255;e++)be[2][e]=be[1][e]>>8^be[0][255&be[1][e]];for(let e=0;e<=255;e++)be[3][e]=be[2][e]>>8^be[0][255&be[2][e]];const ge=function(){const e=new ArrayBuffer(2);return new DataView(e).setInt16(0,255,!0),255===new Int16Array(e)[0]}();function me(e){for(let t=0;t<e.length;t++){if(!/^([^\s:]|[^\s:][^:]*[^\s:]): .+$/.test(e[t]))throw Error("Improperly formatted armor header: "+e[t]);/^(Version|Comment|MessageID|Hash|Charset): .+$/.test(e[t])||re.printDebugError(Error("Unknown header: "+e[t]))}}function we(e){let t=e,r="";const n=e.lastIndexOf("=");return n>=0&&n!==e.length-1&&(t=e.slice(0,n),r=e.slice(n+1).substr(0,4)),{body:t,checksum:r}}function ve(e,t=de){return new Promise((async(r,n)=>{try{const i=/^-----[^-]+-----$/m,a=/^[ \f\r\t\u00a0\u2000-\u200a\u202f\u205f\u3000]*$/;let s;const o=[];let c,u,h,f=o,d=[],l=oe(H(e,(async(e,t)=>{const p=F(e);try{for(;;){let e=await p.readLine();if(void 0===e)throw Error("Misformed armored text");if(e=re.removeTrailingSpaces(e.replace(/[\r\n]/g,"")),s)if(c)u||2!==s||(i.test(e)?(d=d.join("\r\n"),u=!0,me(f),f=[],c=!1):d.push(e.replace(/^- /,"")));else if(i.test(e)&&n(Error("Mandatory blank line missing between armor headers and armor data")),a.test(e)){if(me(f),c=!0,u||2!==s){r({text:d,data:l,headers:o,type:s});break}}else f.push(e);else i.test(e)&&(s=le(e))}}catch(e){return void n(e)}const y=O(t);try{for(;;){await y.ready;const{done:e,value:t}=await p.read();if(e)throw Error("Misformed armored text");const r=t+"";if(-1!==r.indexOf("=")||-1!==r.indexOf("-")){let e=await p.readToEnd();e.length||(e=""),e=r+e,e=re.removeTrailingSpaces(e.replace(/\r/g,""));const t=e.split(i);if(1===t.length)throw Error("Misformed armored text");const n=we(t[0].slice(0,-1));h=n.checksum,await y.write(n.body);break}await y.write(r)}await y.ready,await y.close()}catch(e){await y.abort(e)}})));l=H(l,(async(e,r)=>{const n=Q(ye($(e)));n.catch((()=>{})),await L(e,r,{preventClose:!0});const i=O(r);try{const e=(await n).replace("\n","");if(h!==e&&(h||t.checksumRequired))throw Error("Ascii armor integrity check failed");await i.ready,await i.close()}catch(e){await i.abort(e)}}))}catch(e){n(e)}})).then((async e=>(y(e.data)&&(e.data=await Q(e.data)),e)))}function _e(e,t,r,n,i,a=de){let s,o;e===fe.armor.signed&&(s=t.text,o=t.hash,t=t.data);const c=$(t),u=[];switch(e){case fe.armor.multipartSection:u.push("-----BEGIN PGP MESSAGE, PART "+r+"/"+n+"-----\n"),u.push(pe(i,a)),u.push(se(t)),u.push("=",ye(c)),u.push("-----END PGP MESSAGE, PART "+r+"/"+n+"-----\n");break;case fe.armor.multipartLast:u.push("-----BEGIN PGP MESSAGE, PART "+r+"-----\n"),u.push(pe(i,a)),u.push(se(t)),u.push("=",ye(c)),u.push("-----END PGP MESSAGE, PART "+r+"-----\n");break;case fe.armor.signed:u.push("\n-----BEGIN PGP SIGNED MESSAGE-----\n"),u.push("Hash: "+o+"\n\n"),u.push(s.replace(/^-/gm,"- -")),u.push("\n-----BEGIN PGP SIGNATURE-----\n"),u.push(pe(i,a)),u.push(se(t)),u.push("=",ye(c)),u.push("-----END PGP SIGNATURE-----\n");break;case fe.armor.message:u.push("-----BEGIN PGP MESSAGE-----\n"),u.push(pe(i,a)),u.push(se(t)),u.push("=",ye(c)),u.push("-----END PGP MESSAGE-----\n");break;case fe.armor.publicKey:u.push("-----BEGIN PGP PUBLIC KEY BLOCK-----\n"),u.push(pe(i,a)),u.push(se(t)),u.push("=",ye(c)),u.push("-----END PGP PUBLIC KEY BLOCK-----\n");break;case fe.armor.privateKey:u.push("-----BEGIN PGP PRIVATE KEY BLOCK-----\n"),u.push(pe(i,a)),u.push(se(t)),u.push("=",ye(c)),u.push("-----END PGP PRIVATE KEY BLOCK-----\n");break;case fe.armor.signature:u.push("-----BEGIN PGP SIGNATURE-----\n"),u.push(pe(i,a)),u.push(se(t)),u.push("=",ye(c)),u.push("-----END PGP SIGNATURE-----\n")}return re.concat(u)}class ke{constructor(){this.bytes=""}read(e){this.bytes=re.uint8ArrayToString(e.subarray(0,8))}write(){return re.stringToUint8Array(this.bytes)}toHex(){return re.uint8ArrayToHex(re.stringToUint8Array(this.bytes))}equals(e,t=!1){return t&&(e.isWildcard()||this.isWildcard())||this.bytes===e.bytes}isNull(){return""===this.bytes}isWildcard(){return/^0+$/.test(this.toHex())}static mapToHex(e){return e.toHex()}static fromID(e){const t=new ke;return t.read(re.hexToUint8Array(e)),t}static wildcard(){const e=new ke;return e.read(new Uint8Array(8)),e}}var Ae=function(){var e,t,r=!1;function n(r,n){var i=e[(t[r]+t[n])%255];return 0!==r&&0!==n||(i=0),i}var i,a,s,o,c=!1;function u(){function u(r){var n,i,a;for(i=a=function(r){var n=e[255-t[r]];return 0===r&&(n=0),n}(r),n=0;n<4;n++)a^=i=255&(i<<1|i>>>7);return 99^a}r||function(){e=[],t=[];var n,i,a=1;for(n=0;n<255;n++)e[n]=a,i=128&a,a<<=1,a&=255,128===i&&(a^=27),a^=e[n],t[e[n]]=n;e[255]=e[0],t[0]=0,r=!0}(),i=[],a=[],s=[[],[],[],[]],o=[[],[],[],[]];for(var h=0;h<256;h++){var f=u(h);i[h]=f,a[f]=h,s[0][h]=n(2,f)<<24|f<<16|f<<8|n(3,f),o[0][f]=n(14,h)<<24|n(9,h)<<16|n(13,h)<<8|n(11,h);for(var d=1;d<4;d++)s[d][h]=s[d-1][h]>>>8|s[d-1][h]<<24,o[d][f]=o[d-1][f]>>>8|o[d-1][f]<<24}c=!0}var h=function(e,t){c||u();var r=new Uint32Array(t);r.set(i,512),r.set(a,768);for(var n=0;n<4;n++)r.set(s[n],4096+1024*n>>2),r.set(o[n],8192+1024*n>>2);var h=function(e,t,r){"use asm";var n=0,i=0,a=0,s=0,o=0,c=0,u=0,h=0,f=0,d=0,l=0,p=0,y=0,b=0,g=0,m=0,w=0,v=0,_=0,k=0,A=0;var S=new e.Uint32Array(r),E=new e.Uint8Array(r);function P(e,t,r,o,c,u,h,f){e=e|0;t=t|0;r=r|0;o=o|0;c=c|0;u=u|0;h=h|0;f=f|0;var d=0,l=0,p=0,y=0,b=0,g=0,m=0,w=0;d=r|0x400,l=r|0x800,p=r|0xc00;c=c^S[(e|0)>>2],u=u^S[(e|4)>>2],h=h^S[(e|8)>>2],f=f^S[(e|12)>>2];for(w=16;(w|0)<=o<<4;w=w+16|0){y=S[(r|c>>22&1020)>>2]^S[(d|u>>14&1020)>>2]^S[(l|h>>6&1020)>>2]^S[(p|f<<2&1020)>>2]^S[(e|w|0)>>2],b=S[(r|u>>22&1020)>>2]^S[(d|h>>14&1020)>>2]^S[(l|f>>6&1020)>>2]^S[(p|c<<2&1020)>>2]^S[(e|w|4)>>2],g=S[(r|h>>22&1020)>>2]^S[(d|f>>14&1020)>>2]^S[(l|c>>6&1020)>>2]^S[(p|u<<2&1020)>>2]^S[(e|w|8)>>2],m=S[(r|f>>22&1020)>>2]^S[(d|c>>14&1020)>>2]^S[(l|u>>6&1020)>>2]^S[(p|h<<2&1020)>>2]^S[(e|w|12)>>2];c=y,u=b,h=g,f=m}n=S[(t|c>>22&1020)>>2]<<24^S[(t|u>>14&1020)>>2]<<16^S[(t|h>>6&1020)>>2]<<8^S[(t|f<<2&1020)>>2]^S[(e|w|0)>>2],i=S[(t|u>>22&1020)>>2]<<24^S[(t|h>>14&1020)>>2]<<16^S[(t|f>>6&1020)>>2]<<8^S[(t|c<<2&1020)>>2]^S[(e|w|4)>>2],a=S[(t|h>>22&1020)>>2]<<24^S[(t|f>>14&1020)>>2]<<16^S[(t|c>>6&1020)>>2]<<8^S[(t|u<<2&1020)>>2]^S[(e|w|8)>>2],s=S[(t|f>>22&1020)>>2]<<24^S[(t|c>>14&1020)>>2]<<16^S[(t|u>>6&1020)>>2]<<8^S[(t|h<<2&1020)>>2]^S[(e|w|12)>>2]}function x(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;P(0x0000,0x0800,0x1000,A,e,t,r,n)}function M(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;var a=0;P(0x0400,0x0c00,0x2000,A,e,n,r,t);a=i,i=s,s=a}function K(e,t,r,f){e=e|0;t=t|0;r=r|0;f=f|0;P(0x0000,0x0800,0x1000,A,o^e,c^t,u^r,h^f);o=n,c=i,u=a,h=s}function C(e,t,r,f){e=e|0;t=t|0;r=r|0;f=f|0;var d=0;P(0x0400,0x0c00,0x2000,A,e,f,r,t);d=i,i=s,s=d;n=n^o,i=i^c,a=a^u,s=s^h;o=e,c=t,u=r,h=f}function D(e,t,r,f){e=e|0;t=t|0;r=r|0;f=f|0;P(0x0000,0x0800,0x1000,A,o,c,u,h);o=n=n^e,c=i=i^t,u=a=a^r,h=s=s^f}function I(e,t,r,f){e=e|0;t=t|0;r=r|0;f=f|0;P(0x0000,0x0800,0x1000,A,o,c,u,h);n=n^e,i=i^t,a=a^r,s=s^f;o=e,c=t,u=r,h=f}function U(e,t,r,f){e=e|0;t=t|0;r=r|0;f=f|0;P(0x0000,0x0800,0x1000,A,o,c,u,h);o=n,c=i,u=a,h=s;n=n^e,i=i^t,a=a^r,s=s^f}function R(e,t,r,o){e=e|0;t=t|0;r=r|0;o=o|0;P(0x0000,0x0800,0x1000,A,f,d,l,p);p=~m&p|m&p+1;l=~g&l|g&l+((p|0)==0);d=~b&d|b&d+((l|0)==0);f=~y&f|y&f+((d|0)==0);n=n^e;i=i^t;a=a^r;s=s^o}function B(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;var i=0,a=0,s=0,f=0,d=0,l=0,p=0,y=0,b=0,g=0;e=e^o,t=t^c,r=r^u,n=n^h;i=w|0,a=v|0,s=_|0,f=k|0;for(;(b|0)<128;b=b+1|0){if(i>>>31){d=d^e,l=l^t,p=p^r,y=y^n}i=i<<1|a>>>31,a=a<<1|s>>>31,s=s<<1|f>>>31,f=f<<1;g=n&1;n=n>>>1|r<<31,r=r>>>1|t<<31,t=t>>>1|e<<31,e=e>>>1;if(g)e=e^0xe1000000}o=d,c=l,u=p,h=y}function T(e){e=e|0;A=e}function z(e,t,r,o){e=e|0;t=t|0;r=r|0;o=o|0;n=e,i=t,a=r,s=o}function q(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;o=e,c=t,u=r,h=n}function F(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;f=e,d=t,l=r,p=n}function O(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;y=e,b=t,g=r,m=n}function L(e,t,r,n){e=e|0;t=t|0;r=r|0;n=n|0;p=~m&p|m&n,l=~g&l|g&r,d=~b&d|b&t,f=~y&f|y&e}function j(e){e=e|0;if(e&15)return-1;E[e|0]=n>>>24,E[e|1]=n>>>16&255,E[e|2]=n>>>8&255,E[e|3]=n&255,E[e|4]=i>>>24,E[e|5]=i>>>16&255,E[e|6]=i>>>8&255,E[e|7]=i&255,E[e|8]=a>>>24,E[e|9]=a>>>16&255,E[e|10]=a>>>8&255,E[e|11]=a&255,E[e|12]=s>>>24,E[e|13]=s>>>16&255,E[e|14]=s>>>8&255,E[e|15]=s&255;return 16}function N(e){e=e|0;if(e&15)return-1;E[e|0]=o>>>24,E[e|1]=o>>>16&255,E[e|2]=o>>>8&255,E[e|3]=o&255,E[e|4]=c>>>24,E[e|5]=c>>>16&255,E[e|6]=c>>>8&255,E[e|7]=c&255,E[e|8]=u>>>24,E[e|9]=u>>>16&255,E[e|10]=u>>>8&255,E[e|11]=u&255,E[e|12]=h>>>24,E[e|13]=h>>>16&255,E[e|14]=h>>>8&255,E[e|15]=h&255;return 16}function W(){x(0,0,0,0);w=n,v=i,_=a,k=s}function H(e,t,r){e=e|0;t=t|0;r=r|0;var o=0;if(t&15)return-1;while((r|0)>=16){V[e&7](E[t|0]<<24|E[t|1]<<16|E[t|2]<<8|E[t|3],E[t|4]<<24|E[t|5]<<16|E[t|6]<<8|E[t|7],E[t|8]<<24|E[t|9]<<16|E[t|10]<<8|E[t|11],E[t|12]<<24|E[t|13]<<16|E[t|14]<<8|E[t|15]);E[t|0]=n>>>24,E[t|1]=n>>>16&255,E[t|2]=n>>>8&255,E[t|3]=n&255,E[t|4]=i>>>24,E[t|5]=i>>>16&255,E[t|6]=i>>>8&255,E[t|7]=i&255,E[t|8]=a>>>24,E[t|9]=a>>>16&255,E[t|10]=a>>>8&255,E[t|11]=a&255,E[t|12]=s>>>24,E[t|13]=s>>>16&255,E[t|14]=s>>>8&255,E[t|15]=s&255;o=o+16|0,t=t+16|0,r=r-16|0}return o|0}function G(e,t,r){e=e|0;t=t|0;r=r|0;var n=0;if(t&15)return-1;while((r|0)>=16){$[e&1](E[t|0]<<24|E[t|1]<<16|E[t|2]<<8|E[t|3],E[t|4]<<24|E[t|5]<<16|E[t|6]<<8|E[t|7],E[t|8]<<24|E[t|9]<<16|E[t|10]<<8|E[t|11],E[t|12]<<24|E[t|13]<<16|E[t|14]<<8|E[t|15]);n=n+16|0,t=t+16|0,r=r-16|0}return n|0}var V=[x,M,K,C,D,I,U,R];var $=[K,B];return{set_rounds:T,set_state:z,set_iv:q,set_nonce:F,set_mask:O,set_counter:L,get_state:j,get_iv:N,gcm_init:W,cipher:H,mac:G}}({Uint8Array:Uint8Array,Uint32Array:Uint32Array},e,t);return h.set_key=function(e,t,n,a,s,c,u,f,d){var l=r.subarray(0,60),p=r.subarray(256,316);l.set([t,n,a,s,c,u,f,d]);for(var y=e,b=1;y<4*e+28;y++){var g=l[y-1];(y%e==0||8===e&&y%e==4)&&(g=i[g>>>24]<<24^i[g>>>16&255]<<16^i[g>>>8&255]<<8^i[255&g]),y%e==0&&(g=g<<8^g>>>24^b<<24,b=b<<1^(128&b?27:0)),l[y]=l[y-e]^g}for(var m=0;m<y;m+=4)for(var w=0;w<4;w++)g=l[y-(4+m)+(4-w)%4],p[m+w]=m<4||m>=y-4?g:o[0][i[g>>>24]]^o[1][i[g>>>16&255]]^o[2][i[g>>>8&255]]^o[3][i[255&g]];h.set_rounds(e+5)},h};return h.ENC={ECB:0,CBC:2,CFB:4,OFB:6,CTR:7},h.DEC={ECB:1,CBC:3,CFB:5,OFB:6,CTR:7},h.MAC={CBC:0,GCM:1},h.HEAP_DATA=16384,h}();function Se(e){return e instanceof Uint8Array}function Ee(e,t){const r=e?e.byteLength:t||65536;if(4095&r||r<=0)throw Error("heap size must be a positive integer and a multiple of 4096");return e||new Uint8Array(new ArrayBuffer(r))}function Pe(e,t,r,n,i){const a=e.length-t,s=a<i?a:i;return e.set(r.subarray(n,n+s),t),s}function xe(...e){const t=e.reduce(((e,t)=>e+t.length),0),r=new Uint8Array(t);let n=0;for(let t=0;t<e.length;t++)r.set(e[t],n),n+=e[t].length;return r}class Me extends Error{constructor(...e){super(...e)}}class Ke extends Error{constructor(...e){super(...e)}}class Ce extends Error{constructor(...e){super(...e)}}const De=[],Ie=[];class Ue{constructor(e,t,r=!0,n,i,a){this.pos=0,this.len=0,this.mode=n,this.pos=0,this.len=0,this.key=e,this.iv=t,this.padding=r,this.acquire_asm(i,a)}acquire_asm(e,t){return void 0!==this.heap&&void 0!==this.asm||(this.heap=e||De.pop()||Ee().subarray(Ae.HEAP_DATA),this.asm=t||Ie.pop()||new Ae(null,this.heap.buffer),this.reset(this.key,this.iv)),{heap:this.heap,asm:this.asm}}release_asm(){void 0!==this.heap&&void 0!==this.asm&&(De.push(this.heap),Ie.push(this.asm)),this.heap=void 0,this.asm=void 0}reset(e,t){const{asm:r}=this.acquire_asm(),n=e.length;if(16!==n&&24!==n&&32!==n)throw new Ke("illegal key size");const i=new DataView(e.buffer,e.byteOffset,e.byteLength);if(r.set_key(n>>2,i.getUint32(0),i.getUint32(4),i.getUint32(8),i.getUint32(12),n>16?i.getUint32(16):0,n>16?i.getUint32(20):0,n>24?i.getUint32(24):0,n>24?i.getUint32(28):0),void 0!==t){if(16!==t.length)throw new Ke("illegal iv size");let e=new DataView(t.buffer,t.byteOffset,t.byteLength);r.set_iv(e.getUint32(0),e.getUint32(4),e.getUint32(8),e.getUint32(12))}else r.set_iv(0,0,0,0)}AES_Encrypt_process(e){if(!Se(e))throw new TypeError("data isn't of expected type");let{heap:t,asm:r}=this.acquire_asm(),n=Ae.ENC[this.mode],i=Ae.HEAP_DATA,a=this.pos,s=this.len,o=0,c=e.length||0,u=0,h=0,f=new Uint8Array(s+c&-16);for(;c>0;)h=Pe(t,a+s,e,o,c),s+=h,o+=h,c-=h,h=r.cipher(n,i+a,s),h&&f.set(t.subarray(a,a+h),u),u+=h,h<s?(a+=h,s-=h):(a=0,s=0);return this.pos=a,this.len=s,f}AES_Encrypt_finish(){let{heap:e,asm:t}=this.acquire_asm(),r=Ae.ENC[this.mode],n=Ae.HEAP_DATA,i=this.pos,a=this.len,s=16-a%16,o=a;if(this.hasOwnProperty("padding")){if(this.padding){for(let t=0;t<s;++t)e[i+a+t]=s;a+=s,o=a}else if(a%16)throw new Ke("data length must be a multiple of the block size")}else a+=s;const c=new Uint8Array(o);return a&&t.cipher(r,n+i,a),o&&c.set(e.subarray(i,i+o)),this.pos=0,this.len=0,this.release_asm(),c}AES_Decrypt_process(e){if(!Se(e))throw new TypeError("data isn't of expected type");let{heap:t,asm:r}=this.acquire_asm(),n=Ae.DEC[this.mode],i=Ae.HEAP_DATA,a=this.pos,s=this.len,o=0,c=e.length||0,u=0,h=s+c&-16,f=0,d=0;this.padding&&(f=s+c-h||16,h-=f);const l=new Uint8Array(h);for(;c>0;)d=Pe(t,a+s,e,o,c),s+=d,o+=d,c-=d,d=r.cipher(n,i+a,s-(c?0:f)),d&&l.set(t.subarray(a,a+d),u),u+=d,d<s?(a+=d,s-=d):(a=0,s=0);return this.pos=a,this.len=s,l}AES_Decrypt_finish(){let{heap:e,asm:t}=this.acquire_asm(),r=Ae.DEC[this.mode],n=Ae.HEAP_DATA,i=this.pos,a=this.len,s=a;if(a>0){if(a%16){if(this.hasOwnProperty("padding"))throw new Ke("data length must be a multiple of the block size");a+=16-a%16}if(t.cipher(r,n+i,a),this.hasOwnProperty("padding")&&this.padding){let t=e[i+s-1];if(t<1||t>16||t>s)throw new Ce("bad padding");let r=0;for(let n=t;n>1;n--)r|=t^e[i+s-n];if(r)throw new Ce("bad padding");s-=t}}const o=new Uint8Array(s);return s>0&&o.set(e.subarray(i,i+s)),this.pos=0,this.len=0,this.release_asm(),o}}class Re{static encrypt(e,t,r=!1){return new Re(t,r).encrypt(e)}static decrypt(e,t,r=!1){return new Re(t,r).decrypt(e)}constructor(e,t=!1,r){this.aes=r||new Ue(e,void 0,t,"ECB")}encrypt(e){return xe(this.aes.AES_Encrypt_process(e),this.aes.AES_Encrypt_finish())}decrypt(e){return xe(this.aes.AES_Decrypt_process(e),this.aes.AES_Decrypt_finish())}}function Be(e){const t=function(e){const t=new Re(e);this.encrypt=function(e){return t.encrypt(e)},this.decrypt=function(e){return t.decrypt(e)}};return t.blockSize=t.prototype.blockSize=16,t.keySize=t.prototype.keySize=e/8,t}function Te(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],c=[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],u=[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],h=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,