doipjs/dist/doip.min.js

2 lines
180 KiB
JavaScript
Raw Normal View History

2022-09-10 08:23:13 -06:00
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).doip=e()}}((function(){return function e(t,r,i){function n(a,s){if(!r[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var c=r[a]={exports:{}};t[a][0].call(c.exports,(function(e){return n(t[a][1][e]||e)}),c,c.exports,e,t,r,i)}return r[a].exports}for(var o="function"==typeof require&&require,a=0;a<i.length;a++)n(i[a]);return n}({1:[function(e,t,r){t.exports=class{constructor(t="https://keyserver.ubuntu.com"){this._baseUrl=t,this._fetch="function"==typeof globalThis.fetch?globalThis.fetch:e("node-fetch")}lookup(e){let t=this._baseUrl+"/pks/lookup?op=get&options=mr&search=";const r=this._fetch;if(e.keyId)t+="0x"+encodeURIComponent(e.keyId);else{if(!e.query)throw new Error("You must provide a query parameter!");t+=encodeURIComponent(e.query)}return r(t).then((function(e){if(200===e.status)return e.text()})).then((function(e){if(e&&!(e.indexOf("-----END PGP PUBLIC KEY BLOCK-----")<0))return e.trim()}))}upload(e){const t=this._baseUrl+"/pks/add";return(0,this._fetch)(t,{method:"post",headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"},body:"keytext="+encodeURIComponent(e)})}}},{"node-fetch":33}],2:[function(e,t,r){t.exports=class{constructor(){this._fetch="function"==typeof globalThis.fetch?globalThis.fetch:e("node-fetch");const{subtle:t}=globalThis.crypto||e("crypto").webcrypto||new(e("@peculiar/webcrypto").Crypto);this._subtle=t}async lookup(e){const t=this._fetch;if(!e.email)throw new Error("You must provide an email parameter!");if("string"!=typeof e.email||!e.email.includes("@"))throw new Error("Invalid e-mail address.");const[r,i]=e.email.split("@"),n=(new TextEncoder).encode(r.toLowerCase()),o=function(e){if(0===e.length)return"";const t="ybndrfg8ejkmcpqxot1uwisza345h769",r=5,i=31;let n=e[0],o=1,a=8,s="";for(;a>0||o<e.length;){if(a<r)if(o<e.length)n<<=8,n|=255&e[o++],a+=8;else{const e=r-a;n<<=e,a+=e}a-=r,s+=t[i&n>>a]}return s}(new Uint8Array(await this._subtle.digest("SHA-1",n))),a=encodeURIComponent(r),s=`https://openpgpkey.${i}/.well-known/openpgpkey/${i}/hu/${o}?l=${a}`,u=`https://${i}/.well-known/openpgpkey/hu/${o}?l=${a}`;let l;try{if(l=await t(s),200!==l.status)throw new Error("Advanced WKD lookup failed: "+l.statusText)}catch(e){if(l=await t(u),200!==l.status)throw new Error("Direct WKD lookup failed: "+l.statusText)}return new Uint8Array(await l.arrayBuffer())}}},{"@peculiar/webcrypto":33,crypto:33,"node-fetch":33}],3:[function(e,t,r){t.exports=e("./lib/axios")},{"./lib/axios":5}],4:[function(e,t,r){"use strict";var i=e("./../utils"),n=e("./../core/settle"),o=e("./../helpers/cookies"),a=e("./../helpers/buildURL"),s=e("../core/buildFullPath"),u=e("./../helpers/parseHeaders"),l=e("./../helpers/isURLSameOrigin"),c=e("../core/createError"),d=e("../defaults"),f=e("../cancel/Cancel");t.exports=function(e){return new Promise((function(t,r){var p,h=e.data,m=e.headers,g=e.responseType;function v(){e.cancelToken&&e.cancelToken.unsubscribe(p),e.signal&&e.signal.removeEventListener("abort",p)}i.isFormData(h)&&delete m["Content-Type"];var b=new XMLHttpRequest;if(e.auth){var y=e.auth.username||"",A=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";m.Authorization="Basic "+btoa(y+":"+A)}var S=s(e.baseURL,e.url);function _(){if(b){var i="getAllResponseHeaders"in b?u(b.getAllResponseHeaders()):null,o={data:g&&"text"!==g&&"json"!==g?b.response:b.responseText,status:b.status,statusText:b.statusText,headers:i,config:e,request:b};n((function(e){t(e),v()}),(function(e){r(e),v()}),o),b=null}}if(b.open(e.method.toUpperCase(),a(S,e.params,e.paramsSerializer),!0),b.timeout=e.timeout,"onloadend"in b?b.onloadend=_:b.onreadystatechange=function(){b&&4===b.readyState&&(0!==b.status||b.responseURL&&0===b.responseURL.indexO