158 lines
1002 KiB
JavaScript
158 lines
1002 KiB
JavaScript
|
/**
|
|||
|
* CyberChef - The Cyber Swiss Army Knife
|
|||
|
*
|
|||
|
* @copyright Crown Copyright 2016
|
|||
|
* @license Apache-2.0
|
|||
|
*
|
|||
|
* Copyright 2016 Crown Copyright
|
|||
|
*
|
|||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|||
|
* you may not use this file except in compliance with the License.
|
|||
|
* You may obtain a copy of the License at
|
|||
|
*
|
|||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|||
|
*
|
|||
|
* Unless required by applicable law or agreed to in writing, software
|
|||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||
|
* See the License for the specific language governing permissions and
|
|||
|
* limitations under the License.
|
|||
|
*/!function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1506)}([function(e,t,r){"use strict";var n=r(15),i=r.n(n),o=r(10),s=r(7),a=r(19),u=r(18);function f(e,t,r,n,i,o,s){try{var a=e[o](s),u=a.value}catch(e){return void r(e)}a.done?t(u):Promise.resolve(u).then(n,i)}function c(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function s(e){f(o,n,i,s,a,"next",e)}function a(e){f(o,n,i,s,a,"throw",e)}s(void 0)})}}function h(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)}}
|
|||
|
/**
|
|||
|
* @author n1474335 [n1474335@gmail.com]
|
|||
|
* @copyright Crown Copyright 2016
|
|||
|
* @license Apache-2.0
|
|||
|
*/
|
|||
|
var l=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,r,n;return t=e,r=null,n=[{key:"chr",value:function(e){if(e>65535){e-=65536;var t=String.fromCharCode(e>>>10&1023|55296);return e=56320|1023&e,t+String.fromCharCode(e)}return String.fromCharCode(e)}},{key:"ord",value:function(e){if(2===e.length){var t=e.charCodeAt(0),r=e.charCodeAt(1);if(t>=55296&&t<56320&&r>=56320&&r<57344)return 1024*(t-55296)+r-56320+65536}return e.charCodeAt(0)}},{key:"padBytesRight",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=new Array(t);return n.fill(r),Array.prototype.map.call(e,function(e,t){n[t]=e}),n}},{key:"truncate",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"...";return e.length>t&&(e=e.slice(0,t-r.length)+r),e}},{key:"hex",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return(t="string"==typeof t?e.ord(t):t).toString(16).padStart(r,"0")}},{key:"bin",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return(t="string"==typeof t?e.ord(t):t).toString(2).padStart(r,"0")}},{key:"printable",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"object"==typeof window&&window.app&&!window.app.options.treatAsUtf8&&(t=e.byteArrayToChars(e.strToByteArray(t)));return t=t.replace(/[\0-\x08\x0B-\x0C\x0E-\x1F\x7F-\x9F\xAD\u0378\u0379\u037F-\u0383\u038B\u038D\u03A2\u0528-\u0530\u0557\u0558\u0560\u0588\u058B-\u058E\u0590\u05C8-\u05CF\u05EB-\u05EF\u05F5-\u0605\u061C\u061D\u06DD\u070E\u070F\u074B\u074C\u07B2-\u07BF\u07FB-\u07FF\u082E\u082F\u083F\u085C\u085D\u085F-\u089F\u08A1\u08AD-\u08E3\u08FF\u0978\u0980\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA\u09BB\u09C5\u09C6\u09C9\u09CA\u09CF-\u09D6\u09D8-\u09DB\u09DE\u09E4\u09E5\u09FC-\u0A00\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A\u0A3B\u0A3D\u0A43-\u0A46\u0A49\u0A4A\u0A4E-\u0A50\u0A52-\u0A58\u0A5D\u0A5F-\u0A65\u0A76-\u0A80\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA\u0ABB\u0AC6\u0ACA\u0ACE\u0ACF\u0AD1-\u0ADF\u0AE4\u0AE5\u0AF2-\u0B00\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A\u0B3B\u0B45\u0B46\u0B49\u0B4A\u0B4E-\u0B55\u0B58-\u0B5B\u0B5E\u0B64\u0B65\u0B78-\u0B81\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BBD\u0BC3-\u0BC5\u0BC9\u0BCE\u0BCF\u0BD1-\u0BD6\u0BD8-\u0BE5\u0BFB-\u0C00\u0C04\u0C0D\u0C11\u0C29\u0C34\u0C3A-\u0C3C\u0C45\u0C49\u0C4E-\u0C54\u0C57\u0C5A-\u0C5F\u0C64\u0C65\u0C70-\u0C77\u0C80\u0C81\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA\u0CBB\u0CC5\u0CC9\u0CCE-\u0CD4\u0CD7-\u0CDD\u0CDF\u0CE4\u0CE5\u0CF0\u0CF3-\u0D01\u0D04\u0D0D\u0D11\u0D3B\u0D3C\u0D45\u0D49\u0D4F-\u0D56\u0D58-\u0D5F\u0D64\u0D65\u0D76-\u0D78\u0D80\u0D81\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DF1\u0DF5-\u0E00\u0E3B-\u0E3E\u0E5C-\u0E80\u0E83\u0E85\u0E86\u0E89\u0E8B\u0E8C\u0E8E-\u0E93\u0E98\u0EA0\u0EA4\u0EA6\u0EA8\u0EA9\u0EAC\u0EBA\u0EBE\u0EBF\u0EC5\u0EC7\u0ECE\u0ECF\u0EDA\u0EDB\u0EE0-\u0EFF\u0F48\u0F6D-\u0F70\u0F98\u0FBD\u0FCD\u0FDB-\u0FFF\u10C6\u10C8-\u10CC\u10CE\u10CF\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B\u135C\u137D-\u137F\u139A-\u139F\u13F5-\u13FF\u169D-\u169F\u16F1-\u16FF\u170D\u1715-\u171F\u1737-\u173F\u1754-\u175F\u176D\u1771\u1774-\u177F\u17DE\u17DF\u17EA-\u17EF\u17FA-\u17FF\u180F\u181A-\u181F\u1878-\u187F\u18AB-\u18AF\u18F6-\u18FF\u191D-\u191F\u192C-\u192F\u193C-\u193F\u1941-\u1943\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19CF\u19DB-\u19DD\u1A1C\u1A1D\u1A5F\u1A7D\u1A7E\u1A8A-\u1A8F\u1A9A-\u1A9F\u1AAE-\u1AFF\u1B4C-\u1B4F\u1B7D-\u1B7F\u1BF4-\u1BFB\u1C38-\u1C3A\u1C4A-\u1C4C\u1C80-\u1CBF\u1CC8-\u1CCF\u1CF7-\u1CFF\u1DE7-\u1DFB\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FC5\u1FD4\u1FD5\u1FDC\u1FF0\u1FF1\u1FF5\u1FFF\u200B-\u200F\u202A-\u202E\u2060-\u206F\u2072\u2073\u208F\u209D-\u209F\u20BB-\u20CF\u20F1-\u
|
|||
|
/**
|
|||
|
* @author n1474335 [n1474335@gmail.com]
|
|||
|
* @copyright Crown Copyright 2016
|
|||
|
* @license Apache-2.0
|
|||
|
*/
|
|||
|
var a=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.name="",this.type="",this._value=null,this.disabled=!1,this.hint="",this.rows=0,this.toggleValues=[],this.target=null,this.defaultIndex=0,t&&this._parseConfig(t)}var t,r,n;return t=e,n=[{key:"prepare",value:function(e,t){var r;switch(t){case"binaryString":case"binaryShortString":case"editableOption":case"editableOptionShort":return i.a.parseEscapedChars(e);case"byteArray":return"string"==typeof e?(e=e.replace(/\s+/g,""),Object(o.c)(e)):e;case"number":if(r=parseFloat(e),isNaN(r))throw"Invalid ingredient value. Not a number: "+i.a.truncate(e.toString(),10);return r;default:return e}}}],(r=[{key:"_parseConfig",value:function(e){this.name=e.name,this.type=e.type,this.defaultValue=e.value,this.disabled=!!e.disabled,this.hint=e.hint||!1,this.rows=e.rows||!1,this.toggleValues=e.toggleValues,this.target=void 0!==e.target?e.target:null,this.defaultIndex=void 0!==e.defaultIndex?e.defaultIndex:0}},{key:"config",get:function(){return this._value}},{key:"value",set:function(t){this._value=e.prepare(t,this.type)},get:function(){return this._value}}])&&s(t.prototype,r),n&&s(t,n),e}();function u(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)}}
|
|||
|
/**
|
|||
|
* @author n1474335 [n1474335@gmail.com]
|
|||
|
* @copyright Crown Copyright 2016
|
|||
|
* @license Apache-2.0
|
|||
|
*/
|
|||
|
var f=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._inputType=-1,this._outputType=-1,this._presentType=-1,this._breakpoint=!1,this._disabled=!1,this._flowControl=!1,this._manualBake=!1,this._ingList=[],this.name="",this.module="",this.description="",this.infoURL=null}var t,r,i;return t=e,(r=[{key:"run",value:function(e,t){return e}},{key:"highlight",value:function(e,t){return!1}},{key:"highlightReverse",value:function(e,t){return!1}},{key:"present",value:function(e,t){return e}},{key:"addIngredient",value:function(e){this._ingList.push(e)}},{key:"inputType",set:function(e){this._inputType=n.a.typeEnum(e)},get:function(){return n.a.enumLookup(this._inputType)}},{key:"outputType",set:function(e){this._outputType=n.a.typeEnum(e),this._presentType<0&&(this._presentType=this._outputType)},get:function(){return n.a.enumLookup(this._outputType)}},{key:"presentType",set:function(e){this._presentType=n.a.typeEnum(e)},get:function(){return n.a.enumLookup(this._presentType)}},{key:"args",set:function(e){var t=this;e.forEach(function(e){var r=new a(e);t.addIngredient(r)})},get:function(){return this._ingList.map(function(e){var t={name:e.name,type:e.type,value:e.defaultValue};return e.toggleValues&&(t.toggleValues=e.toggleValues),e.hint&&(t.hint=e.hint),e.rows&&(t.rows=e.rows),e.disabled&&(t.disabled=e.disabled),e.target&&(t.target=e.target),e.defaultIndex&&(t.defaultIndex=e.defaultIndex),t})}},{key:"config",get:function(){return{op:this.name,args:this._ingList.map(function(e){return e.config})}}},{key:"ingValues",set:function(e){var t=this;e.forEach(function(e,r){t._ingList[r].value=e})},get:function(){return this._ingList.map(function(e){return e.value})}},{key:"breakpoint",set:function(e){this._breakpoint=!!e},get:function(){return this._breakpoint}},{key:"disabled",set:function(e){this._disabled=!!e},get:function(){return this._disabled}},{key:"flowControl",get:function(){return this._flowControl},set:function(e){this._flowControl=!!e}},{key:"manualBake",get:function(){return this._manualBake},set:function(e){this._manualBake=!!e}}])&&u(t.prototype,r),i&&u(t,i),e}();t.a=f},,function(e,t,r){"use strict";function n(e){return(n="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)}function i(e){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function s(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function a(e){function t(){var t=Reflect.construct(e,Array.from(arguments));return Object.setPrototypeOf(t,Object.getPrototypeOf(this)),t}return t.prototype=Object.create(e.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e,t}
|
|||
|
/**
|
|||
|
* Custom error type for handling operation input errors.
|
|||
|
* i.e. where the operation can handle the error and print a message to the screen.
|
|||
|
*
|
|||
|
* @author d98762625 [d98762625@gmail.com]
|
|||
|
* @copyright Crown Copyright 2018
|
|||
|
* @license Apache-2.0
|
|||
|
*/var u=function(e){function t(){var e,r,o,a;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var u=arguments.length,f=new Array(u),c=0;c<u;c++)f[c]=arguments[c];return o=this,(r=!(a=(e=i(t)).call.apply(e,[this].concat(f)))||"object"!==n(a)&&"function"!=typeof a?s(o):a).type="OperationError",Error.captureStackTrace&&Error.captureStackTrace(s(s(r)),t),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o(e,t)}(t,a(Error)),t}();t.a=u},function(e,t,r){var n;!function(i){"use strict";var o,s=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a=Math.ceil,u=Math.floor,f="[BigNumber Error] ",c=f+"Number primitive has more than 15 significant digits: ",h=1e14,l=14,p=9007199254740991,d=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],_=1e7,y=1e9;function b(e){var t=0|e;return e>0||e===t?t:t-1}function g(e){for(var t,r,n=1,i=e.length,o=e[0]+"";n<i;){for(t=e[n++]+"",r=l-t.length;r--;t="0"+t);o+=t}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function m(e,t){var r,n,i=e.c,o=t.c,s=e.s,a=t.s,u=e.e,f=t.e;if(!s||!a)return null;if(r=i&&!i[0],n=o&&!o[0],r||n)return r?n?0:-a:s;if(s!=a)return s;if(r=s<0,n=u==f,!i||!o)return n?0:!i^r?1:-1;if(!n)return u>f^r?1:-1;for(a=(u=i.length)<(f=o.length)?u:f,s=0;s<a;s++)if(i[s]!=o[s])return i[s]>o[s]^r?1:-1;return u==f?0:u>f^r?1:-1}function v(e,t,r,n){if(e<t||e>r||e!==(e<0?a(e):u(e)))throw Error(f+(n||"Argument")+("number"==typeof e?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function w(e){var t=e.c.length-1;return b(e.e/l)==t&&e.c[t]%2!=0}function k(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function E(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(++t>(n=e.length)){for(i=r,t-=n;--t;i+=r);e+=i}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}(o=function e(t){var r,n,i,o,x,S,A,B,D,M=K.prototype={constructor:K,toString:null,valueOf:null},P=new K(1),I=20,U=4,R=-7,T=21,C=-1e7,F=1e7,O=!1,z=1,L=0,N={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},j="0123456789abcdefghijklmnopqrstuvwxyz";function K(e,t){var r,o,a,f,h,d,_,y,b=this;if(!(b instanceof K))return new K(e,t);if(null==t){if(e instanceof K)return b.s=e.s,b.e=e.e,void(b.c=(e=e.c)?e.slice():e);if((d="number"==typeof e)&&0*e==0){if(b.s=1/e<0?(e=-e,-1):1,e===~~e){for(f=0,h=e;h>=10;h/=10,f++);return b.e=f,void(b.c=[e])}y=String(e)}else{if(y=String(e),!s.test(y))return i(b,y,d);b.s=45==y.charCodeAt(0)?(y=y.slice(1),-1):1}(f=y.indexOf("."))>-1&&(y=y.replace(".","")),(h=y.search(/e/i))>0?(f<0&&(f=h),f+=+y.slice(h+1),y=y.substring(0,h)):f<0&&(f=y.length)}else{if(v(t,2,j.length,"Base"),y=String(e),10==t)return Z(b=new K(e instanceof K?e:y),I+b.e+1,U);if(d="number"==typeof e){if(0*e!=0)return i(b,y,d,t);if(b.s=1/e<0?(y=y.slice(1),-1):1,K.DEBUG&&y.replace(/^0\.0*|\./,"").length>15)throw Error(c+e);d=!1}else b.s=45===y.charCodeAt(0)?(y=y.slice(1),-1):1;for(r=j.slice(0,t),f=h=0,_=y.length;h<_;h++)if(r.indexOf(o=y.charAt(h))<0){if("."==o){if(h>f){f=_;continue}}else if(!a&&(y==y.toUpperCase()&&(y=y.toLowerCase())||y==y.toLowerCase()&&(y=y.toUpperCase()))){a=!0,h=-1,f=0;continue}return i(b,String(e),d,t)}(f=(y=n(y,t,10,b.s)).indexOf("."))>-1?y=y.replace(".",""):f=y.length}for(h=0;48===y.charCodeAt(h);h++);for(_=y.length;48===y.charCodeAt(--_););if(y=y.slice(h,++_)){if(_-=h,d&&K.DEBUG&&_>15&&(e>p||e!==u(e)))throw Error(c+b.s*e);if((f=f-h-1)>F)b.c=b.e=null;else if(f<C)b.c=[b.e=0];else{if(b.e=f,b.c=[],h=(f+1)%l,f<0&&(h+=l),h<_){for(h&&b.c.push(+y.slice(0,h)),_-=l;h<_;)b.c.push(+y.slice(h,h+=l));y=y.slice(h),h=l-y.length}else h-=_;for(;h--;y+="0");b.c.push(+y)}}else b.c=[b.e=0]}function q(e,t,r,n){var i,o,s,a,u;if(null==r?r=U:v(r,0,8),!e.c)return e.toString();if(i=e.c[0],s=e.e,null==t)u=g(e.c),u=1==n||2==n&&(s<=R||s>=T)?k(u,s):E(u,s,"0");else
|
|||
|
/*!
|
|||
|
* The buffer module from node.js, for the browser.
|
|||
|
*
|
|||
|
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
|||
|
* @license MIT
|
|||
|
*/
|
|||
|
var n=r(58),i=r(59),o=r(60);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(s()<t)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=u.prototype:(null===e&&(e=new u(t)),e.length=t),e}function u(e,t,r){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return h(this,e)}return f(this,e,t,r)}function f(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,n){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n);u.TYPED_ARRAY_SUPPORT?(e=t).__proto__=u.prototype:e=l(e,t);return e}(e,t,r,n):"string"==typeof t?function(e,t,r){"string"==typeof r&&""!==r||(r="utf8");if(!u.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|d(t,r),i=(e=a(e,n)).write(t,r);i!==n&&(e=e.slice(0,i));return e}(e,t,r):function(e,t){if(u.isBuffer(t)){var r=0|p(t.length);return 0===(e=a(e,r)).length?e:(t.copy(e,0,0,r),e)}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(n=t.length)!=n?a(e,0):l(e,t);if("Buffer"===t.type&&o(t.data))return l(e,t.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function c(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function h(e,t){if(c(t),e=a(e,t<0?0:0|p(t)),!u.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function l(e,t){var r=t.length<0?0:0|p(t.length);e=a(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function p(e){if(e>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function d(e,t){if(u.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return N(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return j(e).length;default:if(n)return N(e).length;t=(""+t).toLowerCase(),n=!0}}function _(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function y(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=u.from(t,n)),u.isBuffer(t))return 0===t.length?-1:b(e,t,r,n,i);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):b(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function b(e,t,r,n,i){var o,s=1,a=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,u/=2,r/=2}function f(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var c=-1;for(o=r;o<a;o++)if(f(e,o)===f(t,-1===c?0:o-c)){if(-1===c&&(c=o),o-c+1===u)return c*s}else-1!==c&&(o-=o-c),c=-1}else for(r+u>a&&(r=a-u),o=r;o>=0;o--){for(var h=!0,l=0;l<u;l++)if(f(e,o+l)!==f(t,l)){h=!1;break}if(h)return o}return-1}function g(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex s
|
|||
|
/**
|
|||
|
* Hexadecimal functions.
|
|||
|
*
|
|||
|
* @author n1474335 [n1474335@gmail.com]
|
|||
|
* @copyright Crown Copyright 2016
|
|||
|
* @license Apache-2.0
|
|||
|
*/function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2;if(!e)return"";for(var n="",i=0;i<e.length;i++)n+=e[i].toString(16).padStart(r,"0")+t;return"0x"===t&&(n="0x"+n),"\\x"===t&&(n="\\x"+n),t.length?n.slice(0,-t.length):n}function o(e){if(!e)return"";for(var t=[],r=0;r<e.length;r++)t.push((e[r]>>>4).toString(16)),t.push((15&e[r]).toString(16));return t.join("")}function s(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Auto",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2;if("None"!==t){var i="Auto"===t?/[^a-f\d]/gi:n.a.regexRep(t);e=e.replace(i,"")}for(var o=[],s=0;s<e.length;s+=r)o.push(parseInt(e.substr(s,r),16));return o}var a=["Space","Comma","Semi-colon","Colon","Line feed","CRLF","0x","\\x","None"],u=["Auto"].concat(a)},function(e,t,r){var n=r(5),i=n.Buffer;function o(e,t){for(var r in e)t[r]=e[r]}function s(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(o(n,t),t.Buffer=s),o(i,s),s.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},s.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},function(e,t,r){"use strict";var n=r(0),i=r(12),o=r(4),s=r.n(o),a=r(14),u=r.n(a);function f(e,t,r,n,i,o,s){try{var a=e[o](s),u=a.value}catch(e){return void r(e)}a.done?t(u):Promise.resolve(u).then(n,i)}function c(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function s(e){f(o,n,i,s,a,"next",e)}function a(e){f(o,n,i,s,a,"throw",e)}s(void 0)})}}function h(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)}}
|
|||
|
/**
|
|||
|
* @author n1474335 [n1474335@gmail.com]
|
|||
|
* @author Matt C [matt@artemisbot.uk]
|
|||
|
* @copyright Crown Copyright 2016
|
|||
|
* @license Apache-2.0
|
|||
|
*/
|
|||
|
var l=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.value=[],this.type=e.BYTE_ARRAY,t&&t.hasOwnProperty("value")&&t.hasOwnProperty("type")&&this.set(t.value,t.type)}var t,r,o;return t=e,r=[{key:"set",value:function(t,r){if("string"==typeof r&&(r=e.typeEnum(r)),u.a.debug("Dish type: "+e.enumLookup(r)),this.value=t,this.type=r,!this.valid()){var o=n.a.truncate(JSON.stringify(this.value),13);throw new i.a("Data is not a valid ".concat(e.enumLookup(r),": ").concat(o))}}},{key:"get",value:function(){var t=c(regeneratorRuntime.mark(function t(r){var n,i=arguments;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(n=i.length>1&&void 0!==i[1]&&i[1],"string"==typeof r&&(r=e.typeEnum(r)),this.type===r){t.next=5;break}return t.next=5,this._translate(r,n);case 5:return t.abrupt("return",this.value);case 6:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()},{key:"_translate",value:function(){var t=c(regeneratorRuntime.mark(function t(r){var o,a,f=arguments;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:o=f.length>1&&void 0!==f[1]&&f[1],u.a.debug("Translating Dish from ".concat(e.enumLookup(this.type)," to ").concat(e.enumLookup(r))),a=o?n.a.byteArrayToChars:n.a.byteArrayToUtf8,t.prev=3,t.t0=this.type,t.next=t.t0===e.STRING?7:t.t0===e.NUMBER?9:t.t0===e.HTML?11:t.t0===e.ARRAY_BUFFER?13:t.t0===e.BIG_NUMBER?15:t.t0===e.JSON?17:t.t0===e.FILE?19:t.t0===e.LIST_FILE?24:30;break;case 7:return this.value=this.value?n.a.strToByteArray(this.value):[],t.abrupt("break",31);case 9:return this.value="number"==typeof this.value?n.a.strToByteArray(this.value.toString()):[],t.abrupt("break",31);case 11:return this.value=this.value?n.a.strToByteArray(n.a.unescapeHtml(n.a.stripHtmlTags(this.value,!0))):[],t.abrupt("break",31);case 13:return this.value=Array.prototype.slice.call(new Uint8Array(this.value)),t.abrupt("break",31);case 15:return this.value=s.a.isBigNumber(this.value)?n.a.strToByteArray(this.value.toFixed()):[],t.abrupt("break",31);case 17:return this.value=this.value?n.a.strToByteArray(JSON.stringify(this.value,null,4)):[],t.abrupt("break",31);case 19:return t.next=21,n.a.readFile(this.value);case 21:return this.value=t.sent,this.value=Array.prototype.slice.call(this.value),t.abrupt("break",31);case 24:return t.next=26,Promise.all(this.value.map(function(){var e=c(regeneratorRuntime.mark(function e(t){return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.a.readFile(t));case 1:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()));case 26:return this.value=t.sent,this.value=this.value.map(function(e){return Array.prototype.slice.call(e)}),this.value=[].concat.apply([],this.value),t.abrupt("break",31);case 30:return t.abrupt("break",31);case 31:t.next=36;break;case 33:throw t.prev=33,t.t1=t.catch(3),new i.a("Error translating from ".concat(e.enumLookup(this.type)," to byteArray: ").concat(t.t1));case 36:this.type=e.BYTE_ARRAY,t.prev=37,t.t2=r,t.next=t.t2===e.STRING?41:t.t2===e.HTML?41:t.t2===e.NUMBER?44:t.t2===e.ARRAY_BUFFER?47:t.t2===e.BIG_NUMBER?50:t.t2===e.JSON?53:t.t2===e.FILE?56:t.t2===e.LIST_FILE?58:61;break;case 41:return this.value=this.value?a(this.value):"",this.type=e.STRING,t.abrupt("break",62);case 44:return this.value=this.value?parseFloat(a(this.value)):0,this.type=e.NUMBER,t.abrupt("break",62);case 47:return this.value=new Uint8Array(this.value).buffer,this.type=e.ARRAY_BUFFER,t.abrupt("break",62);case 50:try{this.value=new s.a(a(this.value))}catch(e){this.value=new s.a(NaN)}return this.type=e.BIG_NUMBER,t.abrupt("break",62);case 53:return this.value=JSON.parse(a(this.value)),this.type=e.JSON,t.abrupt("break",62);case 56:return this.value=new File(this.value,"unknown"),t.abrupt("break",62);case 58:return this.value=[new File(this.value,"unknown")],this.type=e.LIST_FILE,t.abrupt("break",
|
|||
|
/**
|
|||
|
* Base64 functions.
|
|||
|
*
|
|||
|
* @author n1474335 [n1474335@gmail.com]
|
|||
|
* @copyright Crown Copyright 2016
|
|||
|
* @license Apache-2.0
|
|||
|
*/function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"A-Za-z0-9+/=";if(!e)return"";"string"==typeof e&&(e=n.a.strToByteArray(e)),t=n.a.expandAlphRange(t).join("");for(var r,i,o,s,a,u,f,c="",h=0;h<e.length;)s=(r=e[h++])>>2,a=(3&r)<<4|(i=e[h++])>>4,u=(15&i)<<2|(o=e[h++])>>6,f=63&o,isNaN(i)?u=f=64:isNaN(o)&&(f=64),c+=t.charAt(s)+t.charAt(a)+t.charAt(u)+t.charAt(f);return c}function o(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"A-Za-z0-9+/=",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"string",i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(!e)return"string"===r?"":[];t=t||"A-Za-z0-9+/=",t=n.a.expandAlphRange(t).join("");var o,s,a,u,f,c,h=[],l=0;if(i){var p=new RegExp("[^"+t.replace(/[[\]\\\-^$]/g,"\\$&")+"]","g");e=e.replace(p,"")}for(;l<e.length;)o=t.indexOf(e.charAt(l++))<<2|(u=-1===(u=t.indexOf(e.charAt(l++)||"="))?64:u)>>4,s=(15&u)<<4|(f=-1===(f=t.indexOf(e.charAt(l++)||"="))?64:f)>>2,a=(3&f)<<6|(c=-1===(c=t.indexOf(e.charAt(l++)||"="))?64:c),h.push(o),64!==f&&h.push(s),64!==c&&h.push(a);return"string"===r?n.a.byteArrayToUtf8(h):h}var s=[{name:"Standard (RFC 4648): A-Za-z0-9+/=",value:"A-Za-z0-9+/="},{name:"URL safe (RFC 4648 §5): A-Za-z0-9-_",value:"A-Za-z0-9-_"},{name:"Filename safe: A-Za-z0-9+-=",value:"A-Za-z0-9+\\-="},{name:"itoa64: ./0-9A-Za-z=",value:"./0-9A-Za-z="},{name:"XML: A-Za-z0-9_.",value:"A-Za-z0-9_."},{name:"y64: A-Za-z0-9._-",value:"A-Za-z0-9._-"},{name:"z64: 0-9a-zA-Z+/=",value:"0-9a-zA-Z+/="},{name:"Radix-64 (RFC 4880): 0-9A-Za-z+/=",value:"0-9A-Za-z+/="},{name:"Uuencoding: [space]-_",value:" -_"},{name:"Xxencoding: +-0-9A-Za-z",value:"+\\-0-9A-Za-z"},{name:"BinHex: !-,-0-689@A-NP-VX-Z[`a-fh-mp-r",value:"!-,-0-689@A-NP-VX-Z[`a-fh-mp-r"},{name:"ROT13: N-ZA-Mn-za-m0-9+/=",value:"N-ZA-Mn-za-m0-9+/="},{name:"UNIX crypt: ./0-9A-Za-z",value:"./0-9A-Za-z"}]},,function(e,t,r){"use strict";function n(e){return(n="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)}function i(e){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function o(e,t){return(o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function s(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function a(e){function t(){var t=Reflect.construct(e,Array.from(arguments));return Object.setPrototypeOf(t,Object.getPrototypeOf(this)),t}return t.prototype=Object.create(e.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e,t}
|
|||
|
/**
|
|||
|
* Custom error type for handling Dish type errors.
|
|||
|
* i.e. where the Dish cannot be successfully translated between types
|
|||
|
*
|
|||
|
* @author n1474335 [n1474335@gmail.com]
|
|||
|
* @copyright Crown Copyright 2018
|
|||
|
* @license Apache-2.0
|
|||
|
*/var u=function(e){function t(){var e,r,o,a;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var u=arguments.length,f=new Array(u),c=0;c<u;c++)f[c]=arguments[c];return o=this,(r=!(a=(e=i(t)).call.apply(e,[this].concat(f)))||"object"!==n(a)&&"function"!=typeof a?s(o):a).type="DishError",Error.captureStackTrace&&Error.captureStackTrace(s(s(r)),t),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&o(e,t)}(t,a(Error)),t}();t.a=u},,function(e,t,r){var n,i;!function(o,s){"use strict";void 0===(i="function"==typeof(n=function(){var e=function(){},t="undefined",r=["trace","debug","info","warn","error"];function n(e,t){var r=e[t];if("function"==typeof r.bind)return r.bind(e);try{return Function.prototype.bind.call(r,e)}catch(t){return function(){return Function.prototype.apply.apply(r,[e,arguments])}}}function i(t,n){for(var i=0;i<r.length;i++){var o=r[i];this[o]=i<t?e:this.methodFactory(o,t,n)}this.log=this.debug}function o(r,o,s){return function(r){"debug"===r&&(r="log");return typeof console!==t&&(void 0!==console[r]?n(console,r):void 0!==console.log?n(console,"log"):e)}(r)||function(e,r,n){return function(){typeof console!==t&&(i.call(this,r,n),this[e].apply(this,arguments))}}.apply(this,arguments)}function s(e,n,s){var a,u=this,f="loglevel";function c(){var e;if(typeof window!==t){try{e=window.localStorage[f]}catch(e){}if(typeof e===t)try{var r=window.document.cookie,n=r.indexOf(encodeURIComponent(f)+"=");-1!==n&&(e=/^([^;]+)/.exec(r.slice(n))[1])}catch(e){}return void 0===u.levels[e]&&(e=void 0),e}}e&&(f+=":"+e),u.name=e,u.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},u.methodFactory=s||o,u.getLevel=function(){return a},u.setLevel=function(n,o){if("string"==typeof n&&void 0!==u.levels[n.toUpperCase()]&&(n=u.levels[n.toUpperCase()]),!("number"==typeof n&&n>=0&&n<=u.levels.SILENT))throw"log.setLevel() called with invalid level: "+n;if(a=n,!1!==o&&function(e){var n=(r[e]||"silent").toUpperCase();if(typeof window===t)return;try{return void(window.localStorage[f]=n)}catch(e){}try{window.document.cookie=encodeURIComponent(f)+"="+n+";"}catch(e){}}(n),i.call(u,n,e),typeof console===t&&n<u.levels.SILENT)return"No console available for logging"},u.setDefaultLevel=function(e){c()||u.setLevel(e,!1)},u.enableAll=function(e){u.setLevel(u.levels.TRACE,e)},u.disableAll=function(e){u.setLevel(u.levels.SILENT,e)};var h=c();null==h&&(h=null==n?"WARN":n),u.setLevel(h,!1)}var a=new s,u={};a.getLogger=function(e){if("string"!=typeof e||""===e)throw new TypeError("You must supply a name when creating a logger.");var t=u[e];return t||(t=u[e]=new s(e,a.getLevel(),a.methodFactory)),t};var f=typeof window!==t?window.log:void 0;return a.noConflict=function(){return typeof window!==t&&window.log===a&&(window.log=f),a},a.getLoggers=function(){return u},a})?n.call(t,r,t,e):n)||(e.exports=i)}()},function(e,t,r){!function(e){var t,r,n,i=String.fromCharCode;function o(e){for(var t,r,n=[],i=0,o=e.length;i<o;)(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<o?56320==(64512&(r=e.charCodeAt(i++)))?n.push(((1023&t)<<10)+(1023&r)+65536):(n.push(t),i--):n.push(t);return n}function s(e){if(e>=55296&&e<=57343)throw Error("Lone surrogate U+"+e.toString(16).toUpperCase()+" is not a scalar value")}function a(e,t){return i(e>>t&63|128)}function u(e){if(0==(4294967168&e))return i(e);var t="";return 0==(4294965248&e)?t=i(e>>6&31|192):0==(4294901760&e)?(s(e),t=i(e>>12&15|224),t+=a(e,6)):0==(4292870144&e)&&(t=i(e>>18&7|240),t+=a(e,12),t+=a(e,6)),t+=i(63&e|128)}function f(){if(n>=r)throw Error("Invalid byte index");var e=255&t[n];if(n++,128==(192&e))return 63&e;throw Error("Invalid continuation byte")}function c(){var e,i;if(n>r)throw Error("Invalid byte index");if(n==r)return!1;if(e=255&t[n],n++,0==(128&e))return e;if(192==(224&e)){if((i=(31&e)<<6|f())>=128)return i;throw Error("Invalid continuation byte")}if(224==(240&e)){if((i=(15&e)<<1
|
|||
|
/**
|
|||
|
* Binary functions.
|
|||
|
*
|
|||
|
* @author n1474335 [n1474335@gmail.com]
|
|||
|
* @copyright Crown Copyright 2018
|
|||
|
* @license Apache-2.0
|
|||
|
*/function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Space",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:8;if(!e)return"";t=n.a.charRep(t);for(var i="",o=0;o<e.length;o++)i+=e[o].toString(2).padStart(r,"0")+t;return t.length?i.slice(0,-t.length):i}function o(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Space",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:8,i=n.a.regexRep(t);e=e.replace(i,"");for(var o=[],s=0;s<e.length;s+=r)o.push(parseInt(e.substr(s,r),2));return o}},function(e,t,r){"use strict";r.d(t,"a",function(){return i});var n=r(0);
|
|||
|
/**
|
|||
|
* Decimal functions.
|
|||
|
*
|
|||
|
* @author n1474335 [n1474335@gmail.com]
|
|||
|
* @copyright Crown Copyright 2018
|
|||
|
* @license Apache-2.0
|
|||
|
*/function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Auto";t=n.a.charRep(t);var r=[],i=e.split(t);""===i[i.length-1]&&(i=i.slice(0,i.length-1));for(var o=0;o<i.length;o++)r[o]=parseInt(i[o],10);return r}},function(e,t,r){"use strict";var n=t;n.version=r(361).version,n.utils=r(362),n.rand=r(136),n.curve=r(69),n.curves=r(367),n.ec=r(375),n.eddsa=r(379)},function(e,t){var r,n,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(r===setTimeout)return setTimeout(e,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:o}catch(e){r=o}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(e){n=s}}();var u,f=[],c=!1,h=-1;function l(){c&&u&&(c=!1,u.length?f=u.concat(f):h=-1,f.length&&p())}function p(){if(!c){var e=a(l);c=!0;for(var t=f.length;t;){for(u=f,f=[];++h<t;)u&&u[h].run();h=-1,t=f.length}u=null,c=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function d(e,t){this.fun=e,this.array=t}function _(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];f.push(new d(e,t)),1!==f.length||c||a(p)},d.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=_,i.addListener=_,i.once=_,i.off=_,i.removeListener=_,i.removeAllListeners=_,i.emit=_,i.prependListener=_,i.prependOnceListener=_,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},,function(e,t){function r(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=r,r.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)}},function(e,t,r){(function(){var e,n,i,o,s,a;for(t.const=r(590),s=0,a=(i=[r(722),r(1397)]).length;s<a;s++)for(e in n=i[s])o=n[e],t[e]=o}).call(this)},function(e,t){(function(){var e,r,n;for(r in t.openpgp={public_key_algorithms:{RSA:1,RSA_ENCRYPT_ONLY:2,RSA_SIGN_ONLY:3,ELGAMAL:16,DSA:17,ECDH:18,ECDSA:19,ELGAMAL_SIGN_AND_ENCRYPT:20,EDDSA:22},symmetric_key_algorithms:{CAST5:3,AES128:7,AES192:8,AES256:9},hash_algorithms:{MD5:1,SHA1:2,RIPEMD160:3,SHA256:8,SHA384:9,SHA512:10,SHA224:11},sig_subpacket:{creation_time:2,expiration_time:3,exportable_certificate:4,trust_signature:5,regular_expression:6,revocable:7,key_expiration_time:9,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,experimental_low:101,experimental_high:110},sig_types:{binary_doc:0,canonical_text:1,issuer:16,persona:17,casual:18,positive:19,subkey_binding:24,primary_binding:25,direct:31,key_revocation:32,subkey_revocation:40,certificate_revocation:48},message_types:{generic:0,public_key:4,private_key:5,signature:8,clearsign:9},s2k:{plain:0,salt:1,salt_iter:3,gnu:101,gnu_dummy:1001},s2k_convention:{none:0,checksum:255,sha1:254},ecdh:{param_bytes:3,version:1},packet_tags:{PKESK:1,signature:2,one_pass_sig:4,secret_key:5,public_key:6,secret_subkey:7,compressed:8,literal:11,public_subkey:14,userid:13,user_attribute:17,SEIPD:18,MDC:19},literal_formats:{binary:98,text:116,utf8:117},versions:{PKESK:3,SEIPD:1,one_pass_sig:3,keymaterial:{V4:4},signature:{V2:2,V3:3,V4:4}},signatures:{key:153,userid:180,user_attribute:209},key_flags:{certify_keys:1,sign_data:2,encrypt_comm:4,encrypt_s
|
|||
|
/*!
|
|||
|
* The buffer module from node.js, for the browser.
|
|||
|
*
|
|||
|
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
|||
|
* @license MIT
|
|||
|
*/
|
|||
|
function n(e,t){if(e===t)return 0;for(var r=e.length,n=t.length,i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0}function i(e){return t.Buffer&&"function"==typeof t.Buffer.isBuffer?t.Buffer.isBuffer(e):!(null==e||!e._isBuffer)}var o=r(62),s=Object.prototype.hasOwnProperty,a=Array.prototype.slice,u="foo"===function(){}.name;function f(e){return Object.prototype.toString.call(e)}function c(e){return!i(e)&&("function"==typeof t.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):!!e&&(e instanceof DataView||!!(e.buffer&&e.buffer instanceof ArrayBuffer))))}var h=e.exports=b,l=/\s*function\s+([^\(\s]*)\s*/;function p(e){if(o.isFunction(e)){if(u)return e.name;var t=e.toString().match(l);return t&&t[1]}}function d(e,t){return"string"==typeof e?e.length<t?e:e.slice(0,t):e}function _(e){if(u||!o.isFunction(e))return o.inspect(e);var t=p(e);return"[Function"+(t?": "+t:"")+"]"}function y(e,t,r,n,i){throw new h.AssertionError({message:r,actual:e,expected:t,operator:n,stackStartFunction:i})}function b(e,t){e||y(e,!0,t,"==",h.ok)}function g(e,t,r,s){if(e===t)return!0;if(i(e)&&i(t))return 0===n(e,t);if(o.isDate(e)&&o.isDate(t))return e.getTime()===t.getTime();if(o.isRegExp(e)&&o.isRegExp(t))return e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.lastIndex===t.lastIndex&&e.ignoreCase===t.ignoreCase;if(null!==e&&"object"==typeof e||null!==t&&"object"==typeof t){if(c(e)&&c(t)&&f(e)===f(t)&&!(e instanceof Float32Array||e instanceof Float64Array))return 0===n(new Uint8Array(e.buffer),new Uint8Array(t.buffer));if(i(e)!==i(t))return!1;var u=(s=s||{actual:[],expected:[]}).actual.indexOf(e);return-1!==u&&u===s.expected.indexOf(t)||(s.actual.push(e),s.expected.push(t),function(e,t,r,n){if(null==e||null==t)return!1;if(o.isPrimitive(e)||o.isPrimitive(t))return e===t;if(r&&Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;var i=m(e),s=m(t);if(i&&!s||!i&&s)return!1;if(i)return e=a.call(e),t=a.call(t),g(e,t,r);var u,f,c=k(e),h=k(t);if(c.length!==h.length)return!1;for(c.sort(),h.sort(),f=c.length-1;f>=0;f--)if(c[f]!==h[f])return!1;for(f=c.length-1;f>=0;f--)if(u=c[f],!g(e[u],t[u],r,n))return!1;return!0}(e,t,r,s))}return r?e===t:e==t}function m(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function v(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&!0===t.call({},e)}function w(e,t,r,n){var i;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),i=function(e){var t;try{e()}catch(e){t=e}return t}(t),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),e&&!i&&y(i,r,"Missing expected exception"+n);var s="string"==typeof n,a=!e&&i&&!r;if((!e&&o.isError(i)&&s&&v(i,r)||a)&&y(i,r,"Got unwanted exception"+n),e&&i&&r&&!v(i,r)||!e&&i)throw i}h.AssertionError=function(e){var t;this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=d(_((t=this).actual),128)+" "+t.operator+" "+d(_(t.expected),128),this.generatedMessage=!0);var r=e.stackStartFunction||y;if(Error.captureStackTrace)Error.captureStackTrace(this,r);else{var n=new Error;if(n.stack){var i=n.stack,o=p(r),s=i.indexOf("\n"+o);if(s>=0){var a=i.indexOf("\n",s+1);i=i.substring(a+1)}this.stack=i}}},o.inherits(h.AssertionError,Error),h.fail=y,h.ok=b,h.equal=function(e,t,r){e!=t&&y(e,t,r,"==",h.equal)},h.notEqual=function(e,t,r){e==t&&y(e,t,r,"!=",h.notEqual)},h.deepEqual=function(e,t,r){g(e,t,!1)||y(e,t,r,"deepEqual",h.deepEqual)},h.deepStrictEqual=function(e,t,r){g(e,t,!0)||y(e,t,r,"deepStrictEqual",h.deepStrictEqual)},h.notDeepEqual=function(e,t,r){g(e,t,!1)&&y(e,t,r,"notDeepEqual",h.notDeepEqual)},h.notDeepStrictEqual=function e(t,r,n){g(t,r,!0)&&y(t,r,n,"notDeepStrictEqual",e)},h.strictEqual=function(e,t,r){e!==t&&y(e,t,r,"===",h.strictEqual)},h.notStrictEqual=function(e,t,r){e===t&&y(e,t,r,"!==",h.notStrictEqua
|
|||
|
/**
|
|||
|
* this is a port of pyflate
|
|||
|
* @url http://www.paul.sladen.org/projects/pyflate/
|
|||
|
* @author kirilloid
|
|||
|
* @license CC-SA 3.0
|
|||
|
* @usage ArchUtils.bz2.decode(str)
|
|||
|
* @example ArchUtils.bz2.decode(
|
|||
|
* "BZh91AY&SYN\xEC\xE86\0\0\2Q\x80\0\x10@\0\6D\x90\x80 " +
|
|||
|
* "\x001\6LA\1\xA7\xA9\xA5\x80\xBB\x941\xF8\xBB\x92)\xC2\x84\x82wgA\xB0"
|
|||
|
* ) == "hello world\n";
|
|||
|
*/
|
|||
|
var n=function(){"use strict";
|
|||
|
/**
|
|||
|
* bwt_reverse code from wikipedia (slightly modified)
|
|||
|
* @url http://en.wikipedia.org/wiki/Burrows%E2%80%93Wheeler_transform
|
|||
|
* @license: CC-SA 3.0
|
|||
|
*/function e(e,t){var r=e.length;if(t>=r)throw RangeError("Out of bound");if(t<0)throw RangeError("Out of bound");var n=e;e=e.join(""),n.sort();for(var i={},o=r-1;o>=0;o--)i[n[o]]=o;var s=[];for(o=0;o<r;o++)s.push(i[e[o]]++);for(var a=n[o=t],u=[],f=1;f<r;f++)u.push(n[o=s[o]]);return a+u.reverse().join("")}function t(e,t,r){for(var n=e[t],i=t;i>0;e[i]=e[--i]);r.push(e[0]=n)}var r=function(){this.init=function(e){this.masks=[];for(var t=0;t<31;t++)this.masks[t]=(1<<t)-1;this.masks[31]=-2147483648,this.f=e,this.bits=0,this.bitfield=0,this.count=0},this.readbits2=function(e){var t=e>>1;return this.readbits(t)*(1<<t)+this.readbits(e-t)},this.readbits=function(e){for(;this.bits<e;)this.bitfield=(this.bitfield<<8)+this.f.charCodeAt(this.count++),this.bits+=8;var t=this.masks[e],r=this.bitfield>>this.bits-e&t;return this.bits-=e,this.bitfield&=~(t<<this.bits),r}},n=function(e,t){this.code=e,this.bits=t,this.symbol=void 0},i=function(){this.process=function(e){for(var t=e.length,r=[],i=0;i<t;i++)r.push([i,e[i]]);r.push([t,-1]);for(var o=[],s=r[0],a=s[0],u=s[1],f=1;f<r.length;f++){var c=r[f][0],h=r[f][1];if(u)for(var l=a;l<c;l++)o.push(new n(l,u));if(a=c,u=h,-1==h)break}o.sort(function(e,t){return e.bits-t.bits||e.code-t.code}),this.table=o;var p=0,d=-1;this.faht=[];var _=null;for(i=0;i<this.table.length;i++){var y=this.table[i];d+=1,y.bits!=p&&(d<<=y.bits-p,_=this.faht[p=y.bits]={}),_[y.symbol=d]=y}this.min_bits=16,this.max_bits=-1,this.table.forEach(function(e){e.bits<this.min_bits&&(this.min_bits=e.bits),e.bits>this.max_bits&&(this.max_bits=e.bits)},this)}};return{bz2:{decode:function(n){var o=new r;if(o.init(n),o.readbits(16),104!=o.readbits(8))throw"Unknown (not type 'h'uffman Bzip2) compression method";var s=o.readbits(8);if(!(49<=s&&s<=57))throw"Unknown (not size '1'-'9') Bzip2 blocksize";function a(e){for(var t=[],r=e.readbits(16),n=32768;n>0;n>>=1)if(r&n)for(var i=e.readbits(16),o=32768;o>0;o>>=1)t.push(Boolean(i&o));else for(var s=0;s<16;s++)t.push(!1);return t}s-=48;var u=[];return function(){for(;;){var r=o.readbits2(48);if(o.readbits2(32),54156738319193!=r){if(25779555029136==r){o.readbits(7&o.bits);break}throw"Illegal Bzip2 blocktype = 0x"+r.toString(16)}if(o.readbits(1))throw"Bzip2 randomised support not implemented";var n=o.readbits(24),s=a(o),f=o.readbits(3);if(2>f||f>6)throw RangeError("Bzip2: Number of Huffman groups not in range 2..6");for(var c=[0,1,2,3,4,5,6].slice(0,f),h=[],l=0,p=o.readbits(15);l<p;l++){for(var d=0;o.readbits(1);)if(d++>=f)throw RangeError("More than max ("+f+") groups");t(c,d,h)}for(var _=[],y=s.reduce(function(e,t){return e+t},0)+2,b=0;b<f;b++){var g=o.readbits(5),m=[];for(l=0;l<y;l++){if(g<0||g>20)throw RangeError("Bzip2 Huffman length code outside range 0..20");for(;o.readbits(1);)g-=2*o.readbits(1)-1;m.push(g)}_.push(m)}for(var v=[],w=0;w<_.length;w++){var k=new i;k.process(_[w]),v.push(k)}var E=[];for(d=s.length-1;d>=0;d--)s[d]&&E.push(String.fromCharCode(d));E.reverse();for(var x,S,A=0,B=0,D=0,M=0,P=[];;){for(var I in--B<=0&&(B=50,A<=h.length&&(x=v[h[A++]])),x.faht)if(o.bits<I&&(o.bitfield=(o.bitfield<<8)+o.f.charCodeAt(o.count++),o.bits+=8),S=x.faht[I][o.bitfield>>o.bits-I]){o.bitfield&=o.masks[o.bits-=I],S=S.code;break}if(0<=S&&S<=1)0==D&&(M=1),D+=M<<S,M<<=1;else{for(var U=E[0];D>0;D--)P.push(U);if(S==y-1)break;t(E,S-1,P)}}for(var R=e(P,n),T=[],C=(l=0,R.length);l<C;)if(d=R.charCodeAt(l),l<C-4&&R.charCodeAt(l+1)==d&&R.charCodeAt(l+2)==d&&R.charCodeAt(l+3)==d){d=R.charAt(l);for(var F=R.charCodeAt(l+4)+4;F>0;F--)T.push(d);l+=5}else T.push(R[l++]);u.push(T.join(""))}}(),u.join("")}}}}();e.exports=function(e){return s=e.toString("binary"),r=n.bz2.decode(s),new t(r,"binary")}}).call(this,n(5).Buffer)},function(e,t,r){(function(){var e,n,i={}.hasOwnProperty;n=r(175).Packet,e=function(e){function t(e,t){this.type=e,this.body=t}return function(e,t){for(var r in t)i.call(t,r)&&(e[r]=t[r]);function n(){this.constructor=e}n.prototype=t.prototype,e.prototype=new n,e.__super__=t.prototype}(t,n),t}(),t.Generic=e}).call(this)},function(e,t,r){(function(){t.KeyMaterial=r(736).KeyMaterial,t.Signat
|
|||
|
/**
|
|||
|
* PGP functions.
|
|||
|
*
|
|||
|
* @author tlwr [toby@toby.codes]
|
|||
|
* @author Matt C [matt@artemisbot.uk]
|
|||
|
* @author n1474335 [n1474335@gmail.com]
|
|||
|
*
|
|||
|
* @copyright Crown Copyright 2018
|
|||
|
* @license Apache-2.0
|
|||
|
*
|
|||
|
*/var h=u.a?u.a.promisify:a.promisify,l=o.a.ASP({progress_hook:function(e){var t="";switch(e.what){case"guess":t="Guessing a prime";break;case"fermat":t="Factoring prime using Fermat's factorization method";break;case"mr":t="Performing Miller-Rabin primality test";break;case"passed_mr":t="Passed Miller-Rabin primality test";break;case"failed_mr":t="Failed Miller-Rabin primality test";break;case"found":t="Prime found";break;default:t="Stage: ".concat(e.what)}"function"==typeof importScripts&&self.sendStatusMessage(t)}});function p(e){return{1024:1024,2048:1024,4096:2048,256:256,384:256}[e]}function d(e,t){return _.apply(this,arguments)}function _(){return(_=c(regeneratorRuntime.mark(function e(t,r){var n;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,h(o.a.KeyManager.import_from_armored_pgp)({armored:t,opts:{no_check_keys:!0}});case 3:if(!(n=e.sent).is_pgp_locked()){e.next=11;break}if(!r){e.next=10;break}return e.next=8,h(n.unlock_pgp.bind(n))({passphrase:r});case 8:e.next=11;break;case 10:throw new s.a("Did not provide passphrase with locked private key.");case 11:return e.abrupt("return",n);case 14:throw e.prev=14,e.t0=e.catch(0),new s.a("Could not import private key: ".concat(e.t0));case 17:case"end":return e.stop()}},e,this,[[0,14]])}))).apply(this,arguments)}function y(e){return b.apply(this,arguments)}function b(){return(b=c(regeneratorRuntime.mark(function e(t){var r;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,h(o.a.KeyManager.import_from_armored_pgp)({armored:t,opts:{no_check_keys:!0}});case 3:return r=e.sent,e.abrupt("return",r);case 7:throw e.prev=7,e.t0=e.catch(0),new s.a("Could not import public key: ".concat(e.t0));case 10:case"end":return e.stop()}},e,this,[[0,7]])}))).apply(this,arguments)}function g(e){return(g="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)}function m(e,t,r,n,i,o,s){try{var a=e[o](s),u=a.value}catch(e){return void r(e)}a.done?t(u):Promise.resolve(u).then(n,i)}function v(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{n||null==a.return||a.return()}finally{if(i)throw o}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function w(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 k(e,t){return!t||"object"!==g(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function E(e){return(E=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function x(e,t){return(x=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}
|
|||
|
/**
|
|||
|
* @author tlwr [toby@toby.codes]
|
|||
|
* @author Matt C [matt@artemisbot.uk]
|
|||
|
* @author n1474335 [n1474335@gmail.com]
|
|||
|
* @copyright Crown Copyright 2017
|
|||
|
* @license Apache-2.0
|
|||
|
*/var S=u.a?u.a.promisify:a.promisify,A=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=k(this,E(t).call(this))).name="Generate PGP Key Pair",e.module="PGP",e.description="Generates a new public/private PGP key pair. Supports RSA and Eliptic Curve (EC) keys.",e.infoURL="https://wikipedia.org/wiki/Pretty_Good_Privacy",e.inputType="string",e.outputType="string",e.args=[{name:"Key type",type:"option",value:["RSA-1024","RSA-2048","RSA-4096","ECC-256","ECC-384"]},{name:"Password (optional)",type:"string",value:""},{name:"Name (optional)",type:"string",value:""},{name:"Email (optional)",type:"string",value:""}],e}var r,i,s;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&x(e,t)}(t,n["a"]),r=t,(i=[{key:"run",value:function(e,t){var r=v(t[0].split("-"),2),n=r[0],i=r[1],s=t[1],a=t[2],u=t[3],f="";a&&(f+=a),u&&(f+=" <".concat(u,">"));var c=o.a.const.openpgp.certify_keys;c|=o.a.const.openpgp.sign_data,c|=o.a.const.openpgp.auth,c|=o.a.const.openpgp.encrypt_comm;var h={userid:f,ecc:"ecc"===n,primary:{nbits:i,flags:c|=o.a.const.openpgp.encrypt_storage,expire_in:0},subkeys:[{nbits:p(i),flags:o.a.const.openpgp.sign_data,expire_in:252288e3},{nbits:p(i),flags:o.a.const.openpgp.encrypt_comm|o.a.const.openpgp.encrypt_storage,expire_in:63072e3}],asp:l};return new Promise(function(){var e,t=(e=regeneratorRuntime.mark(function e(t,r){var n,i,a,u,f;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,S(o.a.KeyManager.generate)(h);case 3:return n=e.sent,e.next=6,S(n.sign.bind(n))({});case 6:return i=n,a={},s&&(a.passphrase=s),e.next=10,S(i.export_pgp_private.bind(i))(a);case 10:return u=e.sent,e.next=13,S(i.export_pgp_public.bind(i))({});case 13:f=e.sent,t(u+"\n"+f.trim()),e.next=20;break;case 17:e.prev=17,e.t0=e.catch(0),r("Error whilst generating key pair: ".concat(e.t0));case 20:case"end":return e.stop()}},e,this,[[0,17]])}),function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function s(e){m(o,n,i,s,a,"next",e)}function a(e){m(o,n,i,s,a,"throw",e)}s(void 0)})});return function(e,r){return t.apply(this,arguments)}}())}}])&&w(r.prototype,i),s&&w(r,s),t}();function B(e){return(B="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)}function D(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{n||null==a.return||a.return()}finally{if(i)throw o}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function M(e,t,r,n,i,o,s){try{var a=e[o](s),u=a.value}catch(e){return void r(e)}a.done?t(u):Promise.resolve(u).then(n,i)}function P(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 I(e,t){return!t||"object"!==B(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function U(e){return(U=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function R(e,t){return(R=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}
|
|||
|
/**
|
|||
|
* @author tlwr [toby@toby.codes]
|
|||
|
* @copyright Crown Copyright 2017
|
|||
|
* @license Apache-2.0
|
|||
|
*/var T=u.a?u.a.promisify:a.promisify,C=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=I(this,U(t).call(this))).name="PGP Decrypt",e.module="PGP",e.description=["Input: the ASCII-armoured PGP message you want to decrypt.","<br><br>","Arguments: the ASCII-armoured PGP private key of the recipient, ","(and the private key password if necessary).","<br><br>","Pretty Good Privacy is an encryption standard (OpenPGP) used for encrypting, decrypting, and signing messages.","<br><br>","This function uses the Keybase implementation of PGP."].join("\n"),e.infoURL="https://wikipedia.org/wiki/Pretty_Good_Privacy",e.inputType="string",e.outputType="string",e.args=[{name:"Private key of recipient",type:"text",value:""},{name:"Private key passphrase",type:"string",value:""}],e}var r,i,a;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&R(e,t)}(t,n["a"]),r=t,(i=[{key:"run",value:function(){var e,t=(e=regeneratorRuntime.mark(function e(t,r){var n,i,a,u,f,c,h;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t,i=D(r,2),a=i[0],u=i[1],f=new o.a.keyring.KeyRing,a){e.next=3;break}throw new s.a("Enter the private key of the recipient.");case 3:return e.next=5,d(a,u);case 5:return h=e.sent,f.add_key_manager(h),e.prev=7,e.next=10,T(o.a.unbox)({armored:n,keyfetch:f,asp:l});case 10:c=e.sent,e.next=16;break;case 13:throw e.prev=13,e.t0=e.catch(7),new s.a("Couldn't decrypt message with provided private key: ".concat(e.t0));case 16:return e.abrupt("return",c.toString());case 17:case"end":return e.stop()}},e,this,[[7,13]])}),function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function s(e){M(o,n,i,s,a,"next",e)}function a(e){M(o,n,i,s,a,"throw",e)}s(void 0)})});return function(e,r){return t.apply(this,arguments)}}()}])&&P(r.prototype,i),a&&P(r,a),t}();function F(e){return(F="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)}function O(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{n||null==a.return||a.return()}finally{if(i)throw o}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function z(e,t,r,n,i,o,s){try{var a=e[o](s),u=a.value}catch(e){return void r(e)}a.done?t(u):Promise.resolve(u).then(n,i)}function L(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 N(e,t){return!t||"object"!==F(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function j(e){return(j=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function K(e,t){return(K=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}
|
|||
|
/**
|
|||
|
* @author tlwr [toby@toby.codes]
|
|||
|
* @copyright Crown Copyright 2017
|
|||
|
* @license Apache-2.0
|
|||
|
*/var q=u.a?u.a.promisify:a.promisify,H=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=N(this,j(t).call(this))).name="PGP Decrypt and Verify",e.module="PGP",e.description=["Input: the ASCII-armoured encrypted PGP message you want to verify.","<br><br>","Arguments: the ASCII-armoured PGP public key of the signer, ","the ASCII-armoured private key of the recipient (and the private key password if necessary).","<br><br>","This operation uses PGP to decrypt and verify an encrypted digital signature.","<br><br>","Pretty Good Privacy is an encryption standard (OpenPGP) used for encrypting, decrypting, and signing messages.","<br><br>","This function uses the Keybase implementation of PGP."].join("\n"),e.infoURL="https://wikipedia.org/wiki/Pretty_Good_Privacy",e.inputType="string",e.outputType="string",e.args=[{name:"Public key of signer",type:"text",value:""},{name:"Private key of recipient",type:"text",value:""},{name:"Private key password",type:"string",value:""}],e}var r,i,a;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&K(e,t)}(t,n["a"]),r=t,(i=[{key:"run",value:function(){var e,t=(e=regeneratorRuntime.mark(function e(t,r){var n,i,a,u,f,c,h,p,_,b,g,m,v;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t,i=O(r,3),a=i[0],u=i[1],f=i[2],c=new o.a.keyring.KeyRing,a){e.next=3;break}throw new s.a("Enter the public key of the signer.");case 3:if(u){e.next=5;break}throw new s.a("Enter the private key of the recipient.");case 5:return e.next=7,d(u,f);case 7:return p=e.sent,e.next=10,y(a);case 10:return _=e.sent,c.add_key_manager(p),c.add_key_manager(_),e.prev=13,e.next=16,q(o.a.unbox)({armored:n,keyfetch:c,asp:l});case 16:if(h=e.sent,!(b=h[0].get_data_signer())){e.next=32;break}if(!(g=b.get_key_manager())){e.next=29;break}return m=g.get_userids_mark_primary()[0].components,v="Signed by ",(m.email||m.username||m.comment)&&(m.username&&(v+="".concat(m.username," ")),m.comment&&(v+="".concat(m.comment," ")),m.email&&(v+="<".concat(m.email,">")),v+="\n"),v+=["PGP fingerprint: ".concat(g.get_pgp_fingerprint().toString("hex")),"Signed on ".concat(new Date(1e3*b.sig.hashed_subpackets[0].time).toUTCString()),"----------------------------------\n"].join("\n"),v+=h.toString(),e.abrupt("return",v.trim());case 29:throw new s.a("Could not identify a key manager.");case 30:e.next=33;break;case 32:throw new s.a("The data does not appear to be signed.");case 33:e.next=38;break;case 35:throw e.prev=35,e.t0=e.catch(13),new s.a("Couldn't verify message: ".concat(e.t0));case 38:case"end":return e.stop()}},e,this,[[13,35]])}),function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function s(e){z(o,n,i,s,a,"next",e)}function a(e){z(o,n,i,s,a,"throw",e)}s(void 0)})});return function(e,r){return t.apply(this,arguments)}}()}])&&L(r.prototype,i),a&&L(r,a),t}();function G(e){return(G="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)}function Z(e,t,r,n,i,o,s){try{var a=e[o](s),u=a.value}catch(e){return void r(e)}a.done?t(u):Promise.resolve(u).then(n,i)}function V(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 Y(e,t){return!t||"object"!==G(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function W(e){return(W=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function X(e,t){return(X=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}
|
|||
|
/**
|
|||
|
* @author tlwr [toby@toby.codes]
|
|||
|
* @copyright Crown Copyright 2017
|
|||
|
* @license Apache-2.0
|
|||
|
*/var J=u.a?u.a.promisify:a.promisify,$=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=Y(this,W(t).call(this))).name="PGP Encrypt",e.module="PGP",e.description=["Input: the message you want to encrypt.","<br><br>","Arguments: the ASCII-armoured PGP public key of the recipient.","<br><br>","Pretty Good Privacy is an encryption standard (OpenPGP) used for encrypting, decrypting, and signing messages.","<br><br>","This function uses the Keybase implementation of PGP."].join("\n"),e.infoURL="https://wikipedia.org/wiki/Pretty_Good_Privacy",e.inputType="string",e.outputType="string",e.args=[{name:"Public key of recipient",type:"text",value:""}],e}var r,i,a;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&X(e,t)}(t,n["a"]),r=t,(i=[{key:"run",value:function(){var e,t=(e=regeneratorRuntime.mark(function e(t,r){var n,i,a,u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t,i=r[0]){e.next=3;break}throw new s.a("Enter the public key of the recipient.");case 3:return e.next=5,y(i);case 5:return u=e.sent,e.prev=6,e.next=9,J(o.a.box)({msg:n,encrypt_for:u,asp:l});case 9:a=e.sent,e.next=15;break;case 12:throw e.prev=12,e.t0=e.catch(6),new s.a("Couldn't encrypt message with provided public key: ".concat(e.t0));case 15:return e.abrupt("return",a.toString());case 16:case"end":return e.stop()}},e,this,[[6,12]])}),function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function s(e){Z(o,n,i,s,a,"next",e)}function a(e){Z(o,n,i,s,a,"throw",e)}s(void 0)})});return function(e,r){return t.apply(this,arguments)}}()}])&&V(r.prototype,i),a&&V(r,a),t}();function Q(e){return(Q="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)}function ee(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=[],n=!0,i=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(n=(s=a.next()).done)&&(r.push(s.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{n||null==a.return||a.return()}finally{if(i)throw o}}return r}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function te(e,t,r,n,i,o,s){try{var a=e[o](s),u=a.value}catch(e){return void r(e)}a.done?t(u):Promise.resolve(u).then(n,i)}function re(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 ne(e,t){return!t||"object"!==Q(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function ie(e){return(ie=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function oe(e,t){return(oe=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}
|
|||
|
/**
|
|||
|
* @author tlwr [toby@toby.codes]
|
|||
|
* @copyright Crown Copyright 2017
|
|||
|
* @license Apache-2.0
|
|||
|
*/var se=u.a?u.a.promisify:a.promisify,ae=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=ne(this,ie(t).call(this))).name="PGP Encrypt and Sign",e.module="PGP",e.description=["Input: the cleartext you want to sign.","<br><br>","Arguments: the ASCII-armoured private key of the signer (plus the private key password if necessary)","and the ASCII-armoured PGP public key of the recipient.","<br><br>","This operation uses PGP to produce an encrypted digital signature.","<br><br>","Pretty Good Privacy is an encryption standard (OpenPGP) used for encrypting, decrypting, and signing messages.","<br><br>","This function uses the Keybase implementation of PGP."].join("\n"),e.infoURL="https://wikipedia.org/wiki/Pretty_Good_Privacy",e.inputType="string",e.outputType="string",e.args=[{name:"Private key of signer",type:"text",value:""},{name:"Private key passphrase",type:"string",value:""},{name:"Public key of recipient",type:"text",value:""}],e}var r,i,a;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&oe(e,t)}(t,n["a"]),r=t,(i=[{key:"run",value:function(){var e,t=(e=regeneratorRuntime.mark(function e(t,r){var n,i,a,u,f,c,h,p;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t,i=ee(r,3),a=i[0],u=i[1],f=i[2],a){e.next=3;break}throw new s.a("Enter the private key of the signer.");case 3:if(f){e.next=5;break}throw new s.a("Enter the public key of the recipient.");case 5:return e.next=7,d(a,u);case 7:return h=e.sent,e.next=10,y(f);case 10:return p=e.sent,e.prev=11,e.next=14,se(o.a.box)({msg:n,encrypt_for:p,sign_with:h,asp:l});case 14:c=e.sent,e.next=20;break;case 17:throw e.prev=17,e.t0=e.catch(11),new s.a("Couldn't sign message: ".concat(e.t0));case 20:return e.abrupt("return",c);case 21:case"end":return e.stop()}},e,this,[[11,17]])}),function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function s(e){te(o,n,i,s,a,"next",e)}function a(e){te(o,n,i,s,a,"throw",e)}s(void 0)})});return function(e,r){return t.apply(this,arguments)}}()}])&&re(r.prototype,i),a&&re(r,a),t}(),ue="undefined"==typeof self?{}:self.OpModules||{};ue.PGP={"Generate PGP Key Pair":A,"PGP Decrypt":C,"PGP Decrypt and Verify":H,"PGP Encrypt":$,"PGP Encrypt and Sign":ae};t.default=ue}]);
|