doipjs/dist/doip.min.js

22 lines
380 KiB
JavaScript
Raw Normal View History

2022-09-21 11:44:55 -06:00
!function(A){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=A();else if("function"==typeof define&&define.amd)define([],A);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).doip=A()}}((function(){return function A(I,i,e){function t(o,B){if(!i[o]){if(!I[o]){var r="function"==typeof require&&require;if(!B&&r)return r(o,!0);if(g)return g(o,!0);var a=new Error("Cannot find module '"+o+"'");throw a.code="MODULE_NOT_FOUND",a}var Q=i[o]={exports:{}};I[o][0].call(Q.exports,(function(A){return t(I[o][1][A]||A)}),Q,Q.exports,A,I,i,e)}return i[o].exports}for(var g="function"==typeof require&&require,o=0;o<e.length;o++)t(e[o]);return t}({1:[function(A,I,i){I.exports=class{constructor(I="https://keyserver.ubuntu.com"){this._baseUrl=I,this._fetch="function"==typeof globalThis.fetch?globalThis.fetch:A("node-fetch")}lookup(A){let I=this._baseUrl+"/pks/lookup?op=get&options=mr&search=";const i=this._fetch;if(A.keyId)I+="0x"+encodeURIComponent(A.keyId);else{if(!A.query)throw new Error("You must provide a query parameter!");I+=encodeURIComponent(A.query)}return i(I).then((function(A){if(200===A.status)return A.text()})).then((function(A){if(A&&!(A.indexOf("-----END PGP PUBLIC KEY BLOCK-----")<0))return A.trim()}))}upload(A){const I=this._baseUrl+"/pks/add";return(0,this._fetch)(I,{method:"post",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},body:"keytext="+encodeURIComponent(A)})}}},{"node-fetch":33}],2:[function(A,I,i){I.exports=class{constructor(){this._fetch="function"==typeof globalThis.fetch?globalThis.fetch:A("node-fetch");const{subtle:I}=globalThis.crypto||A("crypto").webcrypto||new(A("@peculiar/webcrypto").Crypto);this._subtle=I}async lookup(A){const I=this._fetch;if(!A.email)throw new Error("You must provide an email parameter!");if("string"!=typeof A.email||!A.email.includes("@"))throw new Error("Invalid e-mail address.");const[i,e]=A.email.split("@"),t=(new TextEncoder).encode(i.toLowerCase()),g=function(A){if(0===A.length)return"";const I="ybndrfg8ejkmcpqxot1uwisza345h769",i=5,e=31;let t=A[0],g=1,o=8,B="";for(;o>0||g<A.length;){if(o<i)if(g<A.length)t<<=8,t|=255&A[g++],o+=8;else{const A=i-o;t<<=A,o+=A}o-=i,B+=I[e&t>>o]}return B}(new Uint8Array(await this._subtle.digest("SHA-1",t))),o=encodeURIComponent(i),B=`https://openpgpkey.${e}/.well-known/openpgpkey/${e}/hu/${g}?l=${o}`,r=`https://${e}/.well-known/openpgpkey/hu/${g}?l=${o}`;let a;try{if(a=await I(B),200!==a.status)throw new Error("Advanced WKD lookup failed: "+a.statusText)}catch(A){if(a=await I(r),200!==a.status)throw new Error("Direct WKD lookup failed: "+a.statusText)}return new Uint8Array(await a.arrayBuffer())}}},{"@peculiar/webcrypto":33,crypto:33,"node-fetch":33}],3:[function(A,I,i){I.exports=A("./lib/axios")},{"./lib/axios":5}],4:[function(A,I,i){"use strict";var e=A("./../utils"),t=A("./../core/settle"),g=A("./../helpers/cookies"),o=A("./../helpers/buildURL"),B=A("../core/buildFullPath"),r=A("./../helpers/parseHeaders"),a=A("./../helpers/isURLSameOrigin"),Q=A("../core/createError"),C=A("../defaults"),n=A("../cancel/Cancel");I.exports=function(A){return new Promise((function(I,i){var c,s=A.data,E=A.headers,l=A.responseType;function d(){A.cancelToken&&A.cancelToken.unsubscribe(c),A.signal&&A.signal.removeEventListener("abort",c)}e.isFormData(s)&&delete E["Content-Type"];var u=new XMLHttpRequest;if(A.auth){var h=A.auth.username||"",f=A.auth.password?unescape(encodeURIComponent(A.auth.password)):"";E.Authorization="Basic "+btoa(h+":"+f)}var p=B(A.baseURL,A.url);function F(){if(u){var e="getAllResponseHeaders"in u?r(u.getAllResponseHeaders()):null,g={data:l&&"text"!==l&&"json"!==l?u.response:u.responseText,status:u.status,statusText:u.statusText,headers:e,config:A,request:u};t((function(A){I(A),d()}),(function(A){i(A),d()}),g),u=null}}if(u.open(A.method.toUpperCase(),o(p,A.params,A.paramsSerializer),!0),u.timeout=A.timeout,"onloadend"in u?u.onloadend=F:u.onreadystatechange=function(){u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexO
/*!
* hash-wasm (https://www.npmjs.com/package/hash-wasm)
* (c) Dani Biro
* @license MIT
*/
!function(A,e){"object"==typeof i&&void 0!==I?e(i):e((A="undefined"!=typeof globalThis?globalThis:A||self).hashwasm={})}(this,(function(I){"use strict";
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */function i(A,I,i,e){return new(i||(i=Promise))((function(t,g){function o(A){try{r(e.next(A))}catch(A){g(A)}}function B(A){try{r(e.throw(A))}catch(A){g(A)}}function r(A){var I;A.done?t(A.value):(I=A.value,I instanceof i?I:new i((function(A){A(I)}))).then(o,B)}r((e=e.apply(A,I||[])).next())}))}class e{constructor(){this.mutex=Promise.resolve()}lock(){let A=()=>{};return this.mutex=this.mutex.then((()=>new Promise(A))),new Promise((I=>{A=I}))}dispatch(A){return i(this,void 0,void 0,(function*(){const I=yield this.lock();try{return yield Promise.resolve(A())}finally{I()}}))}}var t;const g="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:A,o=null!==(t=g.Buffer)&&void 0!==t?t:null,B=g.TextEncoder?new g.TextEncoder:null;function r(A,I){return(15&A)+(A>>6|A>>3&8)<<4|(15&I)+(I>>6|I>>3&8)}function a(A,I){const i=I.length>>1;for(let e=0;e<i;e++){const i=e<<1;A[e]=r(I.charCodeAt(i),I.charCodeAt(i+1))}}const Q="a".charCodeAt(0)-10,C="0".charCodeAt(0);function n(A,I,i){let e=0;for(let t=0;t<i;t++){let i=I[t]>>>4;A[e++]=i>9?i+Q:i+C,i=15&I[t],A[e++]=i>9?i+Q:i+C}return String.fromCharCode.apply(null,A)}const c=null!==o?A=>{if("string"==typeof A){const I=o.from(A,"utf8");return new Uint8Array(I.buffer,I.byteOffset,I.length)}if(o.isBuffer(A))return new Uint8Array(A.buffer,A.byteOffset,A.length);if(ArrayBuffer.isView(A))return new Uint8Array(A.buffer,A.byteOffset,A.byteLength);throw new Error("Invalid data type!")}:A=>{if("string"==typeof A)return B.encode(A);if(ArrayBuffer.isView(A))return new Uint8Array(A.buffer,A.byteOffset,A.byteLength);throw new Error("Invalid data type!")},s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",E=new Uint8Array(256);for(let A=0;A<s.length;A++)E[s.charCodeAt(A)]=A;function l(A,I=!0){const i=A.length,e=i%3,t=[],g=i-e;for(let I=0;I<g;I+=3){const i=(A[I]<<16&16711680)+(A[I+1]<<8&65280)+(255&A[I+2]),e=s.charAt(i>>18&63)+s.charAt(i>>12&63)+s.charAt(i>>6&63)+s.charAt(63&i);t.push(e)}if(1===e){const e=A[i-1],g=s.charAt(e>>2),o=s.charAt(e<<4&63);t.push(`${g}${o}`),I&&t.push("==")}else if(2===e){const e=(A[i-2]<<8)+A[i-1],g=s.charAt(e>>10),o=s.charAt(e>>4&63),B=s.charAt(e<<2&63);t.push(`${g}${o}${B}`),I&&t.push("=")}return t.join("")}function d(A){let I=Math.floor(.75*A.length);const i=A.length;return"="===A[i-1]&&(I-=1,"="===A[i-2]&&(I-=1)),I}function u(A){const I=d(A),i=A.length,e=new Uint8Array(I);let t=0;for(let I=0;I<i;I+=4){const i=E[A.charCodeAt(I)],g=E[A.charCodeAt(I+1)],o=E[A.charCodeAt(I+2)],B=E[A.charCodeAt(I+3)];e[t]=i<<2|g>>4,t+=1,e[t]=(15&g)<<4|o>>2,t+=1,e[t]=(3&o)<<6|63&B,t+=1}return e}const h=16384,f=new e,p=new Map;function F(A,I){return i(this,void 0,void 0,(function*(){let e=null,t=null,g=!1;if("undefined"==typeof WebAssembly)throw new Error("WebAssembly is not supported in this environment!");const o=()=>new DataView(e.exports.memory.buffer).getUint32(e.exports.STATE_SIZE,!0),B=f.dispatch((()=>i(this,void 0,void 0,(function*(){if(!p.has(A.name)){const I=u(A.data),i=WebAssembly.compile(I);p.set(A.name,i)}const I=yield p.get(A.name);e=yield WebAssembly.instantiate(I,{})})))),Q=(A=null)=>{g=!0,e.exports.Hash_Init(A)},C=A=>{if(!g)throw new Error("update() called before init()");(A=>{let I=0;for(;I<A.length;){const i=A.subarray(I,I+h);I+=i.length,t.set(i),e.exports.Hash_Update(i.length)}})(c(A))},s=new Uint8Array(2*I),E=(A,i=null)=>{if(!g)throw new Error("digest() called before init()");return g=!1,e.exports.Hash_Final(i),"binary"===A?t.slice(0,I):n(s,t,I)},l=A=>"string"==typeof A?A.length<4096:A.byteLength<h;let d=l;switch(A.name){case"argon2":case"scrypt":d=()=>!0;break;case"blake2b":case"blake2s":d=(A,I)=>I<=512&&l(A);break;case"blake3":d=(A,I)=>0===I&&l(A);break;case"xxhash64":case"xxhash3":case"xxhash128":d=()=>!1}return yield(()=>i(this,void 0,void 0,(function*(){e||(yield B);const A=e.exports.Hash_GetBuffer(),I=e.exports.memory.buffer;t=new Uint8Array(I,A,h)})))(),{getMemory:()=>t,writeMemory:(A,I=0)=>{t.set(A,I)},getExports:()=>e.export