fox-send/assets/cryptofill.js

17 lines
188 KiB
JavaScript
Raw Normal View History

var liner=function(e){function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}var t={};return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get: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,r){return Object.prototype.hasOwnProperty.call(e,r)},r.p="",r(r.s=18)}([function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),function(e){function n(e){for(var r,t=e,n=/[^%](%\d+)/g,a=[];r=n.exec(t);)a.push({arg:r[1],index:r.index});for(var o=a.length-1;o>=0;o--){var s=a[o],i=s.arg.substring(1),c=s.index+1;t=t.substring(0,c)+arguments[+i]+t.substring(c+1+i.length)}return t=t.replace("%%","%")}function a(e){var r;r="string"==typeof e?{name:e}:e,h.checkAlgorithm(r);var t=e;return t.hash&&(t.hash=a(t.hash)),r}function o(e,r){if(!e)throw new i("Parameter '"+r+"' is required and cant be empty");if("undefined"!=typeof Buffer&&Buffer.isBuffer(e))return new Uint8Array(e);if(ArrayBuffer.isView(e)){var t=e.map(function(e){return e});return new Uint8Array(t.buffer)}if(e instanceof ArrayBuffer)return new Uint8Array(e);throw new i("Incoming parameter '"+r+"' has wrong data type. Must be ArrayBufferView or ArrayBuffer")}t.d(r,"WebCryptoError",function(){return i}),t.d(r,"AlgorithmError",function(){return c}),t.d(r,"CryptoKeyError",function(){return u}),t.d(r,"PrepareAlgorithm",function(){return a}),t.d(r,"PrepareData",function(){return o}),t.d(r,"BaseCrypto",function(){return h}),t.d(r,"AlgorithmNames",function(){return p}),t.d(r,"Base64Url",function(){return y}),t.d(r,"SubtleCrypto",function(){return W}),t.d(r,"Aes",function(){return m}),t.d(r,"AesAlgorithmError",function(){return A}),t.d(r,"AesWrapKey",function(){return w}),t.d(r,"AesEncrypt",function(){return g}),t.d(r,"AesECB",function(){return v}),t.d(r,"AesCBC",function(){return C}),t.d(r,"AesCTR",function(){return d}),t.d(r,"AesGCM",function(){return k}),t.d(r,"AesKW",function(){return b}),t.d(r,"RsaKeyGenParamsError",function(){return M}),t.d(r,"RsaHashedImportParamsError",function(){return G}),t.d(r,"Rsa",function(){return B}),t.d(r,"RsaSSA",function(){return T}),t.d(r,"RsaPSSParamsError",function(){return D}),t.d(r,"RsaPSS",function(){return H}),t.d(r,"RsaOAEPParamsError",function(){return x}),t.d(r,"RsaOAEP",function(){return j}),t.d(r,"EcKeyGenParamsError",function(){return U}),t.d(r,"Ec",function(){return _}),t.d(r,"EcAlgorithmError",function(){return S}),t.d(r,"EcDSA",function(){return L}),t.d(r,"EcDH",function(){return R}),t.d(r,"ShaAlgorithms",function(){return E}),t.d(r,"Sha",function(){return P});var s=t(8),i=function(e){function r(r){for(var t=[],a=1;a<arguments.length;a++)t[a-1]=arguments[a];var o=e.call(this)||this;o.code=0,o.message=n.apply(void 0,[r].concat(t));var s=new Error(o.message);return s.name=o.constructor.name,o.stack=s.stack,o}return Object(s.a)(r,e),r.NOT_SUPPORTED="Method is not supported",r}(Error),c=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.code=1,r}return Object(s.a)(r,e),r.PARAM_REQUIRED="Algorithm hasn't got required paramter '%1'",r.PARAM_WRONG_TYPE="Algorithm has got wrong type for paramter '%1'. Must be %2",r.PARAM_WRONG_VALUE="Algorithm has got wrong value for paramter '%1'. Must be %2",r.WRONG_ALG_NAME="Algorithm has got wrong name '%1'. Must be '%2'",r.UNSUPPORTED_ALGORITHM="Algorithm '%1' is not supported",r.WRONG_USAGE="Algorithm doesn't support key usage '%1'",r}(i),u=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.code=3,r}return Object(s.a)(r,e),r.EMPTY_KEY="CryptoKey is empty",r.WRONG_KEY_ALG="CryptoKey has wrong algorithm '%1'. Must be '%2'",r.WRONG_KEY_TYPE="CryptoKey has wrong type '%1'. Must be '%2'",r.WRONG_KEY_USAGE="CryptoKey has wrong key usage. Must be '%1'",r.NOT_EXTRACTABLE="CryptoKey is not extractable",r.WRONG_FORMAT="CryptoKey has '%1' type. It can be used with '%2' format",r.UNKNOWN_FORMAT="Unknown format in use '%1'. Must be
Copyright (c) Microsoft Corporation. All rights reserved.
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
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
var a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)r.hasOwnProperty(t)&&(e[t]=r[t])};Object.assign},function(e,r){e.exports=require("crypto")},function(e,r,t){"use strict";function n(e,r){return Promise.resolve().then(function(){if(e.key)return e;if(e.extractable){return(new m.Crypto).subtle.exportKey("jwk",e).then(function(t){var n=o(e);return n&&(n=w.assign(n,e.algorithm)),r.importKey("jwk",t,n,!0,e.usages)})}throw new A.LinerError("'key' is Native CryptoKey. It can't be converted to JS CryptoKey")})}function a(e,r){w.BrowserInfo().name!==w.Browser.IE&&w.BrowserInfo().name!==w.Browser.Edge&&w.BrowserInfo().name!==w.Browser.Safari||!/^rsa/i.test(e.name)||(r.privateKey?(P.push({hash:e.hash,key:r.privateKey}),P.push({hash:e.hash,key:r.publicKey})):P.push({hash:e.hash,key:r}))}function o(e){var r=null;return P.some(function(t){return t.key===e&&(r=w.assign({},e.algorithm,{hash:t.hash}),!0)}),r}function s(e,r){var t=[];e.privateKey?(t.push(e.privateKey),t.push(e.publicKey)):t.push(e),t.forEach(function(e){"keyUsage"in e&&(e.usages=e.keyUsage||[],e.usages.length||(["verify","encrypt","wrapKey"].forEach(function(t){r.indexOf(t)>-1&&("public"===e.type||"secret"===e.type)&&e.usages.push(t)}),["sign","decrypt","unwrapKey","deriveKey","deriveBits"].forEach(function(t){r.indexOf(t)>-1&&("private"===e.type||"secret"===e.type)&&e.usages.push(t)})))})}function i(e,r,t){if(r&&w.BrowserInfo().name===w.Browser.IE){"extractable"in e&&(e.ext=e.extractable,delete e.extractable);var n=null;switch(r.name.toUpperCase()){case p.AlgorithmNames.RsaOAEP.toUpperCase():case p.AlgorithmNames.RsaPSS.toUpperCase():case p.AlgorithmNames.RsaSSA.toUpperCase():n=C.RsaCrypto;break;case p.AlgorithmNames.AesECB.toUpperCase():case p.AlgorithmNames.AesCBC.toUpperCase():case p.AlgorithmNames.AesGCM.toUpperCase():n=g.AesCrypto;break;default:throw new A.LinerError(A.LinerError.UNSUPPORTED_ALGORITHM,r.name.toUpperCase())}n&&!e.alg&&(e.alg=n.alg2jwk(r)),"key_ops"in e||(e.key_ops=t)}}function c(e){w.BrowserInfo().name===w.Browser.IE&&("ext"in e&&(e.extractable=e.ext,delete e.ext),delete e.key_ops,delete e.alg)}function u(e){var r=/AppleWebKit\/(\d+)/.exec(self.navigator.userAgent);return e.toUpperCase()===p.AlgorithmNames.RsaOAEP&&r&&parseInt(r[1],10)<604}var h=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)r.hasOwnProperty(t)&&(e[t]=r[t])};return function(r,t){function n(){this.constructor=r}e(r,t),r.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}}();Object.defineProperty(r,"__esModule",{value:!0});var p=t(0),f=t(0),y=t(0),l=t(4),m=t(2),A=t(1),w=t(5),g=t(11),v=t(12),C=t(13),d=t(14),k=t(15),b=t(16),E=t(17),P=[],U=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return h(r,e),r.prototype.generateKey=function(r,t,n){var o,i=this,c=arguments;return e.prototype.generateKey.apply(this,c).then(function(e){if(o=y.PrepareAlgorithm(r),!(w.BrowserInfo().name===w.Browser.Edge&&o.name.toUpperCase()===p.AlgorithmNames.AesGCM||u(o.name))&&l.nativeSubtle)try{return l.nativeSubtle.generateKey.apply(l.nativeSubtle,c).catch(function(e){w.warn("WebCrypto: native generateKey for "+o.name+" doesn't work.",e&&e.message||"Unknown message")})}catch(e){w.warn("WebCrypto: native generateKey for "+o.name+" doesn't work.",e&&e.message||"Unknown message")}}).then(function(e){if(e){var c=Promise.resolve(e);if(w.BrowserInfo().name===w.Browser.Safari&&(o.name.toUpperCase()===p.AlgorithmNames.EcDH.toUpperCase()||o.name.toUpperCase()===p.AlgorithmNames.EcDSA.toUpperCase())){var u=e.publicKey;c=c.then(function(){return i.exportKey("jwk",u).then(function(a){return i.exportKey("spki",u).then(function(o){for(var s=p.Base64Url.decode(a.x),c=p.Base64Url.decode(a.y),u=s.length+c.length,h=new Uint8Array(o),f=0;f<u;f++){var y=h[h.length-f-1],l=void 0;if(l=f<c.length?c[c.length-f-1]:s[s.length+c.length-f-1],y!==l)return w.warn("WebCrypto: EC key has wrong public key JWK. Key pair will be recre
/*! asmCrypto v0.22.0, (c) 2018 asmCrypto.js, opensource.org/licenses/MIT */
!function(f,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(f.asmCrypto={})}(this,function(f){"use strict";var t="undefined"!=typeof Float64Array?Float64Array:Float32Array;function e(f,t){t=!!t;for(var e=f.length,r=new Uint8Array(t?4*e:e),i=0,s=0;i<e;i++){var n=f.charCodeAt(i);if(t&&55296<=n&&n<=56319){if(++i>=e)throw new Error("Malformed string, low surrogate expected at position "+i);n=(55296^n)<<10|65536|56320^f.charCodeAt(i)}else if(!t&&n>>>8)throw new Error("Wide characters are not allowed.");!t||n<=127?r[s++]=n:n<=2047?(r[s++]=192|n>>6,r[s++]=128|63&n):n<=65535?(r[s++]=224|n>>12,r[s++]=128|n>>6&63,r[s++]=128|63&n):(r[s++]=240|n>>18,r[s++]=128|n>>12&63,r[s++]=128|n>>6&63,r[s++]=128|63&n)}return r.subarray(0,s)}function r(f,t){t=!!t;for(var e=f.length,r=new Array(e),i=0,s=0;i<e;i++){var n=f[i];if(!t||n<128)r[s++]=n;else if(n>=192&&n<224&&i+1<e)r[s++]=(31&n)<<6|63&f[++i];else if(n>=224&&n<240&&i+2<e)r[s++]=(15&n)<<12|(63&f[++i])<<6|63&f[++i];else{if(!(n>=240&&n<248&&i+3<e))throw new Error("Malformed UTF8 character at byte offset "+i);var a=(7&n)<<18|(63&f[++i])<<12|(63&f[++i])<<6|63&f[++i];a<=65535?r[s++]=a:(a^=65536,r[s++]=55296|a>>10,r[s++]=56320|1023&a)}}var h="";for(i=0;i<s;i+=16384)h+=String.fromCharCode.apply(String,r.slice(i,i+16384<=s?i+16384:s));return h}function i(f){for(var t="",e=0;e<f.length;e++){var r=(255&f[e]).toString(16);r.length<2&&(t+="0"),t+=r}return t}function s(f){return btoa(r(f))}function n(f){return"number"==typeof f}function a(f){return"string"==typeof f}function h(f){return f instanceof ArrayBuffer}function o(f){return f instanceof Uint8Array}function x(f){return f instanceof Int8Array||f instanceof Uint8Array||f instanceof Int16Array||f instanceof Uint16Array||f instanceof Int32Array||f instanceof Uint32Array||f instanceof Float32Array||f instanceof Float64Array}function c(f,t,e){var r=t?t.byteLength:e||65536;if(4095&r||r<=0)throw new Error("heap size must be a positive integer and a multiple of 4096");return t=t||new f(new ArrayBuffer(r))}function u(f,t,e,r,i){var s=f.length-t,n=s<i?s:i;return f.set(e.subarray(r,r+n),t),n}function l(){var f=Error.apply(this,arguments);this.message=f.message,this.stack=f.stack}function y(){var f=Error.apply(this,arguments);this.message=f.message,this.stack=f.stack}function w(){var f=Error.apply(this,arguments);this.message=f.message,this.stack=f.stack}l.prototype=Object.create(Error.prototype,{name:{value:"IllegalStateError"}}),y.prototype=Object.create(Error.prototype,{name:{value:"IllegalArgumentError"}}),w.prototype=Object.create(Error.prototype,{name:{value:"SecurityError"}});var d=function(){var f,t,e=!1;function r(e,r){var i=f[(t[e]+t[r])%255];return 0!==e&&0!==r||(i=0),i}var i,s,n,a;function h(){function h(e){var r,i,s;for(i=s=function(e){var r=f[255-t[e]];return 0===e&&(r=0),r}(e),r=0;r<4;r++)s^=i=255&(i<<1|i>>>7);return s^=99}e||function(){f=[],t=[];var r,i,s=1;for(r=0;r<255;r++)f[r]=s,i=128&s,s<<=1,s&=255,128===i&&(s^=27),s^=f[r],t[f[r]]=r;f[255]=f[0],t[0]=0,e=!0}(),i=[],s=[],n=[[],[],[],[]],a=[[],[],[],[]];for(var o=0;o<256;o++){var x=h(o);i[o]=x,s[x]=o,n[0][o]=r(2,x)<<24|x<<16|x<<8|r(3,x),a[0][x]=r(14,o)<<24|r(9,o)<<16|r(13,o)<<8|r(11,o);for(var c=1;c<4;c++)n[c][o]=n[c-1][o]>>>8|n[c-1][o]<<24,a[c][x]=a[c-1][x]>>>8|a[c-1][x]<<24}}var o=function(f,t){h();var e=new Uint32Array(t);e.set(i,512),e.set(s,768);for(var r=0;r<4;r++)e.set(n[r],4096+1024*r>>2),e.set(a[r],8192+1024*r>>2);var o=function(f,t,e){"use asm";var r=0,i=0,s=0,n=0,a=0,h=0,o=0,x=0,c=0,u=0,l=0,y=0,w=0,d=0,p=0,g=0,v=0,b=0,m=0,_=0,A=0;var E=new f.Uint32Array(e),S=new f.Uint8Array(e);function C(f,t,e,a,h,o,x,c){f=f|0;t=t|0;e=e|0;a=a|0;h=h|0;o=o|0;x=x|0;c=c|0;var u=0,l=0,y=0,w=0,d=0,p=0,g=0,v=0;u=e|0x400,l=e|0x800,y=e|0xc00;h=h^E[(f|0)>>2],o=o^E[(f|4)>>2],x=x^E[(f|8)>>2],c=c^E[(f|12)>>2];for(v=16;(v|0)<=a<<4;v=v+16|0){w=E[(e|h>>22&1020)>>2]^E[(u|o>>14&1020)>>2]^E[(l|x>>6&1020)>>2]^E[(y|c<<2&1020)>>2]^E[(f|v|0)>>2],d=E[(e|o>>22&1020)>>2]^E[(u|x>>14&1020)>>2]^E[(l|c>>6&1020)>>2]^E[(y|h<<2&1020)>>2]^E[(f|v|4)>>