doipjs/dist/doip.min.js

2 lines
192 KiB
JavaScript
Raw Normal View History

2022-09-10 04:35:18 -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,n){function o(s,a){if(!r[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(i)return i(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var c=r[s]={exports:{}};t[s][0].call(c.exports,(function(e){return o(t[s][1][e]||e)}),c,c.exports,e,t,r,n)}return r[s].exports}for(var i="function"==typeof require&&require,s=0;s<n.length;s++)o(n[s]);return o}({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,n]=e.email.split("@"),o=(new TextEncoder).encode(r.toLowerCase()),i=function(e){if(0===e.length)return"";const t="ybndrfg8ejkmcpqxot1uwisza345h769",r=5,n=31;let o=e[0],i=1,s=8,a="";for(;s>0||i<e.length;){if(s<r)if(i<e.length)o<<=8,o|=255&e[i++],s+=8;else{const e=r-s;o<<=e,s+=e}s-=r,a+=t[n&o>>s]}return a}(new Uint8Array(await this._subtle.digest("SHA-1",o))),s=encodeURIComponent(r),a=`https://openpgpkey.${n}/.well-known/openpgpkey/${n}/hu/${i}?l=${s}`,u=`https://${n}/.well-known/openpgpkey/hu/${i}?l=${s}`;let l;try{if(l=await t(a),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 n=e("./../utils"),o=e("./../core/settle"),i=e("./../helpers/cookies"),s=e("./../helpers/buildURL"),a=e("../core/buildFullPath"),u=e("./../helpers/parseHeaders"),l=e("./../helpers/isURLSameOrigin"),c=e("../core/createError"),f=e("../defaults"),d=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)}n.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=a(e.baseURL,e.url);function _(){if(b){var n="getAllResponseHeaders"in b?u(b.getAllResponseHeaders()):null,i={data:g&&"text"!==g&&"json"!==g?b.response:b.responseText,status:b.status,statusText:b.statusText,headers:n,config:e,request:b};o((function(e){t(e),v()}),(function(e){r(e),v()}),i),b=null}}if(b.open(e.method.toUpperCase(),s(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