diff --git a/CHANGELOG.md b/CHANGELOG.md index b4d72dc..144f6d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.12.0] - 2021-04-22 +## Added +- Server functionality +- Proxy server functionality +- JSDoc-based documentation +## Changed +- Improved data fetching logic +## Fixed +- Bug causing false positive verification + ## [0.11.2] - 2021-03-06 ## Fixed - Matrix.to URLs diff --git a/dist/doip.js b/dist/doip.js index dfc97ef..517c258 100644 --- a/dist/doip.js +++ b/dist/doip.js @@ -1,4 +1,4 @@ -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.doip = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i async (_u module.exports = core(mkrequest) -},{"./core":2}],2:[function(require,module,exports){ +},{"./core":"/home/yarmo/dev/doip/doipjs/node_modules/bent/src/core.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/bent/src/core.js":[function(require,module,exports){ 'use strict' const encodings = new Set(['json', 'buffer', 'string']) @@ -129,9 +129,43 @@ module.exports = mkrequest => (...args) => { return mkrequest(statusCodes, method, encoding, headers, baseurl) } -},{}],3:[function(require,module,exports){ +},{}],"/home/yarmo/dev/doip/doipjs/node_modules/browser-or-node/lib/index.js":[function(require,module,exports){ +(function (process){(function (){ +'use strict'; -},{}],4:[function(require,module,exports){ +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +/* global window self */ + +var isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined'; + +/* eslint-disable no-restricted-globals */ +var isWebWorker = (typeof self === 'undefined' ? 'undefined' : _typeof(self)) === 'object' && self.constructor && self.constructor.name === 'DedicatedWorkerGlobalScope'; +/* eslint-enable no-restricted-globals */ + +var isNode = typeof process !== 'undefined' && process.versions != null && process.versions.node != null; + +/** + * @see https://github.com/jsdom/jsdom/releases/tag/12.0.0 + * @see https://github.com/jsdom/jsdom/issues/1537 + */ +/* eslint-disable no-undef */ +var isJsDom = function isJsDom() { + return typeof window !== 'undefined' && window.name === 'nodejs' || navigator.userAgent.includes('Node.js') || navigator.userAgent.includes('jsdom'); +}; + +exports.isBrowser = isBrowser; +exports.isWebWorker = isWebWorker; +exports.isNode = isNode; +exports.isJsDom = isJsDom; +}).call(this)}).call(this,require('_process')) +},{"_process":"/home/yarmo/dev/doip/doipjs/node_modules/process/browser.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/browserify/lib/_empty.js":[function(require,module,exports){ + +},{}],"/home/yarmo/dev/doip/doipjs/node_modules/decode-uri-component/index.js":[function(require,module,exports){ 'use strict'; var token = '%[a-f0-9]{2}'; var singleMatcher = new RegExp(token, 'gi'); @@ -227,7 +261,7 @@ module.exports = function (encodedURI) { } }; -},{}],5:[function(require,module,exports){ +},{}],"/home/yarmo/dev/doip/doipjs/node_modules/filter-obj/index.js":[function(require,module,exports){ 'use strict'; module.exports = function (obj, predicate) { var ret = {}; @@ -246,7 +280,7 @@ module.exports = function (obj, predicate) { return ret; }; -},{}],6:[function(require,module,exports){ +},{}],"/home/yarmo/dev/doip/doipjs/node_modules/is-plain-obj/index.js":[function(require,module,exports){ 'use strict'; module.exports = value => { @@ -258,7 +292,7 @@ module.exports = value => { return prototype === null || prototype === Object.prototype; }; -},{}],7:[function(require,module,exports){ +},{}],"/home/yarmo/dev/doip/doipjs/node_modules/merge-options/index.js":[function(require,module,exports){ 'use strict'; const isOptionObject = require('is-plain-obj'); @@ -431,540 +465,7 @@ module.exports = function (...options) { return merged._; }; -},{"is-plain-obj":6}],8:[function(require,module,exports){ -(function (process){(function (){ -// 'path' module extracted from Node.js v8.11.1 (only the posix part) -// transplited with Babel - -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -'use strict'; - -function assertPath(path) { - if (typeof path !== 'string') { - throw new TypeError('Path must be a string. Received ' + JSON.stringify(path)); - } -} - -// Resolves . and .. elements in a path with directory names -function normalizeStringPosix(path, allowAboveRoot) { - var res = ''; - var lastSegmentLength = 0; - var lastSlash = -1; - var dots = 0; - var code; - for (var i = 0; i <= path.length; ++i) { - if (i < path.length) - code = path.charCodeAt(i); - else if (code === 47 /*/*/) - break; - else - code = 47 /*/*/; - if (code === 47 /*/*/) { - if (lastSlash === i - 1 || dots === 1) { - // NOOP - } else if (lastSlash !== i - 1 && dots === 2) { - if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== 46 /*.*/ || res.charCodeAt(res.length - 2) !== 46 /*.*/) { - if (res.length > 2) { - var lastSlashIndex = res.lastIndexOf('/'); - if (lastSlashIndex !== res.length - 1) { - if (lastSlashIndex === -1) { - res = ''; - lastSegmentLength = 0; - } else { - res = res.slice(0, lastSlashIndex); - lastSegmentLength = res.length - 1 - res.lastIndexOf('/'); - } - lastSlash = i; - dots = 0; - continue; - } - } else if (res.length === 2 || res.length === 1) { - res = ''; - lastSegmentLength = 0; - lastSlash = i; - dots = 0; - continue; - } - } - if (allowAboveRoot) { - if (res.length > 0) - res += '/..'; - else - res = '..'; - lastSegmentLength = 2; - } - } else { - if (res.length > 0) - res += '/' + path.slice(lastSlash + 1, i); - else - res = path.slice(lastSlash + 1, i); - lastSegmentLength = i - lastSlash - 1; - } - lastSlash = i; - dots = 0; - } else if (code === 46 /*.*/ && dots !== -1) { - ++dots; - } else { - dots = -1; - } - } - return res; -} - -function _format(sep, pathObject) { - var dir = pathObject.dir || pathObject.root; - var base = pathObject.base || (pathObject.name || '') + (pathObject.ext || ''); - if (!dir) { - return base; - } - if (dir === pathObject.root) { - return dir + base; - } - return dir + sep + base; -} - -var posix = { - // path.resolve([from ...], to) - resolve: function resolve() { - var resolvedPath = ''; - var resolvedAbsolute = false; - var cwd; - - for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { - var path; - if (i >= 0) - path = arguments[i]; - else { - if (cwd === undefined) - cwd = process.cwd(); - path = cwd; - } - - assertPath(path); - - // Skip empty entries - if (path.length === 0) { - continue; - } - - resolvedPath = path + '/' + resolvedPath; - resolvedAbsolute = path.charCodeAt(0) === 47 /*/*/; - } - - // At this point the path should be resolved to a full absolute path, but - // handle relative paths to be safe (might happen when process.cwd() fails) - - // Normalize the path - resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute); - - if (resolvedAbsolute) { - if (resolvedPath.length > 0) - return '/' + resolvedPath; - else - return '/'; - } else if (resolvedPath.length > 0) { - return resolvedPath; - } else { - return '.'; - } - }, - - normalize: function normalize(path) { - assertPath(path); - - if (path.length === 0) return '.'; - - var isAbsolute = path.charCodeAt(0) === 47 /*/*/; - var trailingSeparator = path.charCodeAt(path.length - 1) === 47 /*/*/; - - // Normalize the path - path = normalizeStringPosix(path, !isAbsolute); - - if (path.length === 0 && !isAbsolute) path = '.'; - if (path.length > 0 && trailingSeparator) path += '/'; - - if (isAbsolute) return '/' + path; - return path; - }, - - isAbsolute: function isAbsolute(path) { - assertPath(path); - return path.length > 0 && path.charCodeAt(0) === 47 /*/*/; - }, - - join: function join() { - if (arguments.length === 0) - return '.'; - var joined; - for (var i = 0; i < arguments.length; ++i) { - var arg = arguments[i]; - assertPath(arg); - if (arg.length > 0) { - if (joined === undefined) - joined = arg; - else - joined += '/' + arg; - } - } - if (joined === undefined) - return '.'; - return posix.normalize(joined); - }, - - relative: function relative(from, to) { - assertPath(from); - assertPath(to); - - if (from === to) return ''; - - from = posix.resolve(from); - to = posix.resolve(to); - - if (from === to) return ''; - - // Trim any leading backslashes - var fromStart = 1; - for (; fromStart < from.length; ++fromStart) { - if (from.charCodeAt(fromStart) !== 47 /*/*/) - break; - } - var fromEnd = from.length; - var fromLen = fromEnd - fromStart; - - // Trim any leading backslashes - var toStart = 1; - for (; toStart < to.length; ++toStart) { - if (to.charCodeAt(toStart) !== 47 /*/*/) - break; - } - var toEnd = to.length; - var toLen = toEnd - toStart; - - // Compare paths to find the longest common path from root - var length = fromLen < toLen ? fromLen : toLen; - var lastCommonSep = -1; - var i = 0; - for (; i <= length; ++i) { - if (i === length) { - if (toLen > length) { - if (to.charCodeAt(toStart + i) === 47 /*/*/) { - // We get here if `from` is the exact base path for `to`. - // For example: from='/foo/bar'; to='/foo/bar/baz' - return to.slice(toStart + i + 1); - } else if (i === 0) { - // We get here if `from` is the root - // For example: from='/'; to='/foo' - return to.slice(toStart + i); - } - } else if (fromLen > length) { - if (from.charCodeAt(fromStart + i) === 47 /*/*/) { - // We get here if `to` is the exact base path for `from`. - // For example: from='/foo/bar/baz'; to='/foo/bar' - lastCommonSep = i; - } else if (i === 0) { - // We get here if `to` is the root. - // For example: from='/foo'; to='/' - lastCommonSep = 0; - } - } - break; - } - var fromCode = from.charCodeAt(fromStart + i); - var toCode = to.charCodeAt(toStart + i); - if (fromCode !== toCode) - break; - else if (fromCode === 47 /*/*/) - lastCommonSep = i; - } - - var out = ''; - // Generate the relative path based on the path difference between `to` - // and `from` - for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) { - if (i === fromEnd || from.charCodeAt(i) === 47 /*/*/) { - if (out.length === 0) - out += '..'; - else - out += '/..'; - } - } - - // Lastly, append the rest of the destination (`to`) path that comes after - // the common path parts - if (out.length > 0) - return out + to.slice(toStart + lastCommonSep); - else { - toStart += lastCommonSep; - if (to.charCodeAt(toStart) === 47 /*/*/) - ++toStart; - return to.slice(toStart); - } - }, - - _makeLong: function _makeLong(path) { - return path; - }, - - dirname: function dirname(path) { - assertPath(path); - if (path.length === 0) return '.'; - var code = path.charCodeAt(0); - var hasRoot = code === 47 /*/*/; - var end = -1; - var matchedSlash = true; - for (var i = path.length - 1; i >= 1; --i) { - code = path.charCodeAt(i); - if (code === 47 /*/*/) { - if (!matchedSlash) { - end = i; - break; - } - } else { - // We saw the first non-path separator - matchedSlash = false; - } - } - - if (end === -1) return hasRoot ? '/' : '.'; - if (hasRoot && end === 1) return '//'; - return path.slice(0, end); - }, - - basename: function basename(path, ext) { - if (ext !== undefined && typeof ext !== 'string') throw new TypeError('"ext" argument must be a string'); - assertPath(path); - - var start = 0; - var end = -1; - var matchedSlash = true; - var i; - - if (ext !== undefined && ext.length > 0 && ext.length <= path.length) { - if (ext.length === path.length && ext === path) return ''; - var extIdx = ext.length - 1; - var firstNonSlashEnd = -1; - for (i = path.length - 1; i >= 0; --i) { - var code = path.charCodeAt(i); - if (code === 47 /*/*/) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - start = i + 1; - break; - } - } else { - if (firstNonSlashEnd === -1) { - // We saw the first non-path separator, remember this index in case - // we need it if the extension ends up not matching - matchedSlash = false; - firstNonSlashEnd = i + 1; - } - if (extIdx >= 0) { - // Try to match the explicit extension - if (code === ext.charCodeAt(extIdx)) { - if (--extIdx === -1) { - // We matched the extension, so mark this as the end of our path - // component - end = i; - } - } else { - // Extension does not match, so our result is the entire path - // component - extIdx = -1; - end = firstNonSlashEnd; - } - } - } - } - - if (start === end) end = firstNonSlashEnd;else if (end === -1) end = path.length; - return path.slice(start, end); - } else { - for (i = path.length - 1; i >= 0; --i) { - if (path.charCodeAt(i) === 47 /*/*/) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - start = i + 1; - break; - } - } else if (end === -1) { - // We saw the first non-path separator, mark this as the end of our - // path component - matchedSlash = false; - end = i + 1; - } - } - - if (end === -1) return ''; - return path.slice(start, end); - } - }, - - extname: function extname(path) { - assertPath(path); - var startDot = -1; - var startPart = 0; - var end = -1; - var matchedSlash = true; - // Track the state of characters (if any) we see before our first dot and - // after any path separator we find - var preDotState = 0; - for (var i = path.length - 1; i >= 0; --i) { - var code = path.charCodeAt(i); - if (code === 47 /*/*/) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - startPart = i + 1; - break; - } - continue; - } - if (end === -1) { - // We saw the first non-path separator, mark this as the end of our - // extension - matchedSlash = false; - end = i + 1; - } - if (code === 46 /*.*/) { - // If this is our first dot, mark it as the start of our extension - if (startDot === -1) - startDot = i; - else if (preDotState !== 1) - preDotState = 1; - } else if (startDot !== -1) { - // We saw a non-dot and non-path separator before our dot, so we should - // have a good chance at having a non-empty extension - preDotState = -1; - } - } - - if (startDot === -1 || end === -1 || - // We saw a non-dot character immediately before the dot - preDotState === 0 || - // The (right-most) trimmed path component is exactly '..' - preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) { - return ''; - } - return path.slice(startDot, end); - }, - - format: function format(pathObject) { - if (pathObject === null || typeof pathObject !== 'object') { - throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof pathObject); - } - return _format('/', pathObject); - }, - - parse: function parse(path) { - assertPath(path); - - var ret = { root: '', dir: '', base: '', ext: '', name: '' }; - if (path.length === 0) return ret; - var code = path.charCodeAt(0); - var isAbsolute = code === 47 /*/*/; - var start; - if (isAbsolute) { - ret.root = '/'; - start = 1; - } else { - start = 0; - } - var startDot = -1; - var startPart = 0; - var end = -1; - var matchedSlash = true; - var i = path.length - 1; - - // Track the state of characters (if any) we see before our first dot and - // after any path separator we find - var preDotState = 0; - - // Get non-dir info - for (; i >= start; --i) { - code = path.charCodeAt(i); - if (code === 47 /*/*/) { - // If we reached a path separator that was not part of a set of path - // separators at the end of the string, stop now - if (!matchedSlash) { - startPart = i + 1; - break; - } - continue; - } - if (end === -1) { - // We saw the first non-path separator, mark this as the end of our - // extension - matchedSlash = false; - end = i + 1; - } - if (code === 46 /*.*/) { - // If this is our first dot, mark it as the start of our extension - if (startDot === -1) startDot = i;else if (preDotState !== 1) preDotState = 1; - } else if (startDot !== -1) { - // We saw a non-dot and non-path separator before our dot, so we should - // have a good chance at having a non-empty extension - preDotState = -1; - } - } - - if (startDot === -1 || end === -1 || - // We saw a non-dot character immediately before the dot - preDotState === 0 || - // The (right-most) trimmed path component is exactly '..' - preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) { - if (end !== -1) { - if (startPart === 0 && isAbsolute) ret.base = ret.name = path.slice(1, end);else ret.base = ret.name = path.slice(startPart, end); - } - } else { - if (startPart === 0 && isAbsolute) { - ret.name = path.slice(1, startDot); - ret.base = path.slice(1, end); - } else { - ret.name = path.slice(startPart, startDot); - ret.base = path.slice(startPart, end); - } - ret.ext = path.slice(startDot, end); - } - - if (startPart > 0) ret.dir = path.slice(0, startPart - 1);else if (isAbsolute) ret.dir = '/'; - - return ret; - }, - - sep: '/', - delimiter: ':', - win32: null, - posix: null -}; - -posix.posix = posix; - -module.exports = posix; - -}).call(this)}).call(this,require('_process')) -},{"_process":9}],9:[function(require,module,exports){ +},{"is-plain-obj":"/home/yarmo/dev/doip/doipjs/node_modules/is-plain-obj/index.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/process/browser.js":[function(require,module,exports){ // shim for using process in browser var process = module.exports = {}; @@ -1150,7 +651,7 @@ process.chdir = function (dir) { }; process.umask = function() { return 0; }; -},{}],10:[function(require,module,exports){ +},{}],"/home/yarmo/dev/doip/doipjs/node_modules/query-string/index.js":[function(require,module,exports){ 'use strict'; const strictUriEncode = require('strict-uri-encode'); const decodeComponent = require('decode-uri-component'); @@ -1556,7 +1057,7 @@ exports.exclude = (input, filter, options) => { return exports.pick(input, exclusionFilter, options); }; -},{"decode-uri-component":4,"filter-obj":5,"split-on-first":11,"strict-uri-encode":12}],11:[function(require,module,exports){ +},{"decode-uri-component":"/home/yarmo/dev/doip/doipjs/node_modules/decode-uri-component/index.js","filter-obj":"/home/yarmo/dev/doip/doipjs/node_modules/filter-obj/index.js","split-on-first":"/home/yarmo/dev/doip/doipjs/node_modules/split-on-first/index.js","strict-uri-encode":"/home/yarmo/dev/doip/doipjs/node_modules/strict-uri-encode/index.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/split-on-first/index.js":[function(require,module,exports){ 'use strict'; module.exports = (string, separator) => { @@ -1580,11 +1081,11 @@ module.exports = (string, separator) => { ]; }; -},{}],12:[function(require,module,exports){ +},{}],"/home/yarmo/dev/doip/doipjs/node_modules/strict-uri-encode/index.js":[function(require,module,exports){ 'use strict'; module.exports = str => encodeURIComponent(str).replace(/[!'()*]/g, x => `%${x.charCodeAt(0).toString(16).toUpperCase()}`); -},{}],13:[function(require,module,exports){ +},{}],"/home/yarmo/dev/doip/doipjs/node_modules/valid-url/index.js":[function(require,module,exports){ (function(module) { 'use strict'; @@ -1739,40 +1240,6327 @@ module.exports = str => encodeURIComponent(str).replace(/[!'()*]/g, x => `%${x.c })(module); -},{}],14:[function(require,module,exports){ +},{}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/index.js":[function(require,module,exports){ +"use strict"; + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var _toDate = _interopRequireDefault(require("./lib/toDate")); + +var _toFloat = _interopRequireDefault(require("./lib/toFloat")); + +var _toInt = _interopRequireDefault(require("./lib/toInt")); + +var _toBoolean = _interopRequireDefault(require("./lib/toBoolean")); + +var _equals = _interopRequireDefault(require("./lib/equals")); + +var _contains = _interopRequireDefault(require("./lib/contains")); + +var _matches = _interopRequireDefault(require("./lib/matches")); + +var _isEmail = _interopRequireDefault(require("./lib/isEmail")); + +var _isURL = _interopRequireDefault(require("./lib/isURL")); + +var _isMACAddress = _interopRequireDefault(require("./lib/isMACAddress")); + +var _isIP = _interopRequireDefault(require("./lib/isIP")); + +var _isIPRange = _interopRequireDefault(require("./lib/isIPRange")); + +var _isFQDN = _interopRequireDefault(require("./lib/isFQDN")); + +var _isDate = _interopRequireDefault(require("./lib/isDate")); + +var _isBoolean = _interopRequireDefault(require("./lib/isBoolean")); + +var _isLocale = _interopRequireDefault(require("./lib/isLocale")); + +var _isAlpha = _interopRequireWildcard(require("./lib/isAlpha")); + +var _isAlphanumeric = _interopRequireWildcard(require("./lib/isAlphanumeric")); + +var _isNumeric = _interopRequireDefault(require("./lib/isNumeric")); + +var _isPassportNumber = _interopRequireDefault(require("./lib/isPassportNumber")); + +var _isPort = _interopRequireDefault(require("./lib/isPort")); + +var _isLowercase = _interopRequireDefault(require("./lib/isLowercase")); + +var _isUppercase = _interopRequireDefault(require("./lib/isUppercase")); + +var _isIMEI = _interopRequireDefault(require("./lib/isIMEI")); + +var _isAscii = _interopRequireDefault(require("./lib/isAscii")); + +var _isFullWidth = _interopRequireDefault(require("./lib/isFullWidth")); + +var _isHalfWidth = _interopRequireDefault(require("./lib/isHalfWidth")); + +var _isVariableWidth = _interopRequireDefault(require("./lib/isVariableWidth")); + +var _isMultibyte = _interopRequireDefault(require("./lib/isMultibyte")); + +var _isSemVer = _interopRequireDefault(require("./lib/isSemVer")); + +var _isSurrogatePair = _interopRequireDefault(require("./lib/isSurrogatePair")); + +var _isInt = _interopRequireDefault(require("./lib/isInt")); + +var _isFloat = _interopRequireWildcard(require("./lib/isFloat")); + +var _isDecimal = _interopRequireDefault(require("./lib/isDecimal")); + +var _isHexadecimal = _interopRequireDefault(require("./lib/isHexadecimal")); + +var _isOctal = _interopRequireDefault(require("./lib/isOctal")); + +var _isDivisibleBy = _interopRequireDefault(require("./lib/isDivisibleBy")); + +var _isHexColor = _interopRequireDefault(require("./lib/isHexColor")); + +var _isRgbColor = _interopRequireDefault(require("./lib/isRgbColor")); + +var _isHSL = _interopRequireDefault(require("./lib/isHSL")); + +var _isISRC = _interopRequireDefault(require("./lib/isISRC")); + +var _isIBAN = _interopRequireDefault(require("./lib/isIBAN")); + +var _isBIC = _interopRequireDefault(require("./lib/isBIC")); + +var _isMD = _interopRequireDefault(require("./lib/isMD5")); + +var _isHash = _interopRequireDefault(require("./lib/isHash")); + +var _isJWT = _interopRequireDefault(require("./lib/isJWT")); + +var _isJSON = _interopRequireDefault(require("./lib/isJSON")); + +var _isEmpty = _interopRequireDefault(require("./lib/isEmpty")); + +var _isLength = _interopRequireDefault(require("./lib/isLength")); + +var _isByteLength = _interopRequireDefault(require("./lib/isByteLength")); + +var _isUUID = _interopRequireDefault(require("./lib/isUUID")); + +var _isMongoId = _interopRequireDefault(require("./lib/isMongoId")); + +var _isAfter = _interopRequireDefault(require("./lib/isAfter")); + +var _isBefore = _interopRequireDefault(require("./lib/isBefore")); + +var _isIn = _interopRequireDefault(require("./lib/isIn")); + +var _isCreditCard = _interopRequireDefault(require("./lib/isCreditCard")); + +var _isIdentityCard = _interopRequireDefault(require("./lib/isIdentityCard")); + +var _isEAN = _interopRequireDefault(require("./lib/isEAN")); + +var _isISIN = _interopRequireDefault(require("./lib/isISIN")); + +var _isISBN = _interopRequireDefault(require("./lib/isISBN")); + +var _isISSN = _interopRequireDefault(require("./lib/isISSN")); + +var _isTaxID = _interopRequireDefault(require("./lib/isTaxID")); + +var _isMobilePhone = _interopRequireWildcard(require("./lib/isMobilePhone")); + +var _isEthereumAddress = _interopRequireDefault(require("./lib/isEthereumAddress")); + +var _isCurrency = _interopRequireDefault(require("./lib/isCurrency")); + +var _isBtcAddress = _interopRequireDefault(require("./lib/isBtcAddress")); + +var _isISO = _interopRequireDefault(require("./lib/isISO8601")); + +var _isRFC = _interopRequireDefault(require("./lib/isRFC3339")); + +var _isISO31661Alpha = _interopRequireDefault(require("./lib/isISO31661Alpha2")); + +var _isISO31661Alpha2 = _interopRequireDefault(require("./lib/isISO31661Alpha3")); + +var _isBase = _interopRequireDefault(require("./lib/isBase32")); + +var _isBase2 = _interopRequireDefault(require("./lib/isBase58")); + +var _isBase3 = _interopRequireDefault(require("./lib/isBase64")); + +var _isDataURI = _interopRequireDefault(require("./lib/isDataURI")); + +var _isMagnetURI = _interopRequireDefault(require("./lib/isMagnetURI")); + +var _isMimeType = _interopRequireDefault(require("./lib/isMimeType")); + +var _isLatLong = _interopRequireDefault(require("./lib/isLatLong")); + +var _isPostalCode = _interopRequireWildcard(require("./lib/isPostalCode")); + +var _ltrim = _interopRequireDefault(require("./lib/ltrim")); + +var _rtrim = _interopRequireDefault(require("./lib/rtrim")); + +var _trim = _interopRequireDefault(require("./lib/trim")); + +var _escape = _interopRequireDefault(require("./lib/escape")); + +var _unescape = _interopRequireDefault(require("./lib/unescape")); + +var _stripLow = _interopRequireDefault(require("./lib/stripLow")); + +var _whitelist = _interopRequireDefault(require("./lib/whitelist")); + +var _blacklist = _interopRequireDefault(require("./lib/blacklist")); + +var _isWhitelisted = _interopRequireDefault(require("./lib/isWhitelisted")); + +var _normalizeEmail = _interopRequireDefault(require("./lib/normalizeEmail")); + +var _isSlug = _interopRequireDefault(require("./lib/isSlug")); + +var _isStrongPassword = _interopRequireDefault(require("./lib/isStrongPassword")); + +var _isVAT = _interopRequireDefault(require("./lib/isVAT")); + +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var version = '13.5.2'; +var validator = { + version: version, + toDate: _toDate.default, + toFloat: _toFloat.default, + toInt: _toInt.default, + toBoolean: _toBoolean.default, + equals: _equals.default, + contains: _contains.default, + matches: _matches.default, + isEmail: _isEmail.default, + isURL: _isURL.default, + isMACAddress: _isMACAddress.default, + isIP: _isIP.default, + isIPRange: _isIPRange.default, + isFQDN: _isFQDN.default, + isBoolean: _isBoolean.default, + isIBAN: _isIBAN.default, + isBIC: _isBIC.default, + isAlpha: _isAlpha.default, + isAlphaLocales: _isAlpha.locales, + isAlphanumeric: _isAlphanumeric.default, + isAlphanumericLocales: _isAlphanumeric.locales, + isNumeric: _isNumeric.default, + isPassportNumber: _isPassportNumber.default, + isPort: _isPort.default, + isLowercase: _isLowercase.default, + isUppercase: _isUppercase.default, + isAscii: _isAscii.default, + isFullWidth: _isFullWidth.default, + isHalfWidth: _isHalfWidth.default, + isVariableWidth: _isVariableWidth.default, + isMultibyte: _isMultibyte.default, + isSemVer: _isSemVer.default, + isSurrogatePair: _isSurrogatePair.default, + isInt: _isInt.default, + isIMEI: _isIMEI.default, + isFloat: _isFloat.default, + isFloatLocales: _isFloat.locales, + isDecimal: _isDecimal.default, + isHexadecimal: _isHexadecimal.default, + isOctal: _isOctal.default, + isDivisibleBy: _isDivisibleBy.default, + isHexColor: _isHexColor.default, + isRgbColor: _isRgbColor.default, + isHSL: _isHSL.default, + isISRC: _isISRC.default, + isMD5: _isMD.default, + isHash: _isHash.default, + isJWT: _isJWT.default, + isJSON: _isJSON.default, + isEmpty: _isEmpty.default, + isLength: _isLength.default, + isLocale: _isLocale.default, + isByteLength: _isByteLength.default, + isUUID: _isUUID.default, + isMongoId: _isMongoId.default, + isAfter: _isAfter.default, + isBefore: _isBefore.default, + isIn: _isIn.default, + isCreditCard: _isCreditCard.default, + isIdentityCard: _isIdentityCard.default, + isEAN: _isEAN.default, + isISIN: _isISIN.default, + isISBN: _isISBN.default, + isISSN: _isISSN.default, + isMobilePhone: _isMobilePhone.default, + isMobilePhoneLocales: _isMobilePhone.locales, + isPostalCode: _isPostalCode.default, + isPostalCodeLocales: _isPostalCode.locales, + isEthereumAddress: _isEthereumAddress.default, + isCurrency: _isCurrency.default, + isBtcAddress: _isBtcAddress.default, + isISO8601: _isISO.default, + isRFC3339: _isRFC.default, + isISO31661Alpha2: _isISO31661Alpha.default, + isISO31661Alpha3: _isISO31661Alpha2.default, + isBase32: _isBase.default, + isBase58: _isBase2.default, + isBase64: _isBase3.default, + isDataURI: _isDataURI.default, + isMagnetURI: _isMagnetURI.default, + isMimeType: _isMimeType.default, + isLatLong: _isLatLong.default, + ltrim: _ltrim.default, + rtrim: _rtrim.default, + trim: _trim.default, + escape: _escape.default, + unescape: _unescape.default, + stripLow: _stripLow.default, + whitelist: _whitelist.default, + blacklist: _blacklist.default, + isWhitelisted: _isWhitelisted.default, + normalizeEmail: _normalizeEmail.default, + toString: toString, + isSlug: _isSlug.default, + isStrongPassword: _isStrongPassword.default, + isTaxID: _isTaxID.default, + isDate: _isDate.default, + isVAT: _isVAT.default +}; +var _default = validator; +exports.default = _default; +module.exports = exports.default; +module.exports.default = exports.default; +},{"./lib/blacklist":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/blacklist.js","./lib/contains":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/contains.js","./lib/equals":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/equals.js","./lib/escape":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/escape.js","./lib/isAfter":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isAfter.js","./lib/isAlpha":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isAlpha.js","./lib/isAlphanumeric":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isAlphanumeric.js","./lib/isAscii":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isAscii.js","./lib/isBIC":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isBIC.js","./lib/isBase32":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isBase32.js","./lib/isBase58":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isBase58.js","./lib/isBase64":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isBase64.js","./lib/isBefore":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isBefore.js","./lib/isBoolean":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isBoolean.js","./lib/isBtcAddress":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isBtcAddress.js","./lib/isByteLength":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isByteLength.js","./lib/isCreditCard":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isCreditCard.js","./lib/isCurrency":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isCurrency.js","./lib/isDataURI":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isDataURI.js","./lib/isDate":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isDate.js","./lib/isDecimal":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isDecimal.js","./lib/isDivisibleBy":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isDivisibleBy.js","./lib/isEAN":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isEAN.js","./lib/isEmail":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isEmail.js","./lib/isEmpty":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isEmpty.js","./lib/isEthereumAddress":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isEthereumAddress.js","./lib/isFQDN":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isFQDN.js","./lib/isFloat":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isFloat.js","./lib/isFullWidth":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isFullWidth.js","./lib/isHSL":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isHSL.js","./lib/isHalfWidth":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isHalfWidth.js","./lib/isHash":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isHash.js","./lib/isHexColor":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isHexColor.js","./lib/isHexadecimal":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isHexadecimal.js","./lib/isIBAN":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isIBAN.js","./lib/isIMEI":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isIMEI.js","./lib/isIP":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isIP.js","./lib/isIPRange":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isIPRange.js","./lib/isISBN":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isISBN.js","./lib/isISIN":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isISIN.js","./lib/isISO31661Alpha2":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isISO31661Alpha2.js","./lib/isISO31661Alpha3":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isISO31661Alpha3.js","./lib/isISO8601":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isISO8601.js","./lib/isISRC":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isISRC.js","./lib/isISSN":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isISSN.js","./lib/isIdentityCard":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isIdentityCard.js","./lib/isIn":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isIn.js","./lib/isInt":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isInt.js","./lib/isJSON":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isJSON.js","./lib/isJWT":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isJWT.js","./lib/isLatLong":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isLatLong.js","./lib/isLength":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isLength.js","./lib/isLocale":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isLocale.js","./lib/isLowercase":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isLowercase.js","./lib/isMACAddress":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isMACAddress.js","./lib/isMD5":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isMD5.js","./lib/isMagnetURI":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isMagnetURI.js","./lib/isMimeType":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isMimeType.js","./lib/isMobilePhone":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isMobilePhone.js","./lib/isMongoId":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isMongoId.js","./lib/isMultibyte":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isMultibyte.js","./lib/isNumeric":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isNumeric.js","./lib/isOctal":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isOctal.js","./lib/isPassportNumber":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isPassportNumber.js","./lib/isPort":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isPort.js","./lib/isPostalCode":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isPostalCode.js","./lib/isRFC3339":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isRFC3339.js","./lib/isRgbColor":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isRgbColor.js","./lib/isSemVer":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isSemVer.js","./lib/isSlug":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isSlug.js","./lib/isStrongPassword":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isStrongPassword.js","./lib/isSurrogatePair":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isSurrogatePair.js","./lib/isTaxID":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isTaxID.js","./lib/isURL":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isURL.js","./lib/isUUID":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isUUID.js","./lib/isUppercase":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isUppercase.js","./lib/isVAT":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isVAT.js","./lib/isVariableWidth":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isVariableWidth.js","./lib/isWhitelisted":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isWhitelisted.js","./lib/ltrim":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/ltrim.js","./lib/matches":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/matches.js","./lib/normalizeEmail":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/normalizeEmail.js","./lib/rtrim":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/rtrim.js","./lib/stripLow":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/stripLow.js","./lib/toBoolean":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/toBoolean.js","./lib/toDate":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/toDate.js","./lib/toFloat":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/toFloat.js","./lib/toInt":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/toInt.js","./lib/trim":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/trim.js","./lib/unescape":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/unescape.js","./lib/whitelist":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/whitelist.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/alpha.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.commaDecimal = exports.dotDecimal = exports.farsiLocales = exports.arabicLocales = exports.englishLocales = exports.decimal = exports.alphanumeric = exports.alpha = void 0; +var alpha = { + 'en-US': /^[A-Z]+$/i, + 'az-AZ': /^[A-VXYZÇƏĞİıÖŞÜ]+$/i, + 'bg-BG': /^[А-Я]+$/i, + 'cs-CZ': /^[A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i, + 'da-DK': /^[A-ZÆØÅ]+$/i, + 'de-DE': /^[A-ZÄÖÜß]+$/i, + 'el-GR': /^[Α-ώ]+$/i, + 'es-ES': /^[A-ZÁÉÍÑÓÚÜ]+$/i, + 'fa-IR': /^[ابپتثجچحخدذرزژسشصضطظعغفقکگلمنوهی]+$/i, + 'fr-FR': /^[A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i, + 'it-IT': /^[A-ZÀÉÈÌÎÓÒÙ]+$/i, + 'nb-NO': /^[A-ZÆØÅ]+$/i, + 'nl-NL': /^[A-ZÁÉËÏÓÖÜÚ]+$/i, + 'nn-NO': /^[A-ZÆØÅ]+$/i, + 'hu-HU': /^[A-ZÁÉÍÓÖŐÚÜŰ]+$/i, + 'pl-PL': /^[A-ZĄĆĘŚŁŃÓŻŹ]+$/i, + 'pt-PT': /^[A-ZÃÁÀÂÄÇÉÊËÍÏÕÓÔÖÚÜ]+$/i, + 'ru-RU': /^[А-ЯЁ]+$/i, + 'sl-SI': /^[A-ZČĆĐŠŽ]+$/i, + 'sk-SK': /^[A-ZÁČĎÉÍŇÓŠŤÚÝŽĹŔĽÄÔ]+$/i, + 'sr-RS@latin': /^[A-ZČĆŽŠĐ]+$/i, + 'sr-RS': /^[А-ЯЂЈЉЊЋЏ]+$/i, + 'sv-SE': /^[A-ZÅÄÖ]+$/i, + 'th-TH': /^[ก-๐\s]+$/i, + 'tr-TR': /^[A-ZÇĞİıÖŞÜ]+$/i, + 'uk-UA': /^[А-ЩЬЮЯЄIЇҐі]+$/i, + 'vi-VN': /^[A-ZÀÁẠẢÃÂẦẤẬẨẪĂẰẮẶẲẴĐÈÉẸẺẼÊỀẾỆỂỄÌÍỊỈĨÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠÙÚỤỦŨƯỪỨỰỬỮỲÝỴỶỸ]+$/i, + 'ku-IQ': /^[ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i, + ar: /^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/, + he: /^[א-ת]+$/, + fa: /^['آاءأؤئبپتثجچحخدذرزژسشصضطظعغفقکگلمنوهةی']+$/i +}; +exports.alpha = alpha; +var alphanumeric = { + 'en-US': /^[0-9A-Z]+$/i, + 'az-AZ': /^[0-9A-VXYZÇƏĞİıÖŞÜ]+$/i, + 'bg-BG': /^[0-9А-Я]+$/i, + 'cs-CZ': /^[0-9A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i, + 'da-DK': /^[0-9A-ZÆØÅ]+$/i, + 'de-DE': /^[0-9A-ZÄÖÜß]+$/i, + 'el-GR': /^[0-9Α-ω]+$/i, + 'es-ES': /^[0-9A-ZÁÉÍÑÓÚÜ]+$/i, + 'fr-FR': /^[0-9A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i, + 'it-IT': /^[0-9A-ZÀÉÈÌÎÓÒÙ]+$/i, + 'hu-HU': /^[0-9A-ZÁÉÍÓÖŐÚÜŰ]+$/i, + 'nb-NO': /^[0-9A-ZÆØÅ]+$/i, + 'nl-NL': /^[0-9A-ZÁÉËÏÓÖÜÚ]+$/i, + 'nn-NO': /^[0-9A-ZÆØÅ]+$/i, + 'pl-PL': /^[0-9A-ZĄĆĘŚŁŃÓŻŹ]+$/i, + 'pt-PT': /^[0-9A-ZÃÁÀÂÄÇÉÊËÍÏÕÓÔÖÚÜ]+$/i, + 'ru-RU': /^[0-9А-ЯЁ]+$/i, + 'sl-SI': /^[0-9A-ZČĆĐŠŽ]+$/i, + 'sk-SK': /^[0-9A-ZÁČĎÉÍŇÓŠŤÚÝŽĹŔĽÄÔ]+$/i, + 'sr-RS@latin': /^[0-9A-ZČĆŽŠĐ]+$/i, + 'sr-RS': /^[0-9А-ЯЂЈЉЊЋЏ]+$/i, + 'sv-SE': /^[0-9A-ZÅÄÖ]+$/i, + 'th-TH': /^[ก-๙\s]+$/i, + 'tr-TR': /^[0-9A-ZÇĞİıÖŞÜ]+$/i, + 'uk-UA': /^[0-9А-ЩЬЮЯЄIЇҐі]+$/i, + 'ku-IQ': /^[٠١٢٣٤٥٦٧٨٩0-9ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i, + 'vi-VN': /^[0-9A-ZÀÁẠẢÃÂẦẤẬẨẪĂẰẮẶẲẴĐÈÉẸẺẼÊỀẾỆỂỄÌÍỊỈĨÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠÙÚỤỦŨƯỪỨỰỬỮỲÝỴỶỸ]+$/i, + ar: /^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/, + he: /^[0-9א-ת]+$/, + fa: /^['0-9آاءأؤئبپتثجچحخدذرزژسشصضطظعغفقکگلمنوهةی۱۲۳۴۵۶۷۸۹۰']+$/i +}; +exports.alphanumeric = alphanumeric; +var decimal = { + 'en-US': '.', + ar: '٫' +}; +exports.decimal = decimal; +var englishLocales = ['AU', 'GB', 'HK', 'IN', 'NZ', 'ZA', 'ZM']; +exports.englishLocales = englishLocales; + +for (var locale, i = 0; i < englishLocales.length; i++) { + locale = "en-".concat(englishLocales[i]); + alpha[locale] = alpha['en-US']; + alphanumeric[locale] = alphanumeric['en-US']; + decimal[locale] = decimal['en-US']; +} // Source: http://www.localeplanet.com/java/ + + +var arabicLocales = ['AE', 'BH', 'DZ', 'EG', 'IQ', 'JO', 'KW', 'LB', 'LY', 'MA', 'QM', 'QA', 'SA', 'SD', 'SY', 'TN', 'YE']; +exports.arabicLocales = arabicLocales; + +for (var _locale, _i = 0; _i < arabicLocales.length; _i++) { + _locale = "ar-".concat(arabicLocales[_i]); + alpha[_locale] = alpha.ar; + alphanumeric[_locale] = alphanumeric.ar; + decimal[_locale] = decimal.ar; +} + +var farsiLocales = ['IR', 'AF']; +exports.farsiLocales = farsiLocales; + +for (var _locale2, _i2 = 0; _i2 < farsiLocales.length; _i2++) { + _locale2 = "fa-".concat(farsiLocales[_i2]); + alphanumeric[_locale2] = alphanumeric.fa; + decimal[_locale2] = decimal.ar; +} // Source: https://en.wikipedia.org/wiki/Decimal_mark + + +var dotDecimal = ['ar-EG', 'ar-LB', 'ar-LY']; +exports.dotDecimal = dotDecimal; +var commaDecimal = ['bg-BG', 'cs-CZ', 'da-DK', 'de-DE', 'el-GR', 'en-ZM', 'es-ES', 'fr-CA', 'fr-FR', 'id-ID', 'it-IT', 'ku-IQ', 'hu-HU', 'nb-NO', 'nn-NO', 'nl-NL', 'pl-PL', 'pt-PT', 'ru-RU', 'sl-SI', 'sr-RS@latin', 'sr-RS', 'sv-SE', 'tr-TR', 'uk-UA', 'vi-VN']; +exports.commaDecimal = commaDecimal; + +for (var _i3 = 0; _i3 < dotDecimal.length; _i3++) { + decimal[dotDecimal[_i3]] = decimal['en-US']; +} + +for (var _i4 = 0; _i4 < commaDecimal.length; _i4++) { + decimal[commaDecimal[_i4]] = ','; +} + +alpha['fr-CA'] = alpha['fr-FR']; +alphanumeric['fr-CA'] = alphanumeric['fr-FR']; +alpha['pt-BR'] = alpha['pt-PT']; +alphanumeric['pt-BR'] = alphanumeric['pt-PT']; +decimal['pt-BR'] = decimal['pt-PT']; // see #862 + +alpha['pl-Pl'] = alpha['pl-PL']; +alphanumeric['pl-Pl'] = alphanumeric['pl-PL']; +decimal['pl-Pl'] = decimal['pl-PL']; // see #1455 + +alpha['fa-AF'] = alpha.fa; +},{}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/blacklist.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = blacklist; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function blacklist(str, chars) { + (0, _assertString.default)(str); + return str.replace(new RegExp("[".concat(chars, "]+"), 'g'), ''); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/contains.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = contains; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +var _toString = _interopRequireDefault(require("./util/toString")); + +var _merge = _interopRequireDefault(require("./util/merge")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var defaulContainsOptions = { + ignoreCase: false +}; + +function contains(str, elem, options) { + (0, _assertString.default)(str); + options = (0, _merge.default)(options, defaulContainsOptions); + return options.ignoreCase ? str.toLowerCase().indexOf((0, _toString.default)(elem).toLowerCase()) >= 0 : str.indexOf((0, _toString.default)(elem)) >= 0; +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js","./util/merge":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/merge.js","./util/toString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/toString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/equals.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = equals; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function equals(str, comparison) { + (0, _assertString.default)(str); + return str === comparison; +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/escape.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = escape; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function escape(str) { + (0, _assertString.default)(str); + return str.replace(/&/g, '&').replace(/"/g, '"').replace(/'/g, ''').replace(//g, '>').replace(/\//g, '/').replace(/\\/g, '\').replace(/`/g, '`'); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isAfter.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isAfter; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +var _toDate = _interopRequireDefault(require("./toDate")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function isAfter(str) { + var date = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : String(new Date()); + (0, _assertString.default)(str); + var comparison = (0, _toDate.default)(date); + var original = (0, _toDate.default)(str); + return !!(original && comparison && original > comparison); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./toDate":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/toDate.js","./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isAlpha.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isAlpha; +exports.locales = void 0; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +var _alpha = require("./alpha"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function isAlpha(_str) { + var locale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'en-US'; + var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + (0, _assertString.default)(_str); + var str = _str; + var ignore = options.ignore; + + if (ignore) { + if (ignore instanceof RegExp) { + str = str.replace(ignore, ''); + } else if (typeof ignore === 'string') { + str = str.replace(new RegExp("[".concat(ignore.replace(/[-[\]{}()*+?.,\\^$|#\\s]/g, '\\$&'), "]"), 'g'), ''); // escape regex for ignore + } else { + throw new Error('ignore should be instance of a String or RegExp'); + } + } + + if (locale in _alpha.alpha) { + return _alpha.alpha[locale].test(str); + } + + throw new Error("Invalid locale '".concat(locale, "'")); +} + +var locales = Object.keys(_alpha.alpha); +exports.locales = locales; +},{"./alpha":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/alpha.js","./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isAlphanumeric.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isAlphanumeric; +exports.locales = void 0; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +var _alpha = require("./alpha"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function isAlphanumeric(str) { + var locale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'en-US'; + (0, _assertString.default)(str); + + if (locale in _alpha.alphanumeric) { + return _alpha.alphanumeric[locale].test(str); + } + + throw new Error("Invalid locale '".concat(locale, "'")); +} + +var locales = Object.keys(_alpha.alphanumeric); +exports.locales = locales; +},{"./alpha":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/alpha.js","./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isAscii.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isAscii; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/* eslint-disable no-control-regex */ +var ascii = /^[\x00-\x7F]+$/; +/* eslint-enable no-control-regex */ + +function isAscii(str) { + (0, _assertString.default)(str); + return ascii.test(str); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isBIC.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isBIC; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var isBICReg = /^[A-z]{4}[A-z]{2}\w{2}(\w{3})?$/; + +function isBIC(str) { + (0, _assertString.default)(str); + return isBICReg.test(str); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isBase32.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isBase32; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var base32 = /^[A-Z2-7]+=*$/; + +function isBase32(str) { + (0, _assertString.default)(str); + var len = str.length; + + if (len % 8 === 0 && base32.test(str)) { + return true; + } + + return false; +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isBase58.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isBase58; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// Accepted chars - 123456789ABCDEFGH JKLMN PQRSTUVWXYZabcdefghijk mnopqrstuvwxyz +var base58Reg = /^[A-HJ-NP-Za-km-z1-9]*$/; + +function isBase58(str) { + (0, _assertString.default)(str); + + if (base58Reg.test(str)) { + return true; + } + + return false; +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isBase64.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isBase64; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +var _merge = _interopRequireDefault(require("./util/merge")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var notBase64 = /[^A-Z0-9+\/=]/i; +var urlSafeBase64 = /^[A-Z0-9_\-]*$/i; +var defaultBase64Options = { + urlSafe: false +}; + +function isBase64(str, options) { + (0, _assertString.default)(str); + options = (0, _merge.default)(options, defaultBase64Options); + var len = str.length; + + if (options.urlSafe) { + return urlSafeBase64.test(str); + } + + if (len % 4 !== 0 || notBase64.test(str)) { + return false; + } + + var firstPaddingChar = str.indexOf('='); + return firstPaddingChar === -1 || firstPaddingChar === len - 1 || firstPaddingChar === len - 2 && str[len - 1] === '='; +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js","./util/merge":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/merge.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isBefore.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isBefore; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +var _toDate = _interopRequireDefault(require("./toDate")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function isBefore(str) { + var date = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : String(new Date()); + (0, _assertString.default)(str); + var comparison = (0, _toDate.default)(date); + var original = (0, _toDate.default)(str); + return !!(original && comparison && original < comparison); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./toDate":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/toDate.js","./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isBoolean.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isBoolean; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function isBoolean(str) { + (0, _assertString.default)(str); + return ['true', 'false', '1', '0'].indexOf(str) >= 0; +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isBtcAddress.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isBtcAddress; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// supports Bech32 addresses +var btc = /^(bc1|[13])[a-zA-HJ-NP-Z0-9]{25,39}$/; + +function isBtcAddress(str) { + (0, _assertString.default)(str); + return btc.test(str); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isByteLength.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isByteLength; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +/* eslint-disable prefer-rest-params */ +function isByteLength(str, options) { + (0, _assertString.default)(str); + var min; + var max; + + if (_typeof(options) === 'object') { + min = options.min || 0; + max = options.max; + } else { + // backwards compatibility: isByteLength(str, min [, max]) + min = arguments[1]; + max = arguments[2]; + } + + var len = encodeURI(str).split(/%..|./).length - 1; + return len >= min && (typeof max === 'undefined' || len <= max); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isCreditCard.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isCreditCard; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/* eslint-disable max-len */ +var creditCard = /^(?:4[0-9]{12}(?:[0-9]{3,6})?|5[1-5][0-9]{14}|(222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}|6(?:011|5[0-9][0-9])[0-9]{12,15}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11}|6[27][0-9]{14})$/; +/* eslint-enable max-len */ + +function isCreditCard(str) { + (0, _assertString.default)(str); + var sanitized = str.replace(/[- ]+/g, ''); + + if (!creditCard.test(sanitized)) { + return false; + } + + var sum = 0; + var digit; + var tmpNum; + var shouldDouble; + + for (var i = sanitized.length - 1; i >= 0; i--) { + digit = sanitized.substring(i, i + 1); + tmpNum = parseInt(digit, 10); + + if (shouldDouble) { + tmpNum *= 2; + + if (tmpNum >= 10) { + sum += tmpNum % 10 + 1; + } else { + sum += tmpNum; + } + } else { + sum += tmpNum; + } + + shouldDouble = !shouldDouble; + } + + return !!(sum % 10 === 0 ? sanitized : false); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isCurrency.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isCurrency; + +var _merge = _interopRequireDefault(require("./util/merge")); + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function currencyRegex(options) { + var decimal_digits = "\\d{".concat(options.digits_after_decimal[0], "}"); + options.digits_after_decimal.forEach(function (digit, index) { + if (index !== 0) decimal_digits = "".concat(decimal_digits, "|\\d{").concat(digit, "}"); + }); + var symbol = "(".concat(options.symbol.replace(/\W/, function (m) { + return "\\".concat(m); + }), ")").concat(options.require_symbol ? '' : '?'), + negative = '-?', + whole_dollar_amount_without_sep = '[1-9]\\d*', + whole_dollar_amount_with_sep = "[1-9]\\d{0,2}(\\".concat(options.thousands_separator, "\\d{3})*"), + valid_whole_dollar_amounts = ['0', whole_dollar_amount_without_sep, whole_dollar_amount_with_sep], + whole_dollar_amount = "(".concat(valid_whole_dollar_amounts.join('|'), ")?"), + decimal_amount = "(\\".concat(options.decimal_separator, "(").concat(decimal_digits, "))").concat(options.require_decimal ? '' : '?'); + var pattern = whole_dollar_amount + (options.allow_decimal || options.require_decimal ? decimal_amount : ''); // default is negative sign before symbol, but there are two other options (besides parens) + + if (options.allow_negatives && !options.parens_for_negatives) { + if (options.negative_sign_after_digits) { + pattern += negative; + } else if (options.negative_sign_before_digits) { + pattern = negative + pattern; + } + } // South African Rand, for example, uses R 123 (space) and R-123 (no space) + + + if (options.allow_negative_sign_placeholder) { + pattern = "( (?!\\-))?".concat(pattern); + } else if (options.allow_space_after_symbol) { + pattern = " ?".concat(pattern); + } else if (options.allow_space_after_digits) { + pattern += '( (?!$))?'; + } + + if (options.symbol_after_digits) { + pattern += symbol; + } else { + pattern = symbol + pattern; + } + + if (options.allow_negatives) { + if (options.parens_for_negatives) { + pattern = "(\\(".concat(pattern, "\\)|").concat(pattern, ")"); + } else if (!(options.negative_sign_before_digits || options.negative_sign_after_digits)) { + pattern = negative + pattern; + } + } // ensure there's a dollar and/or decimal amount, and that + // it doesn't start with a space or a negative sign followed by a space + + + return new RegExp("^(?!-? )(?=.*\\d)".concat(pattern, "$")); +} + +var default_currency_options = { + symbol: '$', + require_symbol: false, + allow_space_after_symbol: false, + symbol_after_digits: false, + allow_negatives: true, + parens_for_negatives: false, + negative_sign_before_digits: false, + negative_sign_after_digits: false, + allow_negative_sign_placeholder: false, + thousands_separator: ',', + decimal_separator: '.', + allow_decimal: true, + require_decimal: false, + digits_after_decimal: [2], + allow_space_after_digits: false +}; + +function isCurrency(str, options) { + (0, _assertString.default)(str); + options = (0, _merge.default)(options, default_currency_options); + return currencyRegex(options).test(str); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js","./util/merge":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/merge.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isDataURI.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isDataURI; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var validMediaType = /^[a-z]+\/[a-z0-9\-\+]+$/i; +var validAttribute = /^[a-z\-]+=[a-z0-9\-]+$/i; +var validData = /^[a-z0-9!\$&'\(\)\*\+,;=\-\._~:@\/\?%\s]*$/i; + +function isDataURI(str) { + (0, _assertString.default)(str); + var data = str.split(','); + + if (data.length < 2) { + return false; + } + + var attributes = data.shift().trim().split(';'); + var schemeAndMediaType = attributes.shift(); + + if (schemeAndMediaType.substr(0, 5) !== 'data:') { + return false; + } + + var mediaType = schemeAndMediaType.substr(5); + + if (mediaType !== '' && !validMediaType.test(mediaType)) { + return false; + } + + for (var i = 0; i < attributes.length; i++) { + if (i === attributes.length - 1 && attributes[i].toLowerCase() === 'base64') {// ok + } else if (!validAttribute.test(attributes[i])) { + return false; + } + } + + for (var _i = 0; _i < data.length; _i++) { + if (!validData.test(data[_i])) { + return false; + } + } + + return true; +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isDate.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isDate; + +var _merge = _interopRequireDefault(require("./util/merge")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } + +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } + +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } + +function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +var default_date_options = { + format: 'YYYY/MM/DD', + delimiters: ['/', '-'], + strictMode: false +}; + +function isValidFormat(format) { + return /(^(y{4}|y{2})[\/-](m{1,2})[\/-](d{1,2})$)|(^(m{1,2})[\/-](d{1,2})[\/-]((y{4}|y{2})$))|(^(d{1,2})[\/-](m{1,2})[\/-]((y{4}|y{2})$))/gi.test(format); +} + +function zip(date, format) { + var zippedArr = [], + len = Math.min(date.length, format.length); + + for (var i = 0; i < len; i++) { + zippedArr.push([date[i], format[i]]); + } + + return zippedArr; +} + +function isDate(input, options) { + if (typeof options === 'string') { + // Allow backward compatbility for old format isDate(input [, format]) + options = (0, _merge.default)({ + format: options + }, default_date_options); + } else { + options = (0, _merge.default)(options, default_date_options); + } + + if (typeof input === 'string' && isValidFormat(options.format)) { + var formatDelimiter = options.delimiters.find(function (delimiter) { + return options.format.indexOf(delimiter) !== -1; + }); + var dateDelimiter = options.strictMode ? formatDelimiter : options.delimiters.find(function (delimiter) { + return input.indexOf(delimiter) !== -1; + }); + var dateAndFormat = zip(input.split(dateDelimiter), options.format.toLowerCase().split(formatDelimiter)); + var dateObj = {}; + + var _iterator = _createForOfIteratorHelper(dateAndFormat), + _step; + + try { + for (_iterator.s(); !(_step = _iterator.n()).done;) { + var _step$value = _slicedToArray(_step.value, 2), + dateWord = _step$value[0], + formatWord = _step$value[1]; + + if (dateWord.length !== formatWord.length) { + return false; + } + + dateObj[formatWord.charAt(0)] = dateWord; + } + } catch (err) { + _iterator.e(err); + } finally { + _iterator.f(); + } + + return new Date("".concat(dateObj.m, "/").concat(dateObj.d, "/").concat(dateObj.y)).getDate() === +dateObj.d; + } + + if (!options.strictMode) { + return Object.prototype.toString.call(input) === '[object Date]' && isFinite(input); + } + + return false; +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/merge":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/merge.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isDecimal.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isDecimal; + +var _merge = _interopRequireDefault(require("./util/merge")); + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +var _includes = _interopRequireDefault(require("./util/includes")); + +var _alpha = require("./alpha"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function decimalRegExp(options) { + var regExp = new RegExp("^[-+]?([0-9]+)?(\\".concat(_alpha.decimal[options.locale], "[0-9]{").concat(options.decimal_digits, "})").concat(options.force_decimal ? '' : '?', "$")); + return regExp; +} + +var default_decimal_options = { + force_decimal: false, + decimal_digits: '1,', + locale: 'en-US' +}; +var blacklist = ['', '-', '+']; + +function isDecimal(str, options) { + (0, _assertString.default)(str); + options = (0, _merge.default)(options, default_decimal_options); + + if (options.locale in _alpha.decimal) { + return !(0, _includes.default)(blacklist, str.replace(/ /g, '')) && decimalRegExp(options).test(str); + } + + throw new Error("Invalid locale '".concat(options.locale, "'")); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./alpha":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/alpha.js","./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js","./util/includes":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/includes.js","./util/merge":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/merge.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isDivisibleBy.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isDivisibleBy; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +var _toFloat = _interopRequireDefault(require("./toFloat")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function isDivisibleBy(str, num) { + (0, _assertString.default)(str); + return (0, _toFloat.default)(str) % parseInt(num, 10) === 0; +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./toFloat":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/toFloat.js","./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isEAN.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isEAN; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * The most commonly used EAN standard is + * the thirteen-digit EAN-13, while the + * less commonly used 8-digit EAN-8 barcode was + * introduced for use on small packages. + * EAN consists of: + * GS1 prefix, manufacturer code, product code and check digit + * Reference: https://en.wikipedia.org/wiki/International_Article_Number + */ + +/** + * Define EAN Lenghts; 8 for EAN-8; 13 for EAN-13 + * and Regular Expression for valid EANs (EAN-8, EAN-13), + * with exact numberic matching of 8 or 13 digits [0-9] + */ +var LENGTH_EAN_8 = 8; +var validEanRegex = /^(\d{8}|\d{13})$/; +/** + * Get position weight given: + * EAN length and digit index/position + * + * @param {number} length + * @param {number} index + * @return {number} + */ + +function getPositionWeightThroughLengthAndIndex(length, index) { + if (length === LENGTH_EAN_8) { + return index % 2 === 0 ? 3 : 1; + } + + return index % 2 === 0 ? 1 : 3; +} +/** + * Calculate EAN Check Digit + * Reference: https://en.wikipedia.org/wiki/International_Article_Number#Calculation_of_checksum_digit + * + * @param {string} ean + * @return {number} + */ + + +function calculateCheckDigit(ean) { + var checksum = ean.slice(0, -1).split('').map(function (char, index) { + return Number(char) * getPositionWeightThroughLengthAndIndex(ean.length, index); + }).reduce(function (acc, partialSum) { + return acc + partialSum; + }, 0); + var remainder = 10 - checksum % 10; + return remainder < 10 ? remainder : 0; +} +/** + * Check if string is valid EAN: + * Matches EAN-8/EAN-13 regex + * Has valid check digit. + * + * @param {string} str + * @return {boolean} + */ + + +function isEAN(str) { + (0, _assertString.default)(str); + var actualCheckDigit = Number(str.slice(-1)); + return validEanRegex.test(str) && actualCheckDigit === calculateCheckDigit(str); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isEmail.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isEmail; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +var _merge = _interopRequireDefault(require("./util/merge")); + +var _isByteLength = _interopRequireDefault(require("./isByteLength")); + +var _isFQDN = _interopRequireDefault(require("./isFQDN")); + +var _isIP = _interopRequireDefault(require("./isIP")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } + +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } + +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } + +var default_email_options = { + allow_display_name: false, + require_display_name: false, + allow_utf8_local_part: true, + require_tld: true, + blacklisted_chars: '', + ignore_max_length: false +}; +/* eslint-disable max-len */ + +/* eslint-disable no-control-regex */ + +var splitNameAddress = /^([^\x00-\x1F\x7F-\x9F\cX]+)<(.+)>$/i; +var emailUserPart = /^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~]+$/i; +var gmailUserPart = /^[a-z\d]+$/; +var quotedEmailUser = /^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f]))*$/i; +var emailUserUtf8Part = /^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+$/i; +var quotedEmailUserUtf8 = /^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*$/i; +var defaultMaxEmailLength = 254; +/* eslint-enable max-len */ + +/* eslint-enable no-control-regex */ + +/** + * Validate display name according to the RFC2822: https://tools.ietf.org/html/rfc2822#appendix-A.1.2 + * @param {String} display_name + */ + +function validateDisplayName(display_name) { + var trim_quotes = display_name.match(/^"(.+)"$/i); + var display_name_without_quotes = trim_quotes ? trim_quotes[1] : display_name; // display name with only spaces is not valid + + if (!display_name_without_quotes.trim()) { + return false; + } // check whether display name contains illegal character + + + var contains_illegal = /[\.";<>]/.test(display_name_without_quotes); + + if (contains_illegal) { + // if contains illegal characters, + // must to be enclosed in double-quotes, otherwise it's not a valid display name + if (!trim_quotes) { + return false; + } // the quotes in display name must start with character symbol \ + + + var all_start_with_back_slash = display_name_without_quotes.split('"').length === display_name_without_quotes.split('\\"').length; + + if (!all_start_with_back_slash) { + return false; + } + } + + return true; +} + +function isEmail(str, options) { + (0, _assertString.default)(str); + options = (0, _merge.default)(options, default_email_options); + + if (options.require_display_name || options.allow_display_name) { + var display_email = str.match(splitNameAddress); + + if (display_email) { + var display_name; + + var _display_email = _slicedToArray(display_email, 3); + + display_name = _display_email[1]; + str = _display_email[2]; + + // sometimes need to trim the last space to get the display name + // because there may be a space between display name and email address + // eg. myname + // the display name is `myname` instead of `myname `, so need to trim the last space + if (display_name.endsWith(' ')) { + display_name = display_name.substr(0, display_name.length - 1); + } + + if (!validateDisplayName(display_name)) { + return false; + } + } else if (options.require_display_name) { + return false; + } + } + + if (!options.ignore_max_length && str.length > defaultMaxEmailLength) { + return false; + } + + var parts = str.split('@'); + var domain = parts.pop(); + var user = parts.join('@'); + var lower_domain = domain.toLowerCase(); + + if (options.domain_specific_validation && (lower_domain === 'gmail.com' || lower_domain === 'googlemail.com')) { + /* + Previously we removed dots for gmail addresses before validating. + This was removed because it allows `multiple..dots@gmail.com` + to be reported as valid, but it is not. + Gmail only normalizes single dots, removing them from here is pointless, + should be done in normalizeEmail + */ + user = user.toLowerCase(); // Removing sub-address from username before gmail validation + + var username = user.split('+')[0]; // Dots are not included in gmail length restriction + + if (!(0, _isByteLength.default)(username.replace('.', ''), { + min: 6, + max: 30 + })) { + return false; + } + + var _user_parts = username.split('.'); + + for (var i = 0; i < _user_parts.length; i++) { + if (!gmailUserPart.test(_user_parts[i])) { + return false; + } + } + } + + if (options.ignore_max_length === false && (!(0, _isByteLength.default)(user, { + max: 64 + }) || !(0, _isByteLength.default)(domain, { + max: 254 + }))) { + return false; + } + + if (!(0, _isFQDN.default)(domain, { + require_tld: options.require_tld + })) { + if (!options.allow_ip_domain) { + return false; + } + + if (!(0, _isIP.default)(domain)) { + if (!domain.startsWith('[') || !domain.endsWith(']')) { + return false; + } + + var noBracketdomain = domain.substr(1, domain.length - 2); + + if (noBracketdomain.length === 0 || !(0, _isIP.default)(noBracketdomain)) { + return false; + } + } + } + + if (user[0] === '"') { + user = user.slice(1, user.length - 1); + return options.allow_utf8_local_part ? quotedEmailUserUtf8.test(user) : quotedEmailUser.test(user); + } + + var pattern = options.allow_utf8_local_part ? emailUserUtf8Part : emailUserPart; + var user_parts = user.split('.'); + + for (var _i2 = 0; _i2 < user_parts.length; _i2++) { + if (!pattern.test(user_parts[_i2])) { + return false; + } + } + + if (options.blacklisted_chars) { + if (user.search(new RegExp("[".concat(options.blacklisted_chars, "]+"), 'g')) !== -1) return false; + } + + return true; +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./isByteLength":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isByteLength.js","./isFQDN":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isFQDN.js","./isIP":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isIP.js","./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js","./util/merge":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/merge.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isEmpty.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isEmpty; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +var _merge = _interopRequireDefault(require("./util/merge")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var default_is_empty_options = { + ignore_whitespace: false +}; + +function isEmpty(str, options) { + (0, _assertString.default)(str); + options = (0, _merge.default)(options, default_is_empty_options); + return (options.ignore_whitespace ? str.trim().length : str.length) === 0; +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js","./util/merge":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/merge.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isEthereumAddress.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isEthereumAddress; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var eth = /^(0x)[0-9a-f]{40}$/i; + +function isEthereumAddress(str) { + (0, _assertString.default)(str); + return eth.test(str); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isFQDN.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isFQDN; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +var _merge = _interopRequireDefault(require("./util/merge")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var default_fqdn_options = { + require_tld: true, + allow_underscores: false, + allow_trailing_dot: false, + allow_numeric_tld: false +}; + +function isFQDN(str, options) { + (0, _assertString.default)(str); + options = (0, _merge.default)(options, default_fqdn_options); + /* Remove the optional trailing dot before checking validity */ + + if (options.allow_trailing_dot && str[str.length - 1] === '.') { + str = str.substring(0, str.length - 1); + } + + var parts = str.split('.'); + var tld = parts[parts.length - 1]; + + if (options.require_tld) { + // disallow fqdns without tld + if (parts.length < 2) { + return false; + } + + if (!/^([a-z\u00a1-\uffff]{2,}|xn[a-z0-9-]{2,})$/i.test(tld)) { + return false; + } // disallow spaces && special characers + + + if (/[\s\u2002-\u200B\u202F\u205F\u3000\uFEFF\uDB40\uDC20\u00A9\uFFFD]/.test(tld)) { + return false; + } + } // reject numeric TLDs + + + if (!options.allow_numeric_tld && /^\d+$/.test(tld)) { + return false; + } + + return parts.every(function (part) { + if (part.length > 63) { + return false; + } + + if (!/^[a-z_\u00a1-\uffff0-9-]+$/i.test(part)) { + return false; + } // disallow full-width chars + + + if (/[\uff01-\uff5e]/.test(part)) { + return false; + } // disallow parts starting or ending with hyphen + + + if (/^-|-$/.test(part)) { + return false; + } + + if (!options.allow_underscores && /_/.test(part)) { + return false; + } + + return true; + }); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js","./util/merge":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/merge.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isFloat.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isFloat; +exports.locales = void 0; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +var _alpha = require("./alpha"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function isFloat(str, options) { + (0, _assertString.default)(str); + options = options || {}; + var float = new RegExp("^(?:[-+])?(?:[0-9]+)?(?:\\".concat(options.locale ? _alpha.decimal[options.locale] : '.', "[0-9]*)?(?:[eE][\\+\\-]?(?:[0-9]+))?$")); + + if (str === '' || str === '.' || str === '-' || str === '+') { + return false; + } + + var value = parseFloat(str.replace(',', '.')); + return float.test(str) && (!options.hasOwnProperty('min') || value >= options.min) && (!options.hasOwnProperty('max') || value <= options.max) && (!options.hasOwnProperty('lt') || value < options.lt) && (!options.hasOwnProperty('gt') || value > options.gt); +} + +var locales = Object.keys(_alpha.decimal); +exports.locales = locales; +},{"./alpha":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/alpha.js","./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isFullWidth.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isFullWidth; +exports.fullWidth = void 0; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var fullWidth = /[^\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]/; +exports.fullWidth = fullWidth; + +function isFullWidth(str) { + (0, _assertString.default)(str); + return fullWidth.test(str); +} +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isHSL.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isHSL; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var hslcomma = /^(hsl)a?\(\s*((\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?))(deg|grad|rad|turn|\s*)(\s*,\s*(\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?)%){2}\s*(,\s*((\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?)%?)\s*)?\)$/i; +var hslspace = /^(hsl)a?\(\s*((\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?))(deg|grad|rad|turn|\s)(\s*(\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?)%){2}\s*(\/\s*((\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?)%?)\s*)?\)$/i; + +function isHSL(str) { + (0, _assertString.default)(str); + return hslcomma.test(str) || hslspace.test(str); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isHalfWidth.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isHalfWidth; +exports.halfWidth = void 0; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var halfWidth = /[\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]/; +exports.halfWidth = halfWidth; + +function isHalfWidth(str) { + (0, _assertString.default)(str); + return halfWidth.test(str); +} +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isHash.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isHash; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var lengths = { + md5: 32, + md4: 32, + sha1: 40, + sha256: 64, + sha384: 96, + sha512: 128, + ripemd128: 32, + ripemd160: 40, + tiger128: 32, + tiger160: 40, + tiger192: 48, + crc32: 8, + crc32b: 8 +}; + +function isHash(str, algorithm) { + (0, _assertString.default)(str); + var hash = new RegExp("^[a-fA-F0-9]{".concat(lengths[algorithm], "}$")); + return hash.test(str); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isHexColor.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isHexColor; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var hexcolor = /^#?([0-9A-F]{3}|[0-9A-F]{4}|[0-9A-F]{6}|[0-9A-F]{8})$/i; + +function isHexColor(str) { + (0, _assertString.default)(str); + return hexcolor.test(str); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isHexadecimal.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isHexadecimal; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var hexadecimal = /^(0x|0h)?[0-9A-F]+$/i; + +function isHexadecimal(str) { + (0, _assertString.default)(str); + return hexadecimal.test(str); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isIBAN.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isIBAN; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * List of country codes with + * corresponding IBAN regular expression + * Reference: https://en.wikipedia.org/wiki/International_Bank_Account_Number + */ +var ibanRegexThroughCountryCode = { + AD: /^(AD[0-9]{2})\d{8}[A-Z0-9]{12}$/, + AE: /^(AE[0-9]{2})\d{3}\d{16}$/, + AL: /^(AL[0-9]{2})\d{8}[A-Z0-9]{16}$/, + AT: /^(AT[0-9]{2})\d{16}$/, + AZ: /^(AZ[0-9]{2})[A-Z0-9]{4}\d{20}$/, + BA: /^(BA[0-9]{2})\d{16}$/, + BE: /^(BE[0-9]{2})\d{12}$/, + BG: /^(BG[0-9]{2})[A-Z]{4}\d{6}[A-Z0-9]{8}$/, + BH: /^(BH[0-9]{2})[A-Z]{4}[A-Z0-9]{14}$/, + BR: /^(BR[0-9]{2})\d{23}[A-Z]{1}[A-Z0-9]{1}$/, + BY: /^(BY[0-9]{2})[A-Z0-9]{4}\d{20}$/, + CH: /^(CH[0-9]{2})\d{5}[A-Z0-9]{12}$/, + CR: /^(CR[0-9]{2})\d{18}$/, + CY: /^(CY[0-9]{2})\d{8}[A-Z0-9]{16}$/, + CZ: /^(CZ[0-9]{2})\d{20}$/, + DE: /^(DE[0-9]{2})\d{18}$/, + DK: /^(DK[0-9]{2})\d{14}$/, + DO: /^(DO[0-9]{2})[A-Z]{4}\d{20}$/, + EE: /^(EE[0-9]{2})\d{16}$/, + EG: /^(EG[0-9]{2})\d{25}$/, + ES: /^(ES[0-9]{2})\d{20}$/, + FI: /^(FI[0-9]{2})\d{14}$/, + FO: /^(FO[0-9]{2})\d{14}$/, + FR: /^(FR[0-9]{2})\d{10}[A-Z0-9]{11}\d{2}$/, + GB: /^(GB[0-9]{2})[A-Z]{4}\d{14}$/, + GE: /^(GE[0-9]{2})[A-Z0-9]{2}\d{16}$/, + GI: /^(GI[0-9]{2})[A-Z]{4}[A-Z0-9]{15}$/, + GL: /^(GL[0-9]{2})\d{14}$/, + GR: /^(GR[0-9]{2})\d{7}[A-Z0-9]{16}$/, + GT: /^(GT[0-9]{2})[A-Z0-9]{4}[A-Z0-9]{20}$/, + HR: /^(HR[0-9]{2})\d{17}$/, + HU: /^(HU[0-9]{2})\d{24}$/, + IE: /^(IE[0-9]{2})[A-Z0-9]{4}\d{14}$/, + IL: /^(IL[0-9]{2})\d{19}$/, + IQ: /^(IQ[0-9]{2})[A-Z]{4}\d{15}$/, + IR: /^(IR[0-9]{2})0\d{2}0\d{18}$/, + IS: /^(IS[0-9]{2})\d{22}$/, + IT: /^(IT[0-9]{2})[A-Z]{1}\d{10}[A-Z0-9]{12}$/, + JO: /^(JO[0-9]{2})[A-Z]{4}\d{22}$/, + KW: /^(KW[0-9]{2})[A-Z]{4}[A-Z0-9]{22}$/, + KZ: /^(KZ[0-9]{2})\d{3}[A-Z0-9]{13}$/, + LB: /^(LB[0-9]{2})\d{4}[A-Z0-9]{20}$/, + LC: /^(LC[0-9]{2})[A-Z]{4}[A-Z0-9]{24}$/, + LI: /^(LI[0-9]{2})\d{5}[A-Z0-9]{12}$/, + LT: /^(LT[0-9]{2})\d{16}$/, + LU: /^(LU[0-9]{2})\d{3}[A-Z0-9]{13}$/, + LV: /^(LV[0-9]{2})[A-Z]{4}[A-Z0-9]{13}$/, + MC: /^(MC[0-9]{2})\d{10}[A-Z0-9]{11}\d{2}$/, + MD: /^(MD[0-9]{2})[A-Z0-9]{20}$/, + ME: /^(ME[0-9]{2})\d{18}$/, + MK: /^(MK[0-9]{2})\d{3}[A-Z0-9]{10}\d{2}$/, + MR: /^(MR[0-9]{2})\d{23}$/, + MT: /^(MT[0-9]{2})[A-Z]{4}\d{5}[A-Z0-9]{18}$/, + MU: /^(MU[0-9]{2})[A-Z]{4}\d{19}[A-Z]{3}$/, + NL: /^(NL[0-9]{2})[A-Z]{4}\d{10}$/, + NO: /^(NO[0-9]{2})\d{11}$/, + PK: /^(PK[0-9]{2})[A-Z0-9]{4}\d{16}$/, + PL: /^(PL[0-9]{2})\d{24}$/, + PS: /^(PS[0-9]{2})[A-Z0-9]{4}\d{21}$/, + PT: /^(PT[0-9]{2})\d{21}$/, + QA: /^(QA[0-9]{2})[A-Z]{4}[A-Z0-9]{21}$/, + RO: /^(RO[0-9]{2})[A-Z]{4}[A-Z0-9]{16}$/, + RS: /^(RS[0-9]{2})\d{18}$/, + SA: /^(SA[0-9]{2})\d{2}[A-Z0-9]{18}$/, + SC: /^(SC[0-9]{2})[A-Z]{4}\d{20}[A-Z]{3}$/, + SE: /^(SE[0-9]{2})\d{20}$/, + SI: /^(SI[0-9]{2})\d{15}$/, + SK: /^(SK[0-9]{2})\d{20}$/, + SM: /^(SM[0-9]{2})[A-Z]{1}\d{10}[A-Z0-9]{12}$/, + SV: /^(SV[0-9]{2})[A-Z0-9]{4}\d{20}$/, + TL: /^(TL[0-9]{2})\d{19}$/, + TN: /^(TN[0-9]{2})\d{20}$/, + TR: /^(TR[0-9]{2})\d{5}[A-Z0-9]{17}$/, + UA: /^(UA[0-9]{2})\d{6}[A-Z0-9]{19}$/, + VA: /^(VA[0-9]{2})\d{18}$/, + VG: /^(VG[0-9]{2})[A-Z0-9]{4}\d{16}$/, + XK: /^(XK[0-9]{2})\d{16}$/ +}; +/** + * Check whether string has correct universal IBAN format + * The IBAN consists of up to 34 alphanumeric characters, as follows: + * Country Code using ISO 3166-1 alpha-2, two letters + * check digits, two digits and + * Basic Bank Account Number (BBAN), up to 30 alphanumeric characters. + * NOTE: Permitted IBAN characters are: digits [0-9] and the 26 latin alphabetic [A-Z] + * + * @param {string} str - string under validation + * @return {boolean} + */ + +function hasValidIbanFormat(str) { + // Strip white spaces and hyphens + var strippedStr = str.replace(/[\s\-]+/gi, '').toUpperCase(); + var isoCountryCode = strippedStr.slice(0, 2).toUpperCase(); + return isoCountryCode in ibanRegexThroughCountryCode && ibanRegexThroughCountryCode[isoCountryCode].test(strippedStr); +} +/** + * Check whether string has valid IBAN Checksum + * by performing basic mod-97 operation and + * the remainder should equal 1 + * -- Start by rearranging the IBAN by moving the four initial characters to the end of the string + * -- Replace each letter in the string with two digits, A -> 10, B = 11, Z = 35 + * -- Interpret the string as a decimal integer and + * -- compute the remainder on division by 97 (mod 97) + * Reference: https://en.wikipedia.org/wiki/International_Bank_Account_Number + * + * @param {string} str + * @return {boolean} + */ + + +function hasValidIbanChecksum(str) { + var strippedStr = str.replace(/[^A-Z0-9]+/gi, '').toUpperCase(); // Keep only digits and A-Z latin alphabetic + + var rearranged = strippedStr.slice(4) + strippedStr.slice(0, 4); + var alphaCapsReplacedWithDigits = rearranged.replace(/[A-Z]/g, function (char) { + return char.charCodeAt(0) - 55; + }); + var remainder = alphaCapsReplacedWithDigits.match(/\d{1,7}/g).reduce(function (acc, value) { + return Number(acc + value) % 97; + }, ''); + return remainder === 1; +} + +function isIBAN(str) { + (0, _assertString.default)(str); + return hasValidIbanFormat(str) && hasValidIbanChecksum(str); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isIMEI.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isIMEI; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var imeiRegexWithoutHypens = /^[0-9]{15}$/; +var imeiRegexWithHypens = /^\d{2}-\d{6}-\d{6}-\d{1}$/; + +function isIMEI(str, options) { + (0, _assertString.default)(str); + options = options || {}; // default regex for checking imei is the one without hyphens + + var imeiRegex = imeiRegexWithoutHypens; + + if (options.allow_hyphens) { + imeiRegex = imeiRegexWithHypens; + } + + if (!imeiRegex.test(str)) { + return false; + } + + str = str.replace(/-/g, ''); + var sum = 0, + mul = 2, + l = 14; + + for (var i = 0; i < l; i++) { + var digit = str.substring(l - i - 1, l - i); + var tp = parseInt(digit, 10) * mul; + + if (tp >= 10) { + sum += tp % 10 + 1; + } else { + sum += tp; + } + + if (mul === 1) { + mul += 1; + } else { + mul -= 1; + } + } + + var chk = (10 - sum % 10) % 10; + + if (chk !== parseInt(str.substring(14, 15), 10)) { + return false; + } + + return true; +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isIP.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isIP; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** +11.3. Examples + + The following addresses + + fe80::1234 (on the 1st link of the node) + ff02::5678 (on the 5th link of the node) + ff08::9abc (on the 10th organization of the node) + + would be represented as follows: + + fe80::1234%1 + ff02::5678%5 + ff08::9abc%10 + + (Here we assume a natural translation from a zone index to the + part, where the Nth zone of any scope is translated into + "N".) + + If we use interface names as , those addresses could also be + represented as follows: + + fe80::1234%ne0 + ff02::5678%pvc1.3 + ff08::9abc%interface10 + + where the interface "ne0" belongs to the 1st link, "pvc1.3" belongs + to the 5th link, and "interface10" belongs to the 10th organization. + * * */ +var ipv4Maybe = /^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/; +var ipv6Block = /^[0-9A-F]{1,4}$/i; + +function isIP(str) { + var version = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; + (0, _assertString.default)(str); + version = String(version); + + if (!version) { + return isIP(str, 4) || isIP(str, 6); + } else if (version === '4') { + if (!ipv4Maybe.test(str)) { + return false; + } + + var parts = str.split('.').sort(function (a, b) { + return a - b; + }); + return parts[3] <= 255; + } else if (version === '6') { + var addressAndZone = [str]; // ipv6 addresses could have scoped architecture + // according to https://tools.ietf.org/html/rfc4007#section-11 + + if (str.includes('%')) { + addressAndZone = str.split('%'); + + if (addressAndZone.length !== 2) { + // it must be just two parts + return false; + } + + if (!addressAndZone[0].includes(':')) { + // the first part must be the address + return false; + } + + if (addressAndZone[1] === '') { + // the second part must not be empty + return false; + } + } + + var blocks = addressAndZone[0].split(':'); + var foundOmissionBlock = false; // marker to indicate :: + // At least some OS accept the last 32 bits of an IPv6 address + // (i.e. 2 of the blocks) in IPv4 notation, and RFC 3493 says + // that '::ffff:a.b.c.d' is valid for IPv4-mapped IPv6 addresses, + // and '::a.b.c.d' is deprecated, but also valid. + + var foundIPv4TransitionBlock = isIP(blocks[blocks.length - 1], 4); + var expectedNumberOfBlocks = foundIPv4TransitionBlock ? 7 : 8; + + if (blocks.length > expectedNumberOfBlocks) { + return false; + } // initial or final :: + + + if (str === '::') { + return true; + } else if (str.substr(0, 2) === '::') { + blocks.shift(); + blocks.shift(); + foundOmissionBlock = true; + } else if (str.substr(str.length - 2) === '::') { + blocks.pop(); + blocks.pop(); + foundOmissionBlock = true; + } + + for (var i = 0; i < blocks.length; ++i) { + // test for a :: which can not be at the string start/end + // since those cases have been handled above + if (blocks[i] === '' && i > 0 && i < blocks.length - 1) { + if (foundOmissionBlock) { + return false; // multiple :: in address + } + + foundOmissionBlock = true; + } else if (foundIPv4TransitionBlock && i === blocks.length - 1) {// it has been checked before that the last + // block is a valid IPv4 address + } else if (!ipv6Block.test(blocks[i])) { + return false; + } + } + + if (foundOmissionBlock) { + return blocks.length >= 1; + } + + return blocks.length === expectedNumberOfBlocks; + } + + return false; +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isIPRange.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isIPRange; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +var _isIP = _interopRequireDefault(require("./isIP")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var subnetMaybe = /^\d{1,2}$/; + +function isIPRange(str) { + (0, _assertString.default)(str); + var parts = str.split('/'); // parts[0] -> ip, parts[1] -> subnet + + if (parts.length !== 2) { + return false; + } + + if (!subnetMaybe.test(parts[1])) { + return false; + } // Disallow preceding 0 i.e. 01, 02, ... + + + if (parts[1].length > 1 && parts[1].startsWith('0')) { + return false; + } + + return (0, _isIP.default)(parts[0], 4) && parts[1] <= 32 && parts[1] >= 0; +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./isIP":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isIP.js","./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isISBN.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isISBN; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var isbn10Maybe = /^(?:[0-9]{9}X|[0-9]{10})$/; +var isbn13Maybe = /^(?:[0-9]{13})$/; +var factor = [1, 3]; + +function isISBN(str) { + var version = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; + (0, _assertString.default)(str); + version = String(version); + + if (!version) { + return isISBN(str, 10) || isISBN(str, 13); + } + + var sanitized = str.replace(/[\s-]+/g, ''); + var checksum = 0; + var i; + + if (version === '10') { + if (!isbn10Maybe.test(sanitized)) { + return false; + } + + for (i = 0; i < 9; i++) { + checksum += (i + 1) * sanitized.charAt(i); + } + + if (sanitized.charAt(9) === 'X') { + checksum += 10 * 10; + } else { + checksum += 10 * sanitized.charAt(9); + } + + if (checksum % 11 === 0) { + return !!sanitized; + } + } else if (version === '13') { + if (!isbn13Maybe.test(sanitized)) { + return false; + } + + for (i = 0; i < 12; i++) { + checksum += factor[i % 2] * sanitized.charAt(i); + } + + if (sanitized.charAt(12) - (10 - checksum % 10) % 10 === 0) { + return !!sanitized; + } + } + + return false; +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isISIN.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isISIN; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var isin = /^[A-Z]{2}[0-9A-Z]{9}[0-9]$/; + +function isISIN(str) { + (0, _assertString.default)(str); + + if (!isin.test(str)) { + return false; + } + + var checksumStr = str.replace(/[A-Z]/g, function (character) { + return parseInt(character, 36); + }); + var sum = 0; + var digit; + var tmpNum; + var shouldDouble = true; + + for (var i = checksumStr.length - 2; i >= 0; i--) { + digit = checksumStr.substring(i, i + 1); + tmpNum = parseInt(digit, 10); + + if (shouldDouble) { + tmpNum *= 2; + + if (tmpNum >= 10) { + sum += tmpNum + 1; + } else { + sum += tmpNum; + } + } else { + sum += tmpNum; + } + + shouldDouble = !shouldDouble; + } + + return parseInt(str.substr(str.length - 1), 10) === (10000 - sum) % 10; +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isISO31661Alpha2.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isISO31661Alpha2; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +var _includes = _interopRequireDefault(require("./util/includes")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// from https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 +var validISO31661Alpha2CountriesCodes = ['AD', 'AE', 'AF', 'AG', 'AI', 'AL', 'AM', 'AO', 'AQ', 'AR', 'AS', 'AT', 'AU', 'AW', 'AX', 'AZ', 'BA', 'BB', 'BD', 'BE', 'BF', 'BG', 'BH', 'BI', 'BJ', 'BL', 'BM', 'BN', 'BO', 'BQ', 'BR', 'BS', 'BT', 'BV', 'BW', 'BY', 'BZ', 'CA', 'CC', 'CD', 'CF', 'CG', 'CH', 'CI', 'CK', 'CL', 'CM', 'CN', 'CO', 'CR', 'CU', 'CV', 'CW', 'CX', 'CY', 'CZ', 'DE', 'DJ', 'DK', 'DM', 'DO', 'DZ', 'EC', 'EE', 'EG', 'EH', 'ER', 'ES', 'ET', 'FI', 'FJ', 'FK', 'FM', 'FO', 'FR', 'GA', 'GB', 'GD', 'GE', 'GF', 'GG', 'GH', 'GI', 'GL', 'GM', 'GN', 'GP', 'GQ', 'GR', 'GS', 'GT', 'GU', 'GW', 'GY', 'HK', 'HM', 'HN', 'HR', 'HT', 'HU', 'ID', 'IE', 'IL', 'IM', 'IN', 'IO', 'IQ', 'IR', 'IS', 'IT', 'JE', 'JM', 'JO', 'JP', 'KE', 'KG', 'KH', 'KI', 'KM', 'KN', 'KP', 'KR', 'KW', 'KY', 'KZ', 'LA', 'LB', 'LC', 'LI', 'LK', 'LR', 'LS', 'LT', 'LU', 'LV', 'LY', 'MA', 'MC', 'MD', 'ME', 'MF', 'MG', 'MH', 'MK', 'ML', 'MM', 'MN', 'MO', 'MP', 'MQ', 'MR', 'MS', 'MT', 'MU', 'MV', 'MW', 'MX', 'MY', 'MZ', 'NA', 'NC', 'NE', 'NF', 'NG', 'NI', 'NL', 'NO', 'NP', 'NR', 'NU', 'NZ', 'OM', 'PA', 'PE', 'PF', 'PG', 'PH', 'PK', 'PL', 'PM', 'PN', 'PR', 'PS', 'PT', 'PW', 'PY', 'QA', 'RE', 'RO', 'RS', 'RU', 'RW', 'SA', 'SB', 'SC', 'SD', 'SE', 'SG', 'SH', 'SI', 'SJ', 'SK', 'SL', 'SM', 'SN', 'SO', 'SR', 'SS', 'ST', 'SV', 'SX', 'SY', 'SZ', 'TC', 'TD', 'TF', 'TG', 'TH', 'TJ', 'TK', 'TL', 'TM', 'TN', 'TO', 'TR', 'TT', 'TV', 'TW', 'TZ', 'UA', 'UG', 'UM', 'US', 'UY', 'UZ', 'VA', 'VC', 'VE', 'VG', 'VI', 'VN', 'VU', 'WF', 'WS', 'YE', 'YT', 'ZA', 'ZM', 'ZW']; + +function isISO31661Alpha2(str) { + (0, _assertString.default)(str); + return (0, _includes.default)(validISO31661Alpha2CountriesCodes, str.toUpperCase()); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js","./util/includes":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/includes.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isISO31661Alpha3.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isISO31661Alpha3; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +var _includes = _interopRequireDefault(require("./util/includes")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// from https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3 +var validISO31661Alpha3CountriesCodes = ['AFG', 'ALA', 'ALB', 'DZA', 'ASM', 'AND', 'AGO', 'AIA', 'ATA', 'ATG', 'ARG', 'ARM', 'ABW', 'AUS', 'AUT', 'AZE', 'BHS', 'BHR', 'BGD', 'BRB', 'BLR', 'BEL', 'BLZ', 'BEN', 'BMU', 'BTN', 'BOL', 'BES', 'BIH', 'BWA', 'BVT', 'BRA', 'IOT', 'BRN', 'BGR', 'BFA', 'BDI', 'KHM', 'CMR', 'CAN', 'CPV', 'CYM', 'CAF', 'TCD', 'CHL', 'CHN', 'CXR', 'CCK', 'COL', 'COM', 'COG', 'COD', 'COK', 'CRI', 'CIV', 'HRV', 'CUB', 'CUW', 'CYP', 'CZE', 'DNK', 'DJI', 'DMA', 'DOM', 'ECU', 'EGY', 'SLV', 'GNQ', 'ERI', 'EST', 'ETH', 'FLK', 'FRO', 'FJI', 'FIN', 'FRA', 'GUF', 'PYF', 'ATF', 'GAB', 'GMB', 'GEO', 'DEU', 'GHA', 'GIB', 'GRC', 'GRL', 'GRD', 'GLP', 'GUM', 'GTM', 'GGY', 'GIN', 'GNB', 'GUY', 'HTI', 'HMD', 'VAT', 'HND', 'HKG', 'HUN', 'ISL', 'IND', 'IDN', 'IRN', 'IRQ', 'IRL', 'IMN', 'ISR', 'ITA', 'JAM', 'JPN', 'JEY', 'JOR', 'KAZ', 'KEN', 'KIR', 'PRK', 'KOR', 'KWT', 'KGZ', 'LAO', 'LVA', 'LBN', 'LSO', 'LBR', 'LBY', 'LIE', 'LTU', 'LUX', 'MAC', 'MKD', 'MDG', 'MWI', 'MYS', 'MDV', 'MLI', 'MLT', 'MHL', 'MTQ', 'MRT', 'MUS', 'MYT', 'MEX', 'FSM', 'MDA', 'MCO', 'MNG', 'MNE', 'MSR', 'MAR', 'MOZ', 'MMR', 'NAM', 'NRU', 'NPL', 'NLD', 'NCL', 'NZL', 'NIC', 'NER', 'NGA', 'NIU', 'NFK', 'MNP', 'NOR', 'OMN', 'PAK', 'PLW', 'PSE', 'PAN', 'PNG', 'PRY', 'PER', 'PHL', 'PCN', 'POL', 'PRT', 'PRI', 'QAT', 'REU', 'ROU', 'RUS', 'RWA', 'BLM', 'SHN', 'KNA', 'LCA', 'MAF', 'SPM', 'VCT', 'WSM', 'SMR', 'STP', 'SAU', 'SEN', 'SRB', 'SYC', 'SLE', 'SGP', 'SXM', 'SVK', 'SVN', 'SLB', 'SOM', 'ZAF', 'SGS', 'SSD', 'ESP', 'LKA', 'SDN', 'SUR', 'SJM', 'SWZ', 'SWE', 'CHE', 'SYR', 'TWN', 'TJK', 'TZA', 'THA', 'TLS', 'TGO', 'TKL', 'TON', 'TTO', 'TUN', 'TUR', 'TKM', 'TCA', 'TUV', 'UGA', 'UKR', 'ARE', 'GBR', 'USA', 'UMI', 'URY', 'UZB', 'VUT', 'VEN', 'VNM', 'VGB', 'VIR', 'WLF', 'ESH', 'YEM', 'ZMB', 'ZWE']; + +function isISO31661Alpha3(str) { + (0, _assertString.default)(str); + return (0, _includes.default)(validISO31661Alpha3CountriesCodes, str.toUpperCase()); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js","./util/includes":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/includes.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isISO8601.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isISO8601; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/* eslint-disable max-len */ +// from http://goo.gl/0ejHHW +var iso8601 = /^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/; // same as above, except with a strict 'T' separator between date and time + +var iso8601StrictSeparator = /^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/; +/* eslint-enable max-len */ + +var isValidDate = function isValidDate(str) { + // str must have passed the ISO8601 check + // this check is meant to catch invalid dates + // like 2009-02-31 + // first check for ordinal dates + var ordinalMatch = str.match(/^(\d{4})-?(\d{3})([ T]{1}\.*|$)/); + + if (ordinalMatch) { + var oYear = Number(ordinalMatch[1]); + var oDay = Number(ordinalMatch[2]); // if is leap year + + if (oYear % 4 === 0 && oYear % 100 !== 0 || oYear % 400 === 0) return oDay <= 366; + return oDay <= 365; + } + + var match = str.match(/(\d{4})-?(\d{0,2})-?(\d*)/).map(Number); + var year = match[1]; + var month = match[2]; + var day = match[3]; + var monthString = month ? "0".concat(month).slice(-2) : month; + var dayString = day ? "0".concat(day).slice(-2) : day; // create a date object and compare + + var d = new Date("".concat(year, "-").concat(monthString || '01', "-").concat(dayString || '01')); + + if (month && day) { + return d.getUTCFullYear() === year && d.getUTCMonth() + 1 === month && d.getUTCDate() === day; + } + + return true; +}; + +function isISO8601(str) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + (0, _assertString.default)(str); + var check = options.strictSeparator ? iso8601StrictSeparator.test(str) : iso8601.test(str); + if (check && options.strict) return isValidDate(str); + return check; +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isISRC.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isISRC; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// see http://isrc.ifpi.org/en/isrc-standard/code-syntax +var isrc = /^[A-Z]{2}[0-9A-Z]{3}\d{2}\d{5}$/; + +function isISRC(str) { + (0, _assertString.default)(str); + return isrc.test(str); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isISSN.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isISSN; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var issn = '^\\d{4}-?\\d{3}[\\dX]$'; + +function isISSN(str) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + (0, _assertString.default)(str); + var testIssn = issn; + testIssn = options.require_hyphen ? testIssn.replace('?', '') : testIssn; + testIssn = options.case_sensitive ? new RegExp(testIssn) : new RegExp(testIssn, 'i'); + + if (!testIssn.test(str)) { + return false; + } + + var digits = str.replace('-', '').toUpperCase(); + var checksum = 0; + + for (var i = 0; i < digits.length; i++) { + var digit = digits[i]; + checksum += (digit === 'X' ? 10 : +digit) * (8 - i); + } + + return checksum % 11 === 0; +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isIdentityCard.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isIdentityCard; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var validators = { + ES: function ES(str) { + (0, _assertString.default)(str); + var DNI = /^[0-9X-Z][0-9]{7}[TRWAGMYFPDXBNJZSQVHLCKE]$/; + var charsValue = { + X: 0, + Y: 1, + Z: 2 + }; + var controlDigits = ['T', 'R', 'W', 'A', 'G', 'M', 'Y', 'F', 'P', 'D', 'X', 'B', 'N', 'J', 'Z', 'S', 'Q', 'V', 'H', 'L', 'C', 'K', 'E']; // sanitize user input + + var sanitized = str.trim().toUpperCase(); // validate the data structure + + if (!DNI.test(sanitized)) { + return false; + } // validate the control digit + + + var number = sanitized.slice(0, -1).replace(/[X,Y,Z]/g, function (char) { + return charsValue[char]; + }); + return sanitized.endsWith(controlDigits[number % 23]); + }, + IN: function IN(str) { + var DNI = /^[1-9]\d{3}\s?\d{4}\s?\d{4}$/; // multiplication table + + var d = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [1, 2, 3, 4, 0, 6, 7, 8, 9, 5], [2, 3, 4, 0, 1, 7, 8, 9, 5, 6], [3, 4, 0, 1, 2, 8, 9, 5, 6, 7], [4, 0, 1, 2, 3, 9, 5, 6, 7, 8], [5, 9, 8, 7, 6, 0, 4, 3, 2, 1], [6, 5, 9, 8, 7, 1, 0, 4, 3, 2], [7, 6, 5, 9, 8, 2, 1, 0, 4, 3], [8, 7, 6, 5, 9, 3, 2, 1, 0, 4], [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]]; // permutation table + + var p = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [1, 5, 7, 6, 2, 8, 3, 0, 9, 4], [5, 8, 0, 3, 7, 9, 6, 1, 4, 2], [8, 9, 1, 6, 0, 4, 3, 5, 2, 7], [9, 4, 5, 3, 1, 2, 6, 8, 7, 0], [4, 2, 8, 6, 5, 7, 3, 9, 0, 1], [2, 7, 9, 3, 8, 0, 6, 4, 1, 5], [7, 0, 4, 6, 9, 1, 3, 2, 5, 8]]; // sanitize user input + + var sanitized = str.trim(); // validate the data structure + + if (!DNI.test(sanitized)) { + return false; + } + + var c = 0; + var invertedArray = sanitized.replace(/\s/g, '').split('').map(Number).reverse(); + invertedArray.forEach(function (val, i) { + c = d[c][p[i % 8][val]]; + }); + return c === 0; + }, + IT: function IT(str) { + if (str.length !== 9) return false; + if (str === 'CA00000AA') return false; // https://it.wikipedia.org/wiki/Carta_d%27identit%C3%A0_elettronica_italiana + + return str.search(/C[A-Z][0-9]{5}[A-Z]{2}/i) > -1; + }, + NO: function NO(str) { + var sanitized = str.trim(); + if (isNaN(Number(sanitized))) return false; + if (sanitized.length !== 11) return false; + if (sanitized === '00000000000') return false; // https://no.wikipedia.org/wiki/F%C3%B8dselsnummer + + var f = sanitized.split('').map(Number); + var k1 = (11 - (3 * f[0] + 7 * f[1] + 6 * f[2] + 1 * f[3] + 8 * f[4] + 9 * f[5] + 4 * f[6] + 5 * f[7] + 2 * f[8]) % 11) % 11; + var k2 = (11 - (5 * f[0] + 4 * f[1] + 3 * f[2] + 2 * f[3] + 7 * f[4] + 6 * f[5] + 5 * f[6] + 4 * f[7] + 3 * f[8] + 2 * k1) % 11) % 11; + if (k1 !== f[9] || k2 !== f[10]) return false; + return true; + }, + 'he-IL': function heIL(str) { + var DNI = /^\d{9}$/; // sanitize user input + + var sanitized = str.trim(); // validate the data structure + + if (!DNI.test(sanitized)) { + return false; + } + + var id = sanitized; + var sum = 0, + incNum; + + for (var i = 0; i < id.length; i++) { + incNum = Number(id[i]) * (i % 2 + 1); // Multiply number by 1 or 2 + + sum += incNum > 9 ? incNum - 9 : incNum; // Sum the digits up and add to total + } + + return sum % 10 === 0; + }, + 'ar-TN': function arTN(str) { + var DNI = /^\d{8}$/; // sanitize user input + + var sanitized = str.trim(); // validate the data structure + + if (!DNI.test(sanitized)) { + return false; + } + + return true; + }, + 'zh-CN': function zhCN(str) { + var provincesAndCities = ['11', // 北京 + '12', // 天津 + '13', // 河北 + '14', // 山西 + '15', // 内蒙古 + '21', // 辽宁 + '22', // 吉林 + '23', // 黑龙江 + '31', // 上海 + '32', // 江苏 + '33', // 浙江 + '34', // 安徽 + '35', // 福建 + '36', // 江西 + '37', // 山东 + '41', // 河南 + '42', // 湖北 + '43', // 湖南 + '44', // 广东 + '45', // 广西 + '46', // 海南 + '50', // 重庆 + '51', // 四川 + '52', // 贵州 + '53', // 云南 + '54', // 西藏 + '61', // 陕西 + '62', // 甘肃 + '63', // 青海 + '64', // 宁夏 + '65', // 新疆 + '71', // 台湾 + '81', // 香港 + '82', // 澳门 + '91' // 国外 + ]; + var powers = ['7', '9', '10', '5', '8', '4', '2', '1', '6', '3', '7', '9', '10', '5', '8', '4', '2']; + var parityBit = ['1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2']; + + var checkAddressCode = function checkAddressCode(addressCode) { + return provincesAndCities.includes(addressCode); + }; + + var checkBirthDayCode = function checkBirthDayCode(birDayCode) { + var yyyy = parseInt(birDayCode.substring(0, 4), 10); + var mm = parseInt(birDayCode.substring(4, 6), 10); + var dd = parseInt(birDayCode.substring(6), 10); + var xdata = new Date(yyyy, mm - 1, dd); + + if (xdata > new Date()) { + return false; // eslint-disable-next-line max-len + } else if (xdata.getFullYear() === yyyy && xdata.getMonth() === mm - 1 && xdata.getDate() === dd) { + return true; + } + + return false; + }; + + var getParityBit = function getParityBit(idCardNo) { + var id17 = idCardNo.substring(0, 17); + var power = 0; + + for (var i = 0; i < 17; i++) { + power += parseInt(id17.charAt(i), 10) * parseInt(powers[i], 10); + } + + var mod = power % 11; + return parityBit[mod]; + }; + + var checkParityBit = function checkParityBit(idCardNo) { + return getParityBit(idCardNo) === idCardNo.charAt(17).toUpperCase(); + }; + + var check15IdCardNo = function check15IdCardNo(idCardNo) { + var check = /^[1-9]\d{7}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\d{3}$/.test(idCardNo); + if (!check) return false; + var addressCode = idCardNo.substring(0, 2); + check = checkAddressCode(addressCode); + if (!check) return false; + var birDayCode = "19".concat(idCardNo.substring(6, 12)); + check = checkBirthDayCode(birDayCode); + if (!check) return false; + return true; + }; + + var check18IdCardNo = function check18IdCardNo(idCardNo) { + var check = /^[1-9]\d{5}[1-9]\d{3}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\d{3}(\d|x|X)$/.test(idCardNo); + if (!check) return false; + var addressCode = idCardNo.substring(0, 2); + check = checkAddressCode(addressCode); + if (!check) return false; + var birDayCode = idCardNo.substring(6, 14); + check = checkBirthDayCode(birDayCode); + if (!check) return false; + return checkParityBit(idCardNo); + }; + + var checkIdCardNo = function checkIdCardNo(idCardNo) { + var check = /^\d{15}|(\d{17}(\d|x|X))$/.test(idCardNo); + if (!check) return false; + + if (idCardNo.length === 15) { + return check15IdCardNo(idCardNo); + } + + return check18IdCardNo(idCardNo); + }; + + return checkIdCardNo(str); + }, + 'zh-TW': function zhTW(str) { + var ALPHABET_CODES = { + A: 10, + B: 11, + C: 12, + D: 13, + E: 14, + F: 15, + G: 16, + H: 17, + I: 34, + J: 18, + K: 19, + L: 20, + M: 21, + N: 22, + O: 35, + P: 23, + Q: 24, + R: 25, + S: 26, + T: 27, + U: 28, + V: 29, + W: 32, + X: 30, + Y: 31, + Z: 33 + }; + var sanitized = str.trim().toUpperCase(); + if (!/^[A-Z][0-9]{9}$/.test(sanitized)) return false; + return Array.from(sanitized).reduce(function (sum, number, index) { + if (index === 0) { + var code = ALPHABET_CODES[number]; + return code % 10 * 9 + Math.floor(code / 10); + } + + if (index === 9) { + return (10 - sum % 10 - Number(number)) % 10 === 0; + } + + return sum + Number(number) * (9 - index); + }, 0); + } +}; + +function isIdentityCard(str, locale) { + (0, _assertString.default)(str); + + if (locale in validators) { + return validators[locale](str); + } else if (locale === 'any') { + for (var key in validators) { + // https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md#ignoring-code-for-coverage-purposes + // istanbul ignore else + if (validators.hasOwnProperty(key)) { + var validator = validators[key]; + + if (validator(str)) { + return true; + } + } + } + + return false; + } + + throw new Error("Invalid locale '".concat(locale, "'")); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isIn.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isIn; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +var _toString = _interopRequireDefault(require("./util/toString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function isIn(str, options) { + (0, _assertString.default)(str); + var i; + + if (Object.prototype.toString.call(options) === '[object Array]') { + var array = []; + + for (i in options) { + // https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md#ignoring-code-for-coverage-purposes + // istanbul ignore else + if ({}.hasOwnProperty.call(options, i)) { + array[i] = (0, _toString.default)(options[i]); + } + } + + return array.indexOf(str) >= 0; + } else if (_typeof(options) === 'object') { + return options.hasOwnProperty(str); + } else if (options && typeof options.indexOf === 'function') { + return options.indexOf(str) >= 0; + } + + return false; +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js","./util/toString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/toString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isInt.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isInt; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var int = /^(?:[-+]?(?:0|[1-9][0-9]*))$/; +var intLeadingZeroes = /^[-+]?[0-9]+$/; + +function isInt(str, options) { + (0, _assertString.default)(str); + options = options || {}; // Get the regex to use for testing, based on whether + // leading zeroes are allowed or not. + + var regex = options.hasOwnProperty('allow_leading_zeroes') && !options.allow_leading_zeroes ? int : intLeadingZeroes; // Check min/max/lt/gt + + var minCheckPassed = !options.hasOwnProperty('min') || str >= options.min; + var maxCheckPassed = !options.hasOwnProperty('max') || str <= options.max; + var ltCheckPassed = !options.hasOwnProperty('lt') || str < options.lt; + var gtCheckPassed = !options.hasOwnProperty('gt') || str > options.gt; + return regex.test(str) && minCheckPassed && maxCheckPassed && ltCheckPassed && gtCheckPassed; +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isJSON.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isJSON; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +var _merge = _interopRequireDefault(require("./util/merge")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +var default_json_options = { + allow_primitives: false +}; + +function isJSON(str, options) { + (0, _assertString.default)(str); + + try { + options = (0, _merge.default)(options, default_json_options); + var primitives = []; + + if (options.allow_primitives) { + primitives = [null, false, true]; + } + + var obj = JSON.parse(str); + return primitives.includes(obj) || !!obj && _typeof(obj) === 'object'; + } catch (e) { + /* ignore */ + } + + return false; +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js","./util/merge":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/merge.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isJWT.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isJWT; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +var _isBase = _interopRequireDefault(require("./isBase64")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function isJWT(str) { + (0, _assertString.default)(str); + var dotSplit = str.split('.'); + var len = dotSplit.length; + + if (len > 3 || len < 2) { + return false; + } + + return dotSplit.reduce(function (acc, currElem) { + return acc && (0, _isBase.default)(currElem, { + urlSafe: true + }); + }, true); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./isBase64":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isBase64.js","./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isLatLong.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isLatLong; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +var _merge = _interopRequireDefault(require("./util/merge")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var lat = /^\(?[+-]?(90(\.0+)?|[1-8]?\d(\.\d+)?)$/; +var long = /^\s?[+-]?(180(\.0+)?|1[0-7]\d(\.\d+)?|\d{1,2}(\.\d+)?)\)?$/; +var latDMS = /^(([1-8]?\d)\D+([1-5]?\d|60)\D+([1-5]?\d|60)(\.\d+)?|90\D+0\D+0)\D+[NSns]?$/i; +var longDMS = /^\s*([1-7]?\d{1,2}\D+([1-5]?\d|60)\D+([1-5]?\d|60)(\.\d+)?|180\D+0\D+0)\D+[EWew]?$/i; +var defaultLatLongOptions = { + checkDMS: false +}; + +function isLatLong(str, options) { + (0, _assertString.default)(str); + options = (0, _merge.default)(options, defaultLatLongOptions); + if (!str.includes(',')) return false; + var pair = str.split(','); + if (pair[0].startsWith('(') && !pair[1].endsWith(')') || pair[1].endsWith(')') && !pair[0].startsWith('(')) return false; + + if (options.checkDMS) { + return latDMS.test(pair[0]) && longDMS.test(pair[1]); + } + + return lat.test(pair[0]) && long.test(pair[1]); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js","./util/merge":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/merge.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isLength.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isLength; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +/* eslint-disable prefer-rest-params */ +function isLength(str, options) { + (0, _assertString.default)(str); + var min; + var max; + + if (_typeof(options) === 'object') { + min = options.min || 0; + max = options.max; + } else { + // backwards compatibility: isLength(str, min [, max]) + min = arguments[1] || 0; + max = arguments[2]; + } + + var surrogatePairs = str.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g) || []; + var len = str.length - surrogatePairs.length; + return len >= min && (typeof max === 'undefined' || len <= max); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isLocale.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isLocale; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var localeReg = /^[A-z]{2,4}([_-]([A-z]{4}|[\d]{3}))?([_-]([A-z]{2}|[\d]{3}))?$/; + +function isLocale(str) { + (0, _assertString.default)(str); + + if (str === 'en_US_POSIX' || str === 'ca_ES_VALENCIA') { + return true; + } + + return localeReg.test(str); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isLowercase.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isLowercase; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function isLowercase(str) { + (0, _assertString.default)(str); + return str === str.toLowerCase(); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isMACAddress.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isMACAddress; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var macAddress = /^([0-9a-fA-F][0-9a-fA-F]:){5}([0-9a-fA-F][0-9a-fA-F])$/; +var macAddressNoColons = /^([0-9a-fA-F]){12}$/; +var macAddressWithHyphen = /^([0-9a-fA-F][0-9a-fA-F]-){5}([0-9a-fA-F][0-9a-fA-F])$/; +var macAddressWithSpaces = /^([0-9a-fA-F][0-9a-fA-F]\s){5}([0-9a-fA-F][0-9a-fA-F])$/; +var macAddressWithDots = /^([0-9a-fA-F]{4}).([0-9a-fA-F]{4}).([0-9a-fA-F]{4})$/; + +function isMACAddress(str, options) { + (0, _assertString.default)(str); + + if (options && options.no_colons) { + return macAddressNoColons.test(str); + } + + return macAddress.test(str) || macAddressWithHyphen.test(str) || macAddressWithSpaces.test(str) || macAddressWithDots.test(str); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isMD5.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isMD5; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var md5 = /^[a-f0-9]{32}$/; + +function isMD5(str) { + (0, _assertString.default)(str); + return md5.test(str); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isMagnetURI.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isMagnetURI; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var magnetURI = /^magnet:\?xt=urn:[a-z0-9]+:[a-z0-9]{32,40}&dn=.+&tr=.+$/i; + +function isMagnetURI(url) { + (0, _assertString.default)(url); + return magnetURI.test(url.trim()); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isMimeType.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isMimeType; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/* + Checks if the provided string matches to a correct Media type format (MIME type) + + This function only checks is the string format follows the + etablished rules by the according RFC specifications. + This function supports 'charset' in textual media types + (https://tools.ietf.org/html/rfc6657). + + This function does not check against all the media types listed + by the IANA (https://www.iana.org/assignments/media-types/media-types.xhtml) + because of lightness purposes : it would require to include + all these MIME types in this librairy, which would weigh it + significantly. This kind of effort maybe is not worth for the use that + this function has in this entire librairy. + + More informations in the RFC specifications : + - https://tools.ietf.org/html/rfc2045 + - https://tools.ietf.org/html/rfc2046 + - https://tools.ietf.org/html/rfc7231#section-3.1.1.1 + - https://tools.ietf.org/html/rfc7231#section-3.1.1.5 +*/ +// Match simple MIME types +// NB : +// Subtype length must not exceed 100 characters. +// This rule does not comply to the RFC specs (what is the max length ?). +var mimeTypeSimple = /^(application|audio|font|image|message|model|multipart|text|video)\/[a-zA-Z0-9\.\-\+]{1,100}$/i; // eslint-disable-line max-len +// Handle "charset" in "text/*" + +var mimeTypeText = /^text\/[a-zA-Z0-9\.\-\+]{1,100};\s?charset=("[a-zA-Z0-9\.\-\+\s]{0,70}"|[a-zA-Z0-9\.\-\+]{0,70})(\s?\([a-zA-Z0-9\.\-\+\s]{1,20}\))?$/i; // eslint-disable-line max-len +// Handle "boundary" in "multipart/*" + +var mimeTypeMultipart = /^multipart\/[a-zA-Z0-9\.\-\+]{1,100}(;\s?(boundary|charset)=("[a-zA-Z0-9\.\-\+\s]{0,70}"|[a-zA-Z0-9\.\-\+]{0,70})(\s?\([a-zA-Z0-9\.\-\+\s]{1,20}\))?){0,2}$/i; // eslint-disable-line max-len + +function isMimeType(str) { + (0, _assertString.default)(str); + return mimeTypeSimple.test(str) || mimeTypeText.test(str) || mimeTypeMultipart.test(str); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isMobilePhone.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isMobilePhone; +exports.locales = void 0; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/* eslint-disable max-len */ +var phones = { + 'am-AM': /^(\+?374|0)((10|[9|7][0-9])\d{6}$|[2-4]\d{7}$)/, + 'ar-AE': /^((\+?971)|0)?5[024568]\d{7}$/, + 'ar-BH': /^(\+?973)?(3|6)\d{7}$/, + 'ar-DZ': /^(\+?213|0)(5|6|7)\d{8}$/, + 'ar-LB': /^(\+?961)?((3|81)\d{6}|7\d{7})$/, + 'ar-EG': /^((\+?20)|0)?1[0125]\d{8}$/, + 'ar-IQ': /^(\+?964|0)?7[0-9]\d{8}$/, + 'ar-JO': /^(\+?962|0)?7[789]\d{7}$/, + 'ar-KW': /^(\+?965)[569]\d{7}$/, + 'ar-LY': /^((\+?218)|0)?(9[1-6]\d{7}|[1-8]\d{7,9})$/, + 'ar-MA': /^(?:(?:\+|00)212|0)[5-7]\d{8}$/, + 'ar-SA': /^(!?(\+?966)|0)?5\d{8}$/, + 'ar-SY': /^(!?(\+?963)|0)?9\d{8}$/, + 'ar-TN': /^(\+?216)?[2459]\d{7}$/, + 'az-AZ': /^(\+994|0)(5[015]|7[07]|99)\d{7}$/, + 'bs-BA': /^((((\+|00)3876)|06))((([0-3]|[5-6])\d{6})|(4\d{7}))$/, + 'be-BY': /^(\+?375)?(24|25|29|33|44)\d{7}$/, + 'bg-BG': /^(\+?359|0)?8[789]\d{7}$/, + 'bn-BD': /^(\+?880|0)1[13456789][0-9]{8}$/, + 'ca-AD': /^(\+376)?[346]\d{5}$/, + 'cs-CZ': /^(\+?420)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/, + 'da-DK': /^(\+?45)?\s?\d{2}\s?\d{2}\s?\d{2}\s?\d{2}$/, + 'de-DE': /^(\+49)?0?[1|3]([0|5][0-45-9]\d|6([23]|0\d?)|7([0-57-9]|6\d))\d{7}$/, + 'de-AT': /^(\+43|0)\d{1,4}\d{3,12}$/, + 'de-CH': /^(\+41|0)(7[5-9])\d{1,7}$/, + 'de-LU': /^(\+352)?((6\d1)\d{6})$/, + 'el-GR': /^(\+?30|0)?(69\d{8})$/, + 'en-AU': /^(\+?61|0)4\d{8}$/, + 'en-GB': /^(\+?44|0)7\d{9}$/, + 'en-GG': /^(\+?44|0)1481\d{6}$/, + 'en-GH': /^(\+233|0)(20|50|24|54|27|57|26|56|23|28)\d{7}$/, + 'en-HK': /^(\+?852[-\s]?)?[456789]\d{3}[-\s]?\d{4}$/, + 'en-MO': /^(\+?853[-\s]?)?[6]\d{3}[-\s]?\d{4}$/, + 'en-IE': /^(\+?353|0)8[356789]\d{7}$/, + 'en-IN': /^(\+?91|0)?[6789]\d{9}$/, + 'en-KE': /^(\+?254|0)(7|1)\d{8}$/, + 'en-MT': /^(\+?356|0)?(99|79|77|21|27|22|25)[0-9]{6}$/, + 'en-MU': /^(\+?230|0)?\d{8}$/, + 'en-NG': /^(\+?234|0)?[789]\d{9}$/, + 'en-NZ': /^(\+?64|0)[28]\d{7,9}$/, + 'en-PK': /^((\+92)|(0092))-{0,1}\d{3}-{0,1}\d{7}$|^\d{11}$|^\d{4}-\d{7}$/, + 'en-PH': /^(09|\+639)\d{9}$/, + 'en-RW': /^(\+?250|0)?[7]\d{8}$/, + 'en-SG': /^(\+65)?[689]\d{7}$/, + 'en-SL': /^(?:0|94|\+94)?(7(0|1|2|5|6|7|8)( |-)?\d)\d{6}$/, + 'en-TZ': /^(\+?255|0)?[67]\d{8}$/, + 'en-UG': /^(\+?256|0)?[7]\d{8}$/, + 'en-US': /^((\+1|1)?( |-)?)?(\([2-9][0-9]{2}\)|[2-9][0-9]{2})( |-)?([2-9][0-9]{2}( |-)?[0-9]{4})$/, + 'en-ZA': /^(\+?27|0)\d{9}$/, + 'en-ZM': /^(\+?26)?09[567]\d{7}$/, + 'en-ZW': /^(\+263)[0-9]{9}$/, + 'es-AR': /^\+?549(11|[2368]\d)\d{8}$/, + 'es-BO': /^(\+?591)?(6|7)\d{7}$/, + 'es-CO': /^(\+?57)?([1-8]{1}|3[0-9]{2})?[2-9]{1}\d{6}$/, + 'es-CL': /^(\+?56|0)[2-9]\d{1}\d{7}$/, + 'es-CR': /^(\+506)?[2-8]\d{7}$/, + 'es-DO': /^(\+?1)?8[024]9\d{7}$/, + 'es-HN': /^(\+?504)?[9|8]\d{7}$/, + 'es-EC': /^(\+?593|0)([2-7]|9[2-9])\d{7}$/, + 'es-ES': /^(\+?34)?[6|7]\d{8}$/, + 'es-PE': /^(\+?51)?9\d{8}$/, + 'es-MX': /^(\+?52)?(1|01)?\d{10,11}$/, + 'es-PA': /^(\+?507)\d{7,8}$/, + 'es-PY': /^(\+?595|0)9[9876]\d{7}$/, + 'es-UY': /^(\+598|0)9[1-9][\d]{6}$/, + 'et-EE': /^(\+?372)?\s?(5|8[1-4])\s?([0-9]\s?){6,7}$/, + 'fa-IR': /^(\+?98[\-\s]?|0)9[0-39]\d[\-\s]?\d{3}[\-\s]?\d{4}$/, + 'fi-FI': /^(\+?358|0)\s?(4(0|1|2|4|5|6)?|50)\s?(\d\s?){4,8}\d$/, + 'fj-FJ': /^(\+?679)?\s?\d{3}\s?\d{4}$/, + 'fo-FO': /^(\+?298)?\s?\d{2}\s?\d{2}\s?\d{2}$/, + 'fr-FR': /^(\+?33|0)[67]\d{8}$/, + 'fr-GF': /^(\+?594|0|00594)[67]\d{8}$/, + 'fr-GP': /^(\+?590|0|00590)[67]\d{8}$/, + 'fr-MQ': /^(\+?596|0|00596)[67]\d{8}$/, + 'fr-RE': /^(\+?262|0|00262)[67]\d{8}$/, + 'he-IL': /^(\+972|0)([23489]|5[012345689]|77)[1-9]\d{6}$/, + 'hu-HU': /^(\+?36)(20|30|70)\d{7}$/, + 'id-ID': /^(\+?62|0)8(1[123456789]|2[1238]|3[1238]|5[12356789]|7[78]|9[56789]|8[123456789])([\s?|\d]{5,11})$/, + 'it-IT': /^(\+?39)?\s?3\d{2} ?\d{6,7}$/, + 'it-SM': /^((\+378)|(0549)|(\+390549)|(\+3780549))?6\d{5,9}$/, + 'ja-JP': /^(\+81[ \-]?(\(0\))?|0)[6789]0[ \-]?\d{4}[ \-]?\d{4}$/, + 'ka-GE': /^(\+?995)?(5|79)\d{7}$/, + 'kk-KZ': /^(\+?7|8)?7\d{9}$/, + 'kl-GL': /^(\+?299)?\s?\d{2}\s?\d{2}\s?\d{2}$/, + 'ko-KR': /^((\+?82)[ \-]?)?0?1([0|1|6|7|8|9]{1})[ \-]?\d{3,4}[ \-]?\d{4}$/, + 'lt-LT': /^(\+370|8)\d{8}$/, + 'ms-MY': /^(\+?6?01){1}(([0145]{1}(\-|\s)?\d{7,8})|([236789]{1}(\s|\-)?\d{7}))$/, + 'nb-NO': /^(\+?47)?[49]\d{7}$/, + 'ne-NP': /^(\+?977)?9[78]\d{8}$/, + 'nl-BE': /^(\+?32|0)4?\d{8}$/, + 'nl-NL': /^(((\+|00)?31\(0\))|((\+|00)?31)|0)6{1}\d{8}$/, + 'nn-NO': /^(\+?47)?[49]\d{7}$/, + 'pl-PL': /^(\+?48)? ?[5-8]\d ?\d{3} ?\d{2} ?\d{2}$/, + 'pt-BR': /^((\+?55\ ?[1-9]{2}\ ?)|(\+?55\ ?\([1-9]{2}\)\ ?)|(0[1-9]{2}\ ?)|(\([1-9]{2}\)\ ?)|([1-9]{2}\ ?))((\d{4}\-?\d{4})|(9[2-9]{1}\d{3}\-?\d{4}))$/, + 'pt-PT': /^(\+?351)?9[1236]\d{7}$/, + 'ro-RO': /^(\+?4?0)\s?7\d{2}(\/|\s|\.|\-)?\d{3}(\s|\.|\-)?\d{3}$/, + 'ru-RU': /^(\+?7|8)?9\d{9}$/, + 'sl-SI': /^(\+386\s?|0)(\d{1}\s?\d{3}\s?\d{2}\s?\d{2}|\d{2}\s?\d{3}\s?\d{3})$/, + 'sk-SK': /^(\+?421)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/, + 'sq-AL': /^(\+355|0)6[789]\d{6}$/, + 'sr-RS': /^(\+3816|06)[- \d]{5,9}$/, + 'sv-SE': /^(\+?46|0)[\s\-]?7[\s\-]?[02369]([\s\-]?\d){7}$/, + 'th-TH': /^(\+66|66|0)\d{9}$/, + 'tr-TR': /^(\+?90|0)?5\d{9}$/, + 'uk-UA': /^(\+?38|8)?0\d{9}$/, + 'uz-UZ': /^(\+?998)?(6[125-79]|7[1-69]|88|9\d)\d{7}$/, + 'vi-VN': /^(\+?84|0)((3([2-9]))|(5([2689]))|(7([0|6-9]))|(8([1-6|89]))|(9([0-9])))([0-9]{7})$/, + 'zh-CN': /^((\+|00)86)?1([3568][0-9]|4[579]|6[67]|7[01235678]|9[012356789])[0-9]{8}$/, + 'zh-TW': /^(\+?886\-?|0)?9\d{8}$/ +}; +/* eslint-enable max-len */ +// aliases + +phones['en-CA'] = phones['en-US']; +phones['fr-CA'] = phones['en-CA']; +phones['fr-BE'] = phones['nl-BE']; +phones['zh-HK'] = phones['en-HK']; +phones['zh-MO'] = phones['en-MO']; +phones['ga-IE'] = phones['en-IE']; + +function isMobilePhone(str, locale, options) { + (0, _assertString.default)(str); + + if (options && options.strictMode && !str.startsWith('+')) { + return false; + } + + if (Array.isArray(locale)) { + return locale.some(function (key) { + // https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md#ignoring-code-for-coverage-purposes + // istanbul ignore else + if (phones.hasOwnProperty(key)) { + var phone = phones[key]; + + if (phone.test(str)) { + return true; + } + } + + return false; + }); + } else if (locale in phones) { + return phones[locale].test(str); // alias falsey locale as 'any' + } else if (!locale || locale === 'any') { + for (var key in phones) { + // istanbul ignore else + if (phones.hasOwnProperty(key)) { + var phone = phones[key]; + + if (phone.test(str)) { + return true; + } + } + } + + return false; + } + + throw new Error("Invalid locale '".concat(locale, "'")); +} + +var locales = Object.keys(phones); +exports.locales = locales; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isMongoId.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isMongoId; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +var _isHexadecimal = _interopRequireDefault(require("./isHexadecimal")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function isMongoId(str) { + (0, _assertString.default)(str); + return (0, _isHexadecimal.default)(str) && str.length === 24; +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./isHexadecimal":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isHexadecimal.js","./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isMultibyte.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isMultibyte; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/* eslint-disable no-control-regex */ +var multibyte = /[^\x00-\x7F]/; +/* eslint-enable no-control-regex */ + +function isMultibyte(str) { + (0, _assertString.default)(str); + return multibyte.test(str); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isNumeric.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isNumeric; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +var _alpha = require("./alpha"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var numericNoSymbols = /^[0-9]+$/; + +function isNumeric(str, options) { + (0, _assertString.default)(str); + + if (options && options.no_symbols) { + return numericNoSymbols.test(str); + } + + return new RegExp("^[+-]?([0-9]*[".concat((options || {}).locale ? _alpha.decimal[options.locale] : '.', "])?[0-9]+$")).test(str); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./alpha":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/alpha.js","./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isOctal.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isOctal; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var octal = /^(0o)?[0-7]+$/i; + +function isOctal(str) { + (0, _assertString.default)(str); + return octal.test(str); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isPassportNumber.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isPassportNumber; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Reference: + * https://en.wikipedia.org/ -- Wikipedia + * https://docs.microsoft.com/en-us/microsoft-365/compliance/eu-passport-number -- EU Passport Number + * https://countrycode.org/ -- Country Codes + */ +var passportRegexByCountryCode = { + AM: /^[A-Z]{2}\d{7}$/, + // ARMENIA + AR: /^[A-Z]{3}\d{6}$/, + // ARGENTINA + AT: /^[A-Z]\d{7}$/, + // AUSTRIA + AU: /^[A-Z]\d{7}$/, + // AUSTRALIA + BE: /^[A-Z]{2}\d{6}$/, + // BELGIUM + BG: /^\d{9}$/, + // BULGARIA + BY: /^[A-Z]{2}\d{7}$/, + // BELARUS + CA: /^[A-Z]{2}\d{6}$/, + // CANADA + CH: /^[A-Z]\d{7}$/, + // SWITZERLAND + CN: /^[GE]\d{8}$/, + // CHINA [G=Ordinary, E=Electronic] followed by 8-digits + CY: /^[A-Z](\d{6}|\d{8})$/, + // CYPRUS + CZ: /^\d{8}$/, + // CZECH REPUBLIC + DE: /^[CFGHJKLMNPRTVWXYZ0-9]{9}$/, + // GERMANY + DK: /^\d{9}$/, + // DENMARK + DZ: /^\d{9}$/, + // ALGERIA + EE: /^([A-Z]\d{7}|[A-Z]{2}\d{7})$/, + // ESTONIA (K followed by 7-digits), e-passports have 2 UPPERCASE followed by 7 digits + ES: /^[A-Z0-9]{2}([A-Z0-9]?)\d{6}$/, + // SPAIN + FI: /^[A-Z]{2}\d{7}$/, + // FINLAND + FR: /^\d{2}[A-Z]{2}\d{5}$/, + // FRANCE + GB: /^\d{9}$/, + // UNITED KINGDOM + GR: /^[A-Z]{2}\d{7}$/, + // GREECE + HR: /^\d{9}$/, + // CROATIA + HU: /^[A-Z]{2}(\d{6}|\d{7})$/, + // HUNGARY + IE: /^[A-Z0-9]{2}\d{7}$/, + // IRELAND + IN: /^[A-Z]{1}-?\d{7}$/, + // INDIA + IS: /^(A)\d{7}$/, + // ICELAND + IT: /^[A-Z0-9]{2}\d{7}$/, + // ITALY + JP: /^[A-Z]{2}\d{7}$/, + // JAPAN + KR: /^[MS]\d{8}$/, + // SOUTH KOREA, REPUBLIC OF KOREA, [S=PS Passports, M=PM Passports] + LT: /^[A-Z0-9]{8}$/, + // LITHUANIA + LU: /^[A-Z0-9]{8}$/, + // LUXEMBURG + LV: /^[A-Z0-9]{2}\d{7}$/, + // LATVIA + MT: /^\d{7}$/, + // MALTA + NL: /^[A-Z]{2}[A-Z0-9]{6}\d$/, + // NETHERLANDS + PO: /^[A-Z]{2}\d{7}$/, + // POLAND + PT: /^[A-Z]\d{6}$/, + // PORTUGAL + RO: /^\d{8,9}$/, + // ROMANIA + RU: /^\d{2}\d{2}\d{6}$/, + // RUSSIAN FEDERATION + SE: /^\d{8}$/, + // SWEDEN + SL: /^(P)[A-Z]\d{7}$/, + // SLOVANIA + SK: /^[0-9A-Z]\d{7}$/, + // SLOVAKIA + TR: /^[A-Z]\d{8}$/, + // TURKEY + UA: /^[A-Z]{2}\d{6}$/, + // UKRAINE + US: /^\d{9}$/ // UNITED STATES + +}; +/** + * Check if str is a valid passport number + * relative to provided ISO Country Code. + * + * @param {string} str + * @param {string} countryCode + * @return {boolean} + */ + +function isPassportNumber(str, countryCode) { + (0, _assertString.default)(str); + /** Remove All Whitespaces, Convert to UPPERCASE */ + + var normalizedStr = str.replace(/\s/g, '').toUpperCase(); + return countryCode.toUpperCase() in passportRegexByCountryCode && passportRegexByCountryCode[countryCode].test(normalizedStr); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isPort.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isPort; + +var _isInt = _interopRequireDefault(require("./isInt")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function isPort(str) { + return (0, _isInt.default)(str, { + min: 0, + max: 65535 + }); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./isInt":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isInt.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isPostalCode.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isPostalCode; +exports.locales = void 0; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// common patterns +var threeDigit = /^\d{3}$/; +var fourDigit = /^\d{4}$/; +var fiveDigit = /^\d{5}$/; +var sixDigit = /^\d{6}$/; +var patterns = { + AD: /^AD\d{3}$/, + AT: fourDigit, + AU: fourDigit, + AZ: /^AZ\d{4}$/, + BE: fourDigit, + BG: fourDigit, + BR: /^\d{5}-\d{3}$/, + BY: /2[1-4]{1}\d{4}$/, + CA: /^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJ-NPRSTV-Z][\s\-]?\d[ABCEGHJ-NPRSTV-Z]\d$/i, + CH: fourDigit, + CN: /^(0[1-7]|1[012356]|2[0-7]|3[0-6]|4[0-7]|5[1-7]|6[1-7]|7[1-5]|8[1345]|9[09])\d{4}$/, + CZ: /^\d{3}\s?\d{2}$/, + DE: fiveDigit, + DK: fourDigit, + DO: fiveDigit, + DZ: fiveDigit, + EE: fiveDigit, + ES: /^(5[0-2]{1}|[0-4]{1}\d{1})\d{3}$/, + FI: fiveDigit, + FR: /^\d{2}\s?\d{3}$/, + GB: /^(gir\s?0aa|[a-z]{1,2}\d[\da-z]?\s?(\d[a-z]{2})?)$/i, + GR: /^\d{3}\s?\d{2}$/, + HR: /^([1-5]\d{4}$)/, + HT: /^HT\d{4}$/, + HU: fourDigit, + ID: fiveDigit, + IE: /^(?!.*(?:o))[A-z]\d[\dw]\s\w{4}$/i, + IL: /^(\d{5}|\d{7})$/, + IN: /^((?!10|29|35|54|55|65|66|86|87|88|89)[1-9][0-9]{5})$/, + IR: /\b(?!(\d)\1{3})[13-9]{4}[1346-9][013-9]{5}\b/, + IS: threeDigit, + IT: fiveDigit, + JP: /^\d{3}\-\d{4}$/, + KE: fiveDigit, + LI: /^(948[5-9]|949[0-7])$/, + LT: /^LT\-\d{5}$/, + LU: fourDigit, + LV: /^LV\-\d{4}$/, + MX: fiveDigit, + MT: /^[A-Za-z]{3}\s{0,1}\d{4}$/, + MY: fiveDigit, + NL: /^\d{4}\s?[a-z]{2}$/i, + NO: fourDigit, + NP: /^(10|21|22|32|33|34|44|45|56|57)\d{3}$|^(977)$/i, + NZ: fourDigit, + PL: /^\d{2}\-\d{3}$/, + PR: /^00[679]\d{2}([ -]\d{4})?$/, + PT: /^\d{4}\-\d{3}?$/, + RO: sixDigit, + RU: sixDigit, + SA: fiveDigit, + SE: /^[1-9]\d{2}\s?\d{2}$/, + SG: sixDigit, + SI: fourDigit, + SK: /^\d{3}\s?\d{2}$/, + TH: fiveDigit, + TN: fourDigit, + TW: /^\d{3}(\d{2})?$/, + UA: fiveDigit, + US: /^\d{5}(-\d{4})?$/, + ZA: fourDigit, + ZM: fiveDigit +}; +var locales = Object.keys(patterns); +exports.locales = locales; + +function isPostalCode(str, locale) { + (0, _assertString.default)(str); + + if (locale in patterns) { + return patterns[locale].test(str); + } else if (locale === 'any') { + for (var key in patterns) { + // https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md#ignoring-code-for-coverage-purposes + // istanbul ignore else + if (patterns.hasOwnProperty(key)) { + var pattern = patterns[key]; + + if (pattern.test(str)) { + return true; + } + } + } + + return false; + } + + throw new Error("Invalid locale '".concat(locale, "'")); +} +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isRFC3339.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isRFC3339; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/* Based on https://tools.ietf.org/html/rfc3339#section-5.6 */ +var dateFullYear = /[0-9]{4}/; +var dateMonth = /(0[1-9]|1[0-2])/; +var dateMDay = /([12]\d|0[1-9]|3[01])/; +var timeHour = /([01][0-9]|2[0-3])/; +var timeMinute = /[0-5][0-9]/; +var timeSecond = /([0-5][0-9]|60)/; +var timeSecFrac = /(\.[0-9]+)?/; +var timeNumOffset = new RegExp("[-+]".concat(timeHour.source, ":").concat(timeMinute.source)); +var timeOffset = new RegExp("([zZ]|".concat(timeNumOffset.source, ")")); +var partialTime = new RegExp("".concat(timeHour.source, ":").concat(timeMinute.source, ":").concat(timeSecond.source).concat(timeSecFrac.source)); +var fullDate = new RegExp("".concat(dateFullYear.source, "-").concat(dateMonth.source, "-").concat(dateMDay.source)); +var fullTime = new RegExp("".concat(partialTime.source).concat(timeOffset.source)); +var rfc3339 = new RegExp("".concat(fullDate.source, "[ tT]").concat(fullTime.source)); + +function isRFC3339(str) { + (0, _assertString.default)(str); + return rfc3339.test(str); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isRgbColor.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isRgbColor; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var rgbColor = /^rgb\((([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]),){2}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\)$/; +var rgbaColor = /^rgba\((([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]),){3}(0?\.\d|1(\.0)?|0(\.0)?)\)$/; +var rgbColorPercent = /^rgb\((([0-9]%|[1-9][0-9]%|100%),){2}([0-9]%|[1-9][0-9]%|100%)\)/; +var rgbaColorPercent = /^rgba\((([0-9]%|[1-9][0-9]%|100%),){3}(0?\.\d|1(\.0)?|0(\.0)?)\)/; + +function isRgbColor(str) { + var includePercentValues = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + (0, _assertString.default)(str); + + if (!includePercentValues) { + return rgbColor.test(str) || rgbaColor.test(str); + } + + return rgbColor.test(str) || rgbaColor.test(str) || rgbColorPercent.test(str) || rgbaColorPercent.test(str); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isSemVer.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isSemVer; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +var _multilineRegex = _interopRequireDefault(require("./util/multilineRegex")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Regular Expression to match + * semantic versioning (SemVer) + * built from multi-line, multi-parts regexp + * Reference: https://semver.org/ + */ +var semanticVersioningRegex = (0, _multilineRegex.default)(['^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)', '(?:-((?:0|[1-9]\\d*|\\d*[a-z-][0-9a-z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-z-][0-9a-z-]*))*))', '?(?:\\+([0-9a-z-]+(?:\\.[0-9a-z-]+)*))?$'], 'i'); + +function isSemVer(str) { + (0, _assertString.default)(str); + return semanticVersioningRegex.test(str); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js","./util/multilineRegex":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/multilineRegex.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isSlug.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isSlug; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var charsetRegex = /^[^\s-_](?!.*?[-_]{2,})([a-z0-9-\\]{1,})[^\s]*[^-_\s]$/; + +function isSlug(str) { + (0, _assertString.default)(str); + return charsetRegex.test(str); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isStrongPassword.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isStrongPassword; + +var _merge = _interopRequireDefault(require("./util/merge")); + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var upperCaseRegex = /^[A-Z]$/; +var lowerCaseRegex = /^[a-z]$/; +var numberRegex = /^[0-9]$/; +var symbolRegex = /^[-#!$%^&*()_+|~=`{}\[\]:";'<>?,.\/ ]$/; +var defaultOptions = { + minLength: 8, + minLowercase: 1, + minUppercase: 1, + minNumbers: 1, + minSymbols: 1, + returnScore: false, + pointsPerUnique: 1, + pointsPerRepeat: 0.5, + pointsForContainingLower: 10, + pointsForContainingUpper: 10, + pointsForContainingNumber: 10, + pointsForContainingSymbol: 10 +}; +/* Counts number of occurrences of each char in a string + * could be moved to util/ ? +*/ + +function countChars(str) { + var result = {}; + Array.from(str).forEach(function (char) { + var curVal = result[char]; + + if (curVal) { + result[char] += 1; + } else { + result[char] = 1; + } + }); + return result; +} +/* Return information about a password */ + + +function analyzePassword(password) { + var charMap = countChars(password); + var analysis = { + length: password.length, + uniqueChars: Object.keys(charMap).length, + uppercaseCount: 0, + lowercaseCount: 0, + numberCount: 0, + symbolCount: 0 + }; + Object.keys(charMap).forEach(function (char) { + if (upperCaseRegex.test(char)) { + analysis.uppercaseCount += charMap[char]; + } else if (lowerCaseRegex.test(char)) { + analysis.lowercaseCount += charMap[char]; + } else if (numberRegex.test(char)) { + analysis.numberCount += charMap[char]; + } else if (symbolRegex.test(char)) { + analysis.symbolCount += charMap[char]; + } + }); + return analysis; +} + +function scorePassword(analysis, scoringOptions) { + var points = 0; + points += analysis.uniqueChars * scoringOptions.pointsPerUnique; + points += (analysis.length - analysis.uniqueChars) * scoringOptions.pointsPerRepeat; + + if (analysis.lowercaseCount > 0) { + points += scoringOptions.pointsForContainingLower; + } + + if (analysis.uppercaseCount > 0) { + points += scoringOptions.pointsForContainingUpper; + } + + if (analysis.numberCount > 0) { + points += scoringOptions.pointsForContainingNumber; + } + + if (analysis.symbolCount > 0) { + points += scoringOptions.pointsForContainingSymbol; + } + + return points; +} + +function isStrongPassword(str) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + (0, _assertString.default)(str); + var analysis = analyzePassword(str); + options = (0, _merge.default)(options || {}, defaultOptions); + + if (options.returnScore) { + return scorePassword(analysis, options); + } + + return analysis.length >= options.minLength && analysis.lowercaseCount >= options.minLowercase && analysis.uppercaseCount >= options.minUppercase && analysis.numberCount >= options.minNumbers && analysis.symbolCount >= options.minSymbols; +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js","./util/merge":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/merge.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isSurrogatePair.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isSurrogatePair; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var surrogatePair = /[\uD800-\uDBFF][\uDC00-\uDFFF]/; + +function isSurrogatePair(str) { + (0, _assertString.default)(str); + return surrogatePair.test(str); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isTaxID.js":[function(require,module,exports){ +"use strict"; + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isTaxID; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +var algorithms = _interopRequireWildcard(require("./util/algorithms")); + +var _isDate = _interopRequireDefault(require("./isDate")); + +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } + +function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } + +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } + +function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } + +function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } + +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } + +/** + * TIN Validation + * Validates Tax Identification Numbers (TINs) from the US, EU member states and the United Kingdom. + * + * EU-UK: + * National TIN validity is calculated using public algorithms as made available by DG TAXUD. + * + * See `https://ec.europa.eu/taxation_customs/tin/specs/FS-TIN%20Algorithms-Public.docx` for more information. + * + * US: + * An Employer Identification Number (EIN), also known as a Federal Tax Identification Number, + * is used to identify a business entity. + * + * NOTES: + * - Prefix 47 is being reserved for future use + * - Prefixes 26, 27, 45, 46 and 47 were previously assigned by the Philadelphia campus. + * + * See `http://www.irs.gov/Businesses/Small-Businesses-&-Self-Employed/How-EINs-are-Assigned-and-Valid-EIN-Prefixes` + * for more information. + */ +// Locale functions + +/* + * bg-BG validation function + * (Edinen graždanski nomer (EGN/ЕГН), persons only) + * Checks if birth date (first six digits) is valid and calculates check (last) digit + */ +function bgBgCheck(tin) { + // Extract full year, normalize month and check birth date validity + var century_year = tin.slice(0, 2); + var month = parseInt(tin.slice(2, 4), 10); + + if (month > 40) { + month -= 40; + century_year = "20".concat(century_year); + } else if (month > 20) { + month -= 20; + century_year = "18".concat(century_year); + } else { + century_year = "19".concat(century_year); + } + + if (month < 10) { + month = "0".concat(month); + } + + var date = "".concat(century_year, "/").concat(month, "/").concat(tin.slice(4, 6)); + + if (!(0, _isDate.default)(date, 'YYYY/MM/DD')) { + return false; + } // split digits into an array for further processing + + + var digits = tin.split('').map(function (a) { + return parseInt(a, 10); + }); // Calculate checksum by multiplying digits with fixed values + + var multip_lookup = [2, 4, 8, 5, 10, 9, 7, 3, 6]; + var checksum = 0; + + for (var i = 0; i < multip_lookup.length; i++) { + checksum += digits[i] * multip_lookup[i]; + } + + checksum = checksum % 11 === 10 ? 0 : checksum % 11; + return checksum === digits[9]; +} +/* + * cs-CZ validation function + * (Rodné číslo (RČ), persons only) + * Checks if birth date (first six digits) is valid and divisibility by 11 + * Material not in DG TAXUD document sourced from: + * -`https://lorenc.info/3MA381/overeni-spravnosti-rodneho-cisla.htm` + * -`https://www.mvcr.cz/clanek/rady-a-sluzby-dokumenty-rodne-cislo.aspx` + */ + + +function csCzCheck(tin) { + tin = tin.replace(/\W/, ''); // Extract full year from TIN length + + var full_year = parseInt(tin.slice(0, 2), 10); + + if (tin.length === 10) { + if (full_year < 54) { + full_year = "20".concat(full_year); + } else { + full_year = "19".concat(full_year); + } + } else { + if (tin.slice(6) === '000') { + return false; + } // Three-zero serial not assigned before 1954 + + + if (full_year < 54) { + full_year = "19".concat(full_year); + } else { + return false; // No 18XX years seen in any of the resources + } + } // Add missing zero if needed + + + if (full_year.length === 3) { + full_year = [full_year.slice(0, 2), '0', full_year.slice(2)].join(''); + } // Extract month from TIN and normalize + + + var month = parseInt(tin.slice(2, 4), 10); + + if (month > 50) { + month -= 50; + } + + if (month > 20) { + // Month-plus-twenty was only introduced in 2004 + if (parseInt(full_year, 10) < 2004) { + return false; + } + + month -= 20; + } + + if (month < 10) { + month = "0".concat(month); + } // Check date validity + + + var date = "".concat(full_year, "/").concat(month, "/").concat(tin.slice(4, 6)); + + if (!(0, _isDate.default)(date, 'YYYY/MM/DD')) { + return false; + } // Verify divisibility by 11 + + + if (tin.length === 10) { + if (parseInt(tin, 10) % 11 !== 0) { + // Some numbers up to and including 1985 are still valid if + // check (last) digit equals 0 and modulo of first 9 digits equals 10 + var checkdigit = parseInt(tin.slice(0, 9), 10) % 11; + + if (parseInt(full_year, 10) < 1986 && checkdigit === 10) { + if (parseInt(tin.slice(9), 10) !== 0) { + return false; + } + } else { + return false; + } + } + } + + return true; +} +/* + * de-AT validation function + * (Abgabenkontonummer, persons/entities) + * Verify TIN validity by calling luhnCheck() + */ + + +function deAtCheck(tin) { + return algorithms.luhnCheck(tin); +} +/* + * de-DE validation function + * (Steueridentifikationsnummer (Steuer-IdNr.), persons only) + * Tests for single duplicate/triplicate value, then calculates ISO 7064 check (last) digit + * Partial implementation of spec (same result with both algorithms always) + */ + + +function deDeCheck(tin) { + // Split digits into an array for further processing + var digits = tin.split('').map(function (a) { + return parseInt(a, 10); + }); // Fill array with strings of number positions + + var occurences = []; + + for (var i = 0; i < digits.length - 1; i++) { + occurences.push(''); + + for (var j = 0; j < digits.length - 1; j++) { + if (digits[i] === digits[j]) { + occurences[i] += j; + } + } + } // Remove digits with one occurence and test for only one duplicate/triplicate + + + occurences = occurences.filter(function (a) { + return a.length > 1; + }); + + if (occurences.length !== 2 && occurences.length !== 3) { + return false; + } // In case of triplicate value only two digits are allowed next to each other + + + if (occurences[0].length === 3) { + var trip_locations = occurences[0].split('').map(function (a) { + return parseInt(a, 10); + }); + var recurrent = 0; // Amount of neighbour occurences + + for (var _i = 0; _i < trip_locations.length - 1; _i++) { + if (trip_locations[_i] + 1 === trip_locations[_i + 1]) { + recurrent += 1; + } + } + + if (recurrent === 2) { + return false; + } + } + + return algorithms.iso7064Check(tin); +} +/* + * dk-DK validation function + * (CPR-nummer (personnummer), persons only) + * Checks if birth date (first six digits) is valid and assigned to century (seventh) digit, + * and calculates check (last) digit + */ + + +function dkDkCheck(tin) { + tin = tin.replace(/\W/, ''); // Extract year, check if valid for given century digit and add century + + var year = parseInt(tin.slice(4, 6), 10); + var century_digit = tin.slice(6, 7); + + switch (century_digit) { + case '0': + case '1': + case '2': + case '3': + year = "19".concat(year); + break; + + case '4': + case '9': + if (year < 37) { + year = "20".concat(year); + } else { + year = "19".concat(year); + } + + break; + + default: + if (year < 37) { + year = "20".concat(year); + } else if (year > 58) { + year = "18".concat(year); + } else { + return false; + } + + break; + } // Add missing zero if needed + + + if (year.length === 3) { + year = [year.slice(0, 2), '0', year.slice(2)].join(''); + } // Check date validity + + + var date = "".concat(year, "/").concat(tin.slice(2, 4), "/").concat(tin.slice(0, 2)); + + if (!(0, _isDate.default)(date, 'YYYY/MM/DD')) { + return false; + } // Split digits into an array for further processing + + + var digits = tin.split('').map(function (a) { + return parseInt(a, 10); + }); + var checksum = 0; + var weight = 4; // Multiply by weight and add to checksum + + for (var i = 0; i < 9; i++) { + checksum += digits[i] * weight; + weight -= 1; + + if (weight === 1) { + weight = 7; + } + } + + checksum %= 11; + + if (checksum === 1) { + return false; + } + + return checksum === 0 ? digits[9] === 0 : digits[9] === 11 - checksum; +} +/* + * el-CY validation function + * (Arithmos Forologikou Mitroou (AFM/ΑΦΜ), persons only) + * Verify TIN validity by calculating ASCII value of check (last) character + */ + + +function elCyCheck(tin) { + // split digits into an array for further processing + var digits = tin.slice(0, 8).split('').map(function (a) { + return parseInt(a, 10); + }); + var checksum = 0; // add digits in even places + + for (var i = 1; i < digits.length; i += 2) { + checksum += digits[i]; + } // add digits in odd places + + + for (var _i2 = 0; _i2 < digits.length; _i2 += 2) { + if (digits[_i2] < 2) { + checksum += 1 - digits[_i2]; + } else { + checksum += 2 * (digits[_i2] - 2) + 5; + + if (digits[_i2] > 4) { + checksum += 2; + } + } + } + + return String.fromCharCode(checksum % 26 + 65) === tin.charAt(8); +} +/* + * el-GR validation function + * (Arithmos Forologikou Mitroou (AFM/ΑΦΜ), persons/entities) + * Verify TIN validity by calculating check (last) digit + * Algorithm not in DG TAXUD document- sourced from: + * - `http://epixeirisi.gr/%CE%9A%CE%A1%CE%99%CE%A3%CE%99%CE%9C%CE%91-%CE%98%CE%95%CE%9C%CE%91%CE%A4%CE%91-%CE%A6%CE%9F%CE%A1%CE%9F%CE%9B%CE%9F%CE%93%CE%99%CE%91%CE%A3-%CE%9A%CE%91%CE%99-%CE%9B%CE%9F%CE%93%CE%99%CE%A3%CE%A4%CE%99%CE%9A%CE%97%CE%A3/23791/%CE%91%CF%81%CE%B9%CE%B8%CE%BC%CF%8C%CF%82-%CE%A6%CE%BF%CF%81%CE%BF%CE%BB%CE%BF%CE%B3%CE%B9%CE%BA%CE%BF%CF%8D-%CE%9C%CE%B7%CF%84%CF%81%CF%8E%CE%BF%CF%85` + */ + + +function elGrCheck(tin) { + // split digits into an array for further processing + var digits = tin.split('').map(function (a) { + return parseInt(a, 10); + }); + var checksum = 0; + + for (var i = 0; i < 8; i++) { + checksum += digits[i] * Math.pow(2, 8 - i); + } + + return checksum % 11 === digits[8]; +} +/* + * en-GB validation function (should go here if needed) + * (National Insurance Number (NINO) or Unique Taxpayer Reference (UTR), + * persons/entities respectively) + */ + +/* + * en-IE validation function + * (Personal Public Service Number (PPS No), persons only) + * Verify TIN validity by calculating check (second to last) character + */ + + +function enIeCheck(tin) { + var checksum = algorithms.reverseMultiplyAndSum(tin.split('').slice(0, 7).map(function (a) { + return parseInt(a, 10); + }), 8); + + if (tin.length === 9 && tin[8] !== 'W') { + checksum += (tin[8].charCodeAt(0) - 64) * 9; + } + + checksum %= 23; + + if (checksum === 0) { + return tin[7].toUpperCase() === 'W'; + } + + return tin[7].toUpperCase() === String.fromCharCode(64 + checksum); +} // Valid US IRS campus prefixes + + +var enUsCampusPrefix = { + andover: ['10', '12'], + atlanta: ['60', '67'], + austin: ['50', '53'], + brookhaven: ['01', '02', '03', '04', '05', '06', '11', '13', '14', '16', '21', '22', '23', '25', '34', '51', '52', '54', '55', '56', '57', '58', '59', '65'], + cincinnati: ['30', '32', '35', '36', '37', '38', '61'], + fresno: ['15', '24'], + internet: ['20', '26', '27', '45', '46', '47'], + kansas: ['40', '44'], + memphis: ['94', '95'], + ogden: ['80', '90'], + philadelphia: ['33', '39', '41', '42', '43', '46', '48', '62', '63', '64', '66', '68', '71', '72', '73', '74', '75', '76', '77', '81', '82', '83', '84', '85', '86', '87', '88', '91', '92', '93', '98', '99'], + sba: ['31'] +}; // Return an array of all US IRS campus prefixes + +function enUsGetPrefixes() { + var prefixes = []; + + for (var location in enUsCampusPrefix) { + // https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md#ignoring-code-for-coverage-purposes + // istanbul ignore else + if (enUsCampusPrefix.hasOwnProperty(location)) { + prefixes.push.apply(prefixes, _toConsumableArray(enUsCampusPrefix[location])); + } + } + + return prefixes; +} +/* + * en-US validation function + * Verify that the TIN starts with a valid IRS campus prefix + */ + + +function enUsCheck(tin) { + return enUsGetPrefixes().indexOf(tin.substr(0, 2)) !== -1; +} +/* + * es-ES validation function + * (Documento Nacional de Identidad (DNI) + * or Número de Identificación de Extranjero (NIE), persons only) + * Verify TIN validity by calculating check (last) character + */ + + +function esEsCheck(tin) { + // Split characters into an array for further processing + var chars = tin.toUpperCase().split(''); // Replace initial letter if needed + + if (isNaN(parseInt(chars[0], 10)) && chars.length > 1) { + var lead_replace = 0; + + switch (chars[0]) { + case 'Y': + lead_replace = 1; + break; + + case 'Z': + lead_replace = 2; + break; + + default: + } + + chars.splice(0, 1, lead_replace); // Fill with zeros if smaller than proper + } else { + while (chars.length < 9) { + chars.unshift(0); + } + } // Calculate checksum and check according to lookup + + + var lookup = ['T', 'R', 'W', 'A', 'G', 'M', 'Y', 'F', 'P', 'D', 'X', 'B', 'N', 'J', 'Z', 'S', 'Q', 'V', 'H', 'L', 'C', 'K', 'E']; + chars = chars.join(''); + var checksum = parseInt(chars.slice(0, 8), 10) % 23; + return chars[8] === lookup[checksum]; +} +/* + * et-EE validation function + * (Isikukood (IK), persons only) + * Checks if birth date (century digit and six following) is valid and calculates check (last) digit + * Material not in DG TAXUD document sourced from: + * - `https://www.oecd.org/tax/automatic-exchange/crs-implementation-and-assistance/tax-identification-numbers/Estonia-TIN.pdf` + */ + + +function etEeCheck(tin) { + // Extract year and add century + var full_year = tin.slice(1, 3); + var century_digit = tin.slice(0, 1); + + switch (century_digit) { + case '1': + case '2': + full_year = "18".concat(full_year); + break; + + case '3': + case '4': + full_year = "19".concat(full_year); + break; + + default: + full_year = "20".concat(full_year); + break; + } // Check date validity + + + var date = "".concat(full_year, "/").concat(tin.slice(3, 5), "/").concat(tin.slice(5, 7)); + + if (!(0, _isDate.default)(date, 'YYYY/MM/DD')) { + return false; + } // Split digits into an array for further processing + + + var digits = tin.split('').map(function (a) { + return parseInt(a, 10); + }); + var checksum = 0; + var weight = 1; // Multiply by weight and add to checksum + + for (var i = 0; i < 10; i++) { + checksum += digits[i] * weight; + weight += 1; + + if (weight === 10) { + weight = 1; + } + } // Do again if modulo 11 of checksum is 10 + + + if (checksum % 11 === 10) { + checksum = 0; + weight = 3; + + for (var _i3 = 0; _i3 < 10; _i3++) { + checksum += digits[_i3] * weight; + weight += 1; + + if (weight === 10) { + weight = 1; + } + } + + if (checksum % 11 === 10) { + return digits[10] === 0; + } + } + + return checksum % 11 === digits[10]; +} +/* + * fi-FI validation function + * (Henkilötunnus (HETU), persons only) + * Checks if birth date (first six digits plus century symbol) is valid + * and calculates check (last) digit + */ + + +function fiFiCheck(tin) { + // Extract year and add century + var full_year = tin.slice(4, 6); + var century_symbol = tin.slice(6, 7); + + switch (century_symbol) { + case '+': + full_year = "18".concat(full_year); + break; + + case '-': + full_year = "19".concat(full_year); + break; + + default: + full_year = "20".concat(full_year); + break; + } // Check date validity + + + var date = "".concat(full_year, "/").concat(tin.slice(2, 4), "/").concat(tin.slice(0, 2)); + + if (!(0, _isDate.default)(date, 'YYYY/MM/DD')) { + return false; + } // Calculate check character + + + var checksum = parseInt(tin.slice(0, 6) + tin.slice(7, 10), 10) % 31; + + if (checksum < 10) { + return checksum === parseInt(tin.slice(10), 10); + } + + checksum -= 10; + var letters_lookup = ['A', 'B', 'C', 'D', 'E', 'F', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y']; + return letters_lookup[checksum] === tin.slice(10); +} +/* + * fr/nl-BE validation function + * (Numéro national (N.N.), persons only) + * Checks if birth date (first six digits) is valid and calculates check (last two) digits + */ + + +function frBeCheck(tin) { + // Zero month/day value is acceptable + if (tin.slice(2, 4) !== '00' || tin.slice(4, 6) !== '00') { + // Extract date from first six digits of TIN + var date = "".concat(tin.slice(0, 2), "/").concat(tin.slice(2, 4), "/").concat(tin.slice(4, 6)); + + if (!(0, _isDate.default)(date, 'YY/MM/DD')) { + return false; + } + } + + var checksum = 97 - parseInt(tin.slice(0, 9), 10) % 97; + var checkdigits = parseInt(tin.slice(9, 11), 10); + + if (checksum !== checkdigits) { + checksum = 97 - parseInt("2".concat(tin.slice(0, 9)), 10) % 97; + + if (checksum !== checkdigits) { + return false; + } + } + + return true; +} +/* + * fr-FR validation function + * (Numéro fiscal de référence (numéro SPI), persons only) + * Verify TIN validity by calculating check (last three) digits + */ + + +function frFrCheck(tin) { + tin = tin.replace(/\s/g, ''); + var checksum = parseInt(tin.slice(0, 10), 10) % 511; + var checkdigits = parseInt(tin.slice(10, 13), 10); + return checksum === checkdigits; +} +/* + * fr/lb-LU validation function + * (numéro d’identification personnelle, persons only) + * Verify birth date validity and run Luhn and Verhoeff checks + */ + + +function frLuCheck(tin) { + // Extract date and check validity + var date = "".concat(tin.slice(0, 4), "/").concat(tin.slice(4, 6), "/").concat(tin.slice(6, 8)); + + if (!(0, _isDate.default)(date, 'YYYY/MM/DD')) { + return false; + } // Run Luhn check + + + if (!algorithms.luhnCheck(tin.slice(0, 12))) { + return false; + } // Remove Luhn check digit and run Verhoeff check + + + return algorithms.verhoeffCheck("".concat(tin.slice(0, 11)).concat(tin[12])); +} +/* + * hr-HR validation function + * (Osobni identifikacijski broj (OIB), persons/entities) + * Verify TIN validity by calling iso7064Check(digits) + */ + + +function hrHrCheck(tin) { + return algorithms.iso7064Check(tin); +} +/* + * hu-HU validation function + * (Adóazonosító jel, persons only) + * Verify TIN validity by calculating check (last) digit + */ + + +function huHuCheck(tin) { + // split digits into an array for further processing + var digits = tin.split('').map(function (a) { + return parseInt(a, 10); + }); + var checksum = 8; + + for (var i = 1; i < 9; i++) { + checksum += digits[i] * (i + 1); + } + + return checksum % 11 === digits[9]; +} +/* + * lt-LT validation function (should go here if needed) + * (Asmens kodas, persons/entities respectively) + * Current validation check is alias of etEeCheck- same format applies + */ + +/* + * it-IT first/last name validity check + * Accepts it-IT TIN-encoded names as a three-element character array and checks their validity + * Due to lack of clarity between resources ("Are only Italian consonants used? + * What happens if a person has X in their name?" etc.) only two test conditions + * have been implemented: + * Vowels may only be followed by other vowels or an X character + * and X characters after vowels may only be followed by other X characters. + */ + + +function itItNameCheck(name) { + // true at the first occurence of a vowel + var vowelflag = false; // true at the first occurence of an X AFTER vowel + // (to properly handle last names with X as consonant) + + var xflag = false; + + for (var i = 0; i < 3; i++) { + if (!vowelflag && /[AEIOU]/.test(name[i])) { + vowelflag = true; + } else if (!xflag && vowelflag && name[i] === 'X') { + xflag = true; + } else if (i > 0) { + if (vowelflag && !xflag) { + if (!/[AEIOU]/.test(name[i])) { + return false; + } + } + + if (xflag) { + if (!/X/.test(name[i])) { + return false; + } + } + } + } + + return true; +} +/* + * it-IT validation function + * (Codice fiscale (TIN-IT), persons only) + * Verify name, birth date and codice catastale validity + * and calculate check character. + * Material not in DG-TAXUD document sourced from: + * `https://en.wikipedia.org/wiki/Italian_fiscal_code` + */ + + +function itItCheck(tin) { + // Capitalize and split characters into an array for further processing + var chars = tin.toUpperCase().split(''); // Check first and last name validity calling itItNameCheck() + + if (!itItNameCheck(chars.slice(0, 3))) { + return false; + } + + if (!itItNameCheck(chars.slice(3, 6))) { + return false; + } // Convert letters in number spaces back to numbers if any + + + var number_locations = [6, 7, 9, 10, 12, 13, 14]; + var number_replace = { + L: '0', + M: '1', + N: '2', + P: '3', + Q: '4', + R: '5', + S: '6', + T: '7', + U: '8', + V: '9' + }; + + for (var _i4 = 0, _number_locations = number_locations; _i4 < _number_locations.length; _i4++) { + var i = _number_locations[_i4]; + + if (chars[i] in number_replace) { + chars.splice(i, 1, number_replace[chars[i]]); + } + } // Extract month and day, and check date validity + + + var month_replace = { + A: '01', + B: '02', + C: '03', + D: '04', + E: '05', + H: '06', + L: '07', + M: '08', + P: '09', + R: '10', + S: '11', + T: '12' + }; + var month = month_replace[chars[8]]; + var day = parseInt(chars[9] + chars[10], 10); + + if (day > 40) { + day -= 40; + } + + if (day < 10) { + day = "0".concat(day); + } + + var date = "".concat(chars[6]).concat(chars[7], "/").concat(month, "/").concat(day); + + if (!(0, _isDate.default)(date, 'YY/MM/DD')) { + return false; + } // Calculate check character by adding up even and odd characters as numbers + + + var checksum = 0; + + for (var _i5 = 1; _i5 < chars.length - 1; _i5 += 2) { + var char_to_int = parseInt(chars[_i5], 10); + + if (isNaN(char_to_int)) { + char_to_int = chars[_i5].charCodeAt(0) - 65; + } + + checksum += char_to_int; + } + + var odd_convert = { + // Maps of characters at odd places + A: 1, + B: 0, + C: 5, + D: 7, + E: 9, + F: 13, + G: 15, + H: 17, + I: 19, + J: 21, + K: 2, + L: 4, + M: 18, + N: 20, + O: 11, + P: 3, + Q: 6, + R: 8, + S: 12, + T: 14, + U: 16, + V: 10, + W: 22, + X: 25, + Y: 24, + Z: 23, + 0: 1, + 1: 0 + }; + + for (var _i6 = 0; _i6 < chars.length - 1; _i6 += 2) { + var _char_to_int = 0; + + if (chars[_i6] in odd_convert) { + _char_to_int = odd_convert[chars[_i6]]; + } else { + var multiplier = parseInt(chars[_i6], 10); + _char_to_int = 2 * multiplier + 1; + + if (multiplier > 4) { + _char_to_int += 2; + } + } + + checksum += _char_to_int; + } + + if (String.fromCharCode(65 + checksum % 26) !== chars[15]) { + return false; + } + + return true; +} +/* + * lv-LV validation function + * (Personas kods (PK), persons only) + * Check validity of birth date and calculate check (last) digit + * Support only for old format numbers (not starting with '32', issued before 2017/07/01) + * Material not in DG TAXUD document sourced from: + * `https://boot.ritakafija.lv/forums/index.php?/topic/88314-personas-koda-algoritms-%C4%8Deksumma/` + */ + + +function lvLvCheck(tin) { + tin = tin.replace(/\W/, ''); // Extract date from TIN + + var day = tin.slice(0, 2); + + if (day !== '32') { + // No date/checksum check if new format + var month = tin.slice(2, 4); + + if (month !== '00') { + // No date check if unknown month + var full_year = tin.slice(4, 6); + + switch (tin[6]) { + case '0': + full_year = "18".concat(full_year); + break; + + case '1': + full_year = "19".concat(full_year); + break; + + default: + full_year = "20".concat(full_year); + break; + } // Check date validity + + + var date = "".concat(full_year, "/").concat(tin.slice(2, 4), "/").concat(day); + + if (!(0, _isDate.default)(date, 'YYYY/MM/DD')) { + return false; + } + } // Calculate check digit + + + var checksum = 1101; + var multip_lookup = [1, 6, 3, 7, 9, 10, 5, 8, 4, 2]; + + for (var i = 0; i < tin.length - 1; i++) { + checksum -= parseInt(tin[i], 10) * multip_lookup[i]; + } + + return parseInt(tin[10], 10) === checksum % 11; + } + + return true; +} +/* + * mt-MT validation function + * (Identity Card Number or Unique Taxpayer Reference, persons/entities) + * Verify Identity Card Number structure (no other tests found) + */ + + +function mtMtCheck(tin) { + if (tin.length !== 9) { + // No tests for UTR + var chars = tin.toUpperCase().split(''); // Fill with zeros if smaller than proper + + while (chars.length < 8) { + chars.unshift(0); + } // Validate format according to last character + + + switch (tin[7]) { + case 'A': + case 'P': + if (parseInt(chars[6], 10) === 0) { + return false; + } + + break; + + default: + { + var first_part = parseInt(chars.join('').slice(0, 5), 10); + + if (first_part > 32000) { + return false; + } + + var second_part = parseInt(chars.join('').slice(5, 7), 10); + + if (first_part === second_part) { + return false; + } + } + } + } + + return true; +} +/* + * nl-NL validation function + * (Burgerservicenummer (BSN) or Rechtspersonen Samenwerkingsverbanden Informatie Nummer (RSIN), + * persons/entities respectively) + * Verify TIN validity by calculating check (last) digit (variant of MOD 11) + */ + + +function nlNlCheck(tin) { + return algorithms.reverseMultiplyAndSum(tin.split('').slice(0, 8).map(function (a) { + return parseInt(a, 10); + }), 9) % 11 === parseInt(tin[8], 10); +} +/* + * pl-PL validation function + * (Powszechny Elektroniczny System Ewidencji Ludności (PESEL) + * or Numer identyfikacji podatkowej (NIP), persons/entities) + * Verify TIN validity by validating birth date (PESEL) and calculating check (last) digit + */ + + +function plPlCheck(tin) { + // NIP + if (tin.length === 10) { + // Calculate last digit by multiplying with lookup + var lookup = [6, 5, 7, 2, 3, 4, 5, 6, 7]; + var _checksum = 0; + + for (var i = 0; i < lookup.length; i++) { + _checksum += parseInt(tin[i], 10) * lookup[i]; + } + + _checksum %= 11; + + if (_checksum === 10) { + return false; + } + + return _checksum === parseInt(tin[9], 10); + } // PESEL + // Extract full year using month + + + var full_year = tin.slice(0, 2); + var month = parseInt(tin.slice(2, 4), 10); + + if (month > 80) { + full_year = "18".concat(full_year); + month -= 80; + } else if (month > 60) { + full_year = "22".concat(full_year); + month -= 60; + } else if (month > 40) { + full_year = "21".concat(full_year); + month -= 40; + } else if (month > 20) { + full_year = "20".concat(full_year); + month -= 20; + } else { + full_year = "19".concat(full_year); + } // Add leading zero to month if needed + + + if (month < 10) { + month = "0".concat(month); + } // Check date validity + + + var date = "".concat(full_year, "/").concat(month, "/").concat(tin.slice(4, 6)); + + if (!(0, _isDate.default)(date, 'YYYY/MM/DD')) { + return false; + } // Calculate last digit by mulitplying with odd one-digit numbers except 5 + + + var checksum = 0; + var multiplier = 1; + + for (var _i7 = 0; _i7 < tin.length - 1; _i7++) { + checksum += parseInt(tin[_i7], 10) * multiplier % 10; + multiplier += 2; + + if (multiplier > 10) { + multiplier = 1; + } else if (multiplier === 5) { + multiplier += 2; + } + } + + checksum = 10 - checksum % 10; + return checksum === parseInt(tin[10], 10); +} +/* + * pt-PT validation function + * (Número de identificação fiscal (NIF), persons/entities) + * Verify TIN validity by calculating check (last) digit (variant of MOD 11) + */ + + +function ptPtCheck(tin) { + var checksum = 11 - algorithms.reverseMultiplyAndSum(tin.split('').slice(0, 8).map(function (a) { + return parseInt(a, 10); + }), 9) % 11; + + if (checksum > 9) { + return parseInt(tin[8], 10) === 0; + } + + return checksum === parseInt(tin[8], 10); +} +/* + * ro-RO validation function + * (Cod Numeric Personal (CNP) or Cod de înregistrare fiscală (CIF), + * persons only) + * Verify CNP validity by calculating check (last) digit (test not found for CIF) + * Material not in DG TAXUD document sourced from: + * `https://en.wikipedia.org/wiki/National_identification_number#Romania` + */ + + +function roRoCheck(tin) { + if (tin.slice(0, 4) !== '9000') { + // No test found for this format + // Extract full year using century digit if possible + var full_year = tin.slice(1, 3); + + switch (tin[0]) { + case '1': + case '2': + full_year = "19".concat(full_year); + break; + + case '3': + case '4': + full_year = "18".concat(full_year); + break; + + case '5': + case '6': + full_year = "20".concat(full_year); + break; + + default: + } // Check date validity + + + var date = "".concat(full_year, "/").concat(tin.slice(3, 5), "/").concat(tin.slice(5, 7)); + + if (date.length === 8) { + if (!(0, _isDate.default)(date, 'YY/MM/DD')) { + return false; + } + } else if (!(0, _isDate.default)(date, 'YYYY/MM/DD')) { + return false; + } // Calculate check digit + + + var digits = tin.split('').map(function (a) { + return parseInt(a, 10); + }); + var multipliers = [2, 7, 9, 1, 4, 6, 3, 5, 8, 2, 7, 9]; + var checksum = 0; + + for (var i = 0; i < multipliers.length; i++) { + checksum += digits[i] * multipliers[i]; + } + + if (checksum % 11 === 10) { + return digits[12] === 1; + } + + return digits[12] === checksum % 11; + } + + return true; +} +/* + * sk-SK validation function + * (Rodné číslo (RČ) or bezvýznamové identifikačné číslo (BIČ), persons only) + * Checks validity of pre-1954 birth numbers (rodné číslo) only + * Due to the introduction of the pseudo-random BIČ it is not possible to test + * post-1954 birth numbers without knowing whether they are BIČ or RČ beforehand + */ + + +function skSkCheck(tin) { + if (tin.length === 9) { + tin = tin.replace(/\W/, ''); + + if (tin.slice(6) === '000') { + return false; + } // Three-zero serial not assigned before 1954 + // Extract full year from TIN length + + + var full_year = parseInt(tin.slice(0, 2), 10); + + if (full_year > 53) { + return false; + } + + if (full_year < 10) { + full_year = "190".concat(full_year); + } else { + full_year = "19".concat(full_year); + } // Extract month from TIN and normalize + + + var month = parseInt(tin.slice(2, 4), 10); + + if (month > 50) { + month -= 50; + } + + if (month < 10) { + month = "0".concat(month); + } // Check date validity + + + var date = "".concat(full_year, "/").concat(month, "/").concat(tin.slice(4, 6)); + + if (!(0, _isDate.default)(date, 'YYYY/MM/DD')) { + return false; + } + } + + return true; +} +/* + * sl-SI validation function + * (Davčna številka, persons/entities) + * Verify TIN validity by calculating check (last) digit (variant of MOD 11) + */ + + +function slSiCheck(tin) { + var checksum = 11 - algorithms.reverseMultiplyAndSum(tin.split('').slice(0, 7).map(function (a) { + return parseInt(a, 10); + }), 8) % 11; + + if (checksum === 10) { + return parseInt(tin[7], 10) === 0; + } + + return checksum === parseInt(tin[7], 10); +} +/* + * sv-SE validation function + * (Personnummer or samordningsnummer, persons only) + * Checks validity of birth date and calls luhnCheck() to validate check (last) digit + */ + + +function svSeCheck(tin) { + // Make copy of TIN and normalize to two-digit year form + var tin_copy = tin.slice(0); + + if (tin.length > 11) { + tin_copy = tin_copy.slice(2); + } // Extract date of birth + + + var full_year = ''; + var month = tin_copy.slice(2, 4); + var day = parseInt(tin_copy.slice(4, 6), 10); + + if (tin.length > 11) { + full_year = tin.slice(0, 4); + } else { + full_year = tin.slice(0, 2); + + if (tin.length === 11 && day < 60) { + // Extract full year from centenarian symbol + // Should work just fine until year 10000 or so + var current_year = new Date().getFullYear().toString(); + var current_century = parseInt(current_year.slice(0, 2), 10); + current_year = parseInt(current_year, 10); + + if (tin[6] === '-') { + if (parseInt("".concat(current_century).concat(full_year), 10) > current_year) { + full_year = "".concat(current_century - 1).concat(full_year); + } else { + full_year = "".concat(current_century).concat(full_year); + } + } else { + full_year = "".concat(current_century - 1).concat(full_year); + + if (current_year - parseInt(full_year, 10) < 100) { + return false; + } + } + } + } // Normalize day and check date validity + + + if (day > 60) { + day -= 60; + } + + if (day < 10) { + day = "0".concat(day); + } + + var date = "".concat(full_year, "/").concat(month, "/").concat(day); + + if (date.length === 8) { + if (!(0, _isDate.default)(date, 'YY/MM/DD')) { + return false; + } + } else if (!(0, _isDate.default)(date, 'YYYY/MM/DD')) { + return false; + } + + return algorithms.luhnCheck(tin.replace(/\W/, '')); +} // Locale lookup objects + +/* + * Tax id regex formats for various locales + * + * Where not explicitly specified in DG-TAXUD document both + * uppercase and lowercase letters are acceptable. + */ + + +var taxIdFormat = { + 'bg-BG': /^\d{10}$/, + 'cs-CZ': /^\d{6}\/{0,1}\d{3,4}$/, + 'de-AT': /^\d{9}$/, + 'de-DE': /^[1-9]\d{10}$/, + 'dk-DK': /^\d{6}-{0,1}\d{4}$/, + 'el-CY': /^[09]\d{7}[A-Z]$/, + 'el-GR': /^([0-4]|[7-9])\d{8}$/, + 'en-GB': /^\d{10}$|^(?!GB|NK|TN|ZZ)(?![DFIQUV])[A-Z](?![DFIQUVO])[A-Z]\d{6}[ABCD ]$/i, + 'en-IE': /^\d{7}[A-W][A-IW]{0,1}$/i, + 'en-US': /^\d{2}[- ]{0,1}\d{7}$/, + 'es-ES': /^(\d{0,8}|[XYZKLM]\d{7})[A-HJ-NP-TV-Z]$/i, + 'et-EE': /^[1-6]\d{6}(00[1-9]|0[1-9][0-9]|[1-6][0-9]{2}|70[0-9]|710)\d$/, + 'fi-FI': /^\d{6}[-+A]\d{3}[0-9A-FHJ-NPR-Y]$/i, + 'fr-BE': /^\d{11}$/, + 'fr-FR': /^[0-3]\d{12}$|^[0-3]\d\s\d{2}(\s\d{3}){3}$/, + // Conforms both to official spec and provided example + 'fr-LU': /^\d{13}$/, + 'hr-HR': /^\d{11}$/, + 'hu-HU': /^8\d{9}$/, + 'it-IT': /^[A-Z]{6}[L-NP-V0-9]{2}[A-EHLMPRST][L-NP-V0-9]{2}[A-ILMZ][L-NP-V0-9]{3}[A-Z]$/i, + 'lv-LV': /^\d{6}-{0,1}\d{5}$/, + // Conforms both to DG TAXUD spec and original research + 'mt-MT': /^\d{3,7}[APMGLHBZ]$|^([1-8])\1\d{7}$/i, + 'nl-NL': /^\d{9}$/, + 'pl-PL': /^\d{10,11}$/, + 'pt-PT': /^\d{9}$/, + 'ro-RO': /^\d{13}$/, + 'sk-SK': /^\d{6}\/{0,1}\d{3,4}$/, + 'sl-SI': /^[1-9]\d{7}$/, + 'sv-SE': /^(\d{6}[-+]{0,1}\d{4}|(18|19|20)\d{6}[-+]{0,1}\d{4})$/ +}; // taxIdFormat locale aliases + +taxIdFormat['lb-LU'] = taxIdFormat['fr-LU']; +taxIdFormat['lt-LT'] = taxIdFormat['et-EE']; +taxIdFormat['nl-BE'] = taxIdFormat['fr-BE']; // Algorithmic tax id check functions for various locales + +var taxIdCheck = { + 'bg-BG': bgBgCheck, + 'cs-CZ': csCzCheck, + 'de-AT': deAtCheck, + 'de-DE': deDeCheck, + 'dk-DK': dkDkCheck, + 'el-CY': elCyCheck, + 'el-GR': elGrCheck, + 'en-IE': enIeCheck, + 'en-US': enUsCheck, + 'es-ES': esEsCheck, + 'et-EE': etEeCheck, + 'fi-FI': fiFiCheck, + 'fr-BE': frBeCheck, + 'fr-FR': frFrCheck, + 'fr-LU': frLuCheck, + 'hr-HR': hrHrCheck, + 'hu-HU': huHuCheck, + 'it-IT': itItCheck, + 'lv-LV': lvLvCheck, + 'mt-MT': mtMtCheck, + 'nl-NL': nlNlCheck, + 'pl-PL': plPlCheck, + 'pt-PT': ptPtCheck, + 'ro-RO': roRoCheck, + 'sk-SK': skSkCheck, + 'sl-SI': slSiCheck, + 'sv-SE': svSeCheck +}; // taxIdCheck locale aliases + +taxIdCheck['lb-LU'] = taxIdCheck['fr-LU']; +taxIdCheck['lt-LT'] = taxIdCheck['et-EE']; +taxIdCheck['nl-BE'] = taxIdCheck['fr-BE']; // Regexes for locales where characters should be omitted before checking format + +var allsymbols = /[-\\\/!@#$%\^&\*\(\)\+\=\[\]]+/g; +var sanitizeRegexes = { + 'de-AT': allsymbols, + 'de-DE': /[\/\\]/g, + 'fr-BE': allsymbols +}; // sanitizeRegexes locale aliases + +sanitizeRegexes['nl-BE'] = sanitizeRegexes['fr-BE']; +/* + * Validator function + * Return true if the passed string is a valid tax identification number + * for the specified locale. + * Throw an error exception if the locale is not supported. + */ + +function isTaxID(str) { + var locale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'en-US'; + (0, _assertString.default)(str); // Copy TIN to avoid replacement if sanitized + + var strcopy = str.slice(0); + + if (locale in taxIdFormat) { + if (locale in sanitizeRegexes) { + strcopy = strcopy.replace(sanitizeRegexes[locale], ''); + } + + if (!taxIdFormat[locale].test(strcopy)) { + return false; + } + + if (locale in taxIdCheck) { + return taxIdCheck[locale](strcopy); + } // Fallthrough; not all locales have algorithmic checks + + + return true; + } + + throw new Error("Invalid locale '".concat(locale, "'")); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./isDate":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isDate.js","./util/algorithms":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/algorithms.js","./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isURL.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isURL; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +var _isFQDN = _interopRequireDefault(require("./isFQDN")); + +var _isIP = _interopRequireDefault(require("./isIP")); + +var _merge = _interopRequireDefault(require("./util/merge")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/* +options for isURL method + +require_protocol - if set as true isURL will return false if protocol is not present in the URL +require_valid_protocol - isURL will check if the URL's protocol is present in the protocols option +protocols - valid protocols can be modified with this option +require_host - if set as false isURL will not check if host is present in the URL +require_port - if set as true isURL will check if port is present in the URL +allow_protocol_relative_urls - if set as true protocol relative URLs will be allowed +validate_length - if set as false isURL will skip string length validation (IE maximum is 2083) + +*/ +var default_url_options = { + protocols: ['http', 'https', 'ftp'], + require_tld: true, + require_protocol: false, + require_host: true, + require_port: false, + require_valid_protocol: true, + allow_underscores: false, + allow_trailing_dot: false, + allow_protocol_relative_urls: false, + validate_length: true +}; +var wrapped_ipv6 = /^\[([^\]]+)\](?::([0-9]+))?$/; + +function isRegExp(obj) { + return Object.prototype.toString.call(obj) === '[object RegExp]'; +} + +function checkHost(host, matches) { + for (var i = 0; i < matches.length; i++) { + var match = matches[i]; + + if (host === match || isRegExp(match) && match.test(host)) { + return true; + } + } + + return false; +} + +function isURL(url, options) { + (0, _assertString.default)(url); + + if (!url || /[\s<>]/.test(url)) { + return false; + } + + if (url.indexOf('mailto:') === 0) { + return false; + } + + options = (0, _merge.default)(options, default_url_options); + + if (options.validate_length && url.length >= 2083) { + return false; + } + + var protocol, auth, host, hostname, port, port_str, split, ipv6; + split = url.split('#'); + url = split.shift(); + split = url.split('?'); + url = split.shift(); + split = url.split('://'); + + if (split.length > 1) { + protocol = split.shift().toLowerCase(); + + if (options.require_valid_protocol && options.protocols.indexOf(protocol) === -1) { + return false; + } + } else if (options.require_protocol) { + return false; + } else if (url.substr(0, 2) === '//') { + if (!options.allow_protocol_relative_urls) { + return false; + } + + split[0] = url.substr(2); + } + + url = split.join('://'); + + if (url === '') { + return false; + } + + split = url.split('/'); + url = split.shift(); + + if (url === '' && !options.require_host) { + return true; + } + + split = url.split('@'); + + if (split.length > 1) { + if (options.disallow_auth) { + return false; + } + + auth = split.shift(); + + if (auth.indexOf(':') === -1 || auth.indexOf(':') >= 0 && auth.split(':').length > 2) { + return false; + } + } + + hostname = split.join('@'); + port_str = null; + ipv6 = null; + var ipv6_match = hostname.match(wrapped_ipv6); + + if (ipv6_match) { + host = ''; + ipv6 = ipv6_match[1]; + port_str = ipv6_match[2] || null; + } else { + split = hostname.split(':'); + host = split.shift(); + + if (split.length) { + port_str = split.join(':'); + } + } + + if (port_str !== null) { + port = parseInt(port_str, 10); + + if (!/^[0-9]+$/.test(port_str) || port <= 0 || port > 65535) { + return false; + } + } else if (options.require_port) { + return false; + } + + if (!(0, _isIP.default)(host) && !(0, _isFQDN.default)(host, options) && (!ipv6 || !(0, _isIP.default)(ipv6, 6))) { + return false; + } + + host = host || ipv6; + + if (options.host_whitelist && !checkHost(host, options.host_whitelist)) { + return false; + } + + if (options.host_blacklist && checkHost(host, options.host_blacklist)) { + return false; + } + + return true; +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./isFQDN":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isFQDN.js","./isIP":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isIP.js","./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js","./util/merge":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/merge.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isUUID.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isUUID; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var uuid = { + 3: /^[0-9A-F]{8}-[0-9A-F]{4}-3[0-9A-F]{3}-[0-9A-F]{4}-[0-9A-F]{12}$/i, + 4: /^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i, + 5: /^[0-9A-F]{8}-[0-9A-F]{4}-5[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i, + all: /^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i +}; + +function isUUID(str) { + var version = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'all'; + (0, _assertString.default)(str); + var pattern = uuid[version]; + return pattern && pattern.test(str); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isUppercase.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isUppercase; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function isUppercase(str) { + (0, _assertString.default)(str); + return str === str.toUpperCase(); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isVAT.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isVAT; +exports.vatMatchers = void 0; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var vatMatchers = { + GB: /^GB((\d{3} \d{4} ([0-8][0-9]|9[0-6]))|(\d{9} \d{3})|(((GD[0-4])|(HA[5-9]))[0-9]{2}))$/ +}; +exports.vatMatchers = vatMatchers; + +function isVAT(str, countryCode) { + (0, _assertString.default)(str); + (0, _assertString.default)(countryCode); + + if (countryCode in vatMatchers) { + return vatMatchers[countryCode].test(str); + } + + throw new Error("Invalid country code: '".concat(countryCode, "'")); +} +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isVariableWidth.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isVariableWidth; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +var _isFullWidth = require("./isFullWidth"); + +var _isHalfWidth = require("./isHalfWidth"); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function isVariableWidth(str) { + (0, _assertString.default)(str); + return _isFullWidth.fullWidth.test(str) && _isHalfWidth.halfWidth.test(str); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./isFullWidth":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isFullWidth.js","./isHalfWidth":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isHalfWidth.js","./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isWhitelisted.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = isWhitelisted; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function isWhitelisted(str, chars) { + (0, _assertString.default)(str); + + for (var i = str.length - 1; i >= 0; i--) { + if (chars.indexOf(str[i]) === -1) { + return false; + } + } + + return true; +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/ltrim.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = ltrim; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function ltrim(str, chars) { + (0, _assertString.default)(str); // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#Escaping + + var pattern = chars ? new RegExp("^[".concat(chars.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), "]+"), 'g') : /^\s+/g; + return str.replace(pattern, ''); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/matches.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = matches; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function matches(str, pattern, modifiers) { + (0, _assertString.default)(str); + + if (Object.prototype.toString.call(pattern) !== '[object RegExp]') { + pattern = new RegExp(pattern, modifiers); + } + + return pattern.test(str); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/normalizeEmail.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = normalizeEmail; + +var _merge = _interopRequireDefault(require("./util/merge")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var default_normalize_email_options = { + // The following options apply to all email addresses + // Lowercases the local part of the email address. + // Please note this may violate RFC 5321 as per http://stackoverflow.com/a/9808332/192024). + // The domain is always lowercased, as per RFC 1035 + all_lowercase: true, + // The following conversions are specific to GMail + // Lowercases the local part of the GMail address (known to be case-insensitive) + gmail_lowercase: true, + // Removes dots from the local part of the email address, as that's ignored by GMail + gmail_remove_dots: true, + // Removes the subaddress (e.g. "+foo") from the email address + gmail_remove_subaddress: true, + // Conversts the googlemail.com domain to gmail.com + gmail_convert_googlemaildotcom: true, + // The following conversions are specific to Outlook.com / Windows Live / Hotmail + // Lowercases the local part of the Outlook.com address (known to be case-insensitive) + outlookdotcom_lowercase: true, + // Removes the subaddress (e.g. "+foo") from the email address + outlookdotcom_remove_subaddress: true, + // The following conversions are specific to Yahoo + // Lowercases the local part of the Yahoo address (known to be case-insensitive) + yahoo_lowercase: true, + // Removes the subaddress (e.g. "-foo") from the email address + yahoo_remove_subaddress: true, + // The following conversions are specific to Yandex + // Lowercases the local part of the Yandex address (known to be case-insensitive) + yandex_lowercase: true, + // The following conversions are specific to iCloud + // Lowercases the local part of the iCloud address (known to be case-insensitive) + icloud_lowercase: true, + // Removes the subaddress (e.g. "+foo") from the email address + icloud_remove_subaddress: true +}; // List of domains used by iCloud + +var icloud_domains = ['icloud.com', 'me.com']; // List of domains used by Outlook.com and its predecessors +// This list is likely incomplete. +// Partial reference: +// https://blogs.office.com/2013/04/17/outlook-com-gets-two-step-verification-sign-in-by-alias-and-new-international-domains/ + +var outlookdotcom_domains = ['hotmail.at', 'hotmail.be', 'hotmail.ca', 'hotmail.cl', 'hotmail.co.il', 'hotmail.co.nz', 'hotmail.co.th', 'hotmail.co.uk', 'hotmail.com', 'hotmail.com.ar', 'hotmail.com.au', 'hotmail.com.br', 'hotmail.com.gr', 'hotmail.com.mx', 'hotmail.com.pe', 'hotmail.com.tr', 'hotmail.com.vn', 'hotmail.cz', 'hotmail.de', 'hotmail.dk', 'hotmail.es', 'hotmail.fr', 'hotmail.hu', 'hotmail.id', 'hotmail.ie', 'hotmail.in', 'hotmail.it', 'hotmail.jp', 'hotmail.kr', 'hotmail.lv', 'hotmail.my', 'hotmail.ph', 'hotmail.pt', 'hotmail.sa', 'hotmail.sg', 'hotmail.sk', 'live.be', 'live.co.uk', 'live.com', 'live.com.ar', 'live.com.mx', 'live.de', 'live.es', 'live.eu', 'live.fr', 'live.it', 'live.nl', 'msn.com', 'outlook.at', 'outlook.be', 'outlook.cl', 'outlook.co.il', 'outlook.co.nz', 'outlook.co.th', 'outlook.com', 'outlook.com.ar', 'outlook.com.au', 'outlook.com.br', 'outlook.com.gr', 'outlook.com.pe', 'outlook.com.tr', 'outlook.com.vn', 'outlook.cz', 'outlook.de', 'outlook.dk', 'outlook.es', 'outlook.fr', 'outlook.hu', 'outlook.id', 'outlook.ie', 'outlook.in', 'outlook.it', 'outlook.jp', 'outlook.kr', 'outlook.lv', 'outlook.my', 'outlook.ph', 'outlook.pt', 'outlook.sa', 'outlook.sg', 'outlook.sk', 'passport.com']; // List of domains used by Yahoo Mail +// This list is likely incomplete + +var yahoo_domains = ['rocketmail.com', 'yahoo.ca', 'yahoo.co.uk', 'yahoo.com', 'yahoo.de', 'yahoo.fr', 'yahoo.in', 'yahoo.it', 'ymail.com']; // List of domains used by yandex.ru + +var yandex_domains = ['yandex.ru', 'yandex.ua', 'yandex.kz', 'yandex.com', 'yandex.by', 'ya.ru']; // replace single dots, but not multiple consecutive dots + +function dotsReplacer(match) { + if (match.length > 1) { + return match; + } + + return ''; +} + +function normalizeEmail(email, options) { + options = (0, _merge.default)(options, default_normalize_email_options); + var raw_parts = email.split('@'); + var domain = raw_parts.pop(); + var user = raw_parts.join('@'); + var parts = [user, domain]; // The domain is always lowercased, as it's case-insensitive per RFC 1035 + + parts[1] = parts[1].toLowerCase(); + + if (parts[1] === 'gmail.com' || parts[1] === 'googlemail.com') { + // Address is GMail + if (options.gmail_remove_subaddress) { + parts[0] = parts[0].split('+')[0]; + } + + if (options.gmail_remove_dots) { + // this does not replace consecutive dots like example..email@gmail.com + parts[0] = parts[0].replace(/\.+/g, dotsReplacer); + } + + if (!parts[0].length) { + return false; + } + + if (options.all_lowercase || options.gmail_lowercase) { + parts[0] = parts[0].toLowerCase(); + } + + parts[1] = options.gmail_convert_googlemaildotcom ? 'gmail.com' : parts[1]; + } else if (icloud_domains.indexOf(parts[1]) >= 0) { + // Address is iCloud + if (options.icloud_remove_subaddress) { + parts[0] = parts[0].split('+')[0]; + } + + if (!parts[0].length) { + return false; + } + + if (options.all_lowercase || options.icloud_lowercase) { + parts[0] = parts[0].toLowerCase(); + } + } else if (outlookdotcom_domains.indexOf(parts[1]) >= 0) { + // Address is Outlook.com + if (options.outlookdotcom_remove_subaddress) { + parts[0] = parts[0].split('+')[0]; + } + + if (!parts[0].length) { + return false; + } + + if (options.all_lowercase || options.outlookdotcom_lowercase) { + parts[0] = parts[0].toLowerCase(); + } + } else if (yahoo_domains.indexOf(parts[1]) >= 0) { + // Address is Yahoo + if (options.yahoo_remove_subaddress) { + var components = parts[0].split('-'); + parts[0] = components.length > 1 ? components.slice(0, -1).join('-') : components[0]; + } + + if (!parts[0].length) { + return false; + } + + if (options.all_lowercase || options.yahoo_lowercase) { + parts[0] = parts[0].toLowerCase(); + } + } else if (yandex_domains.indexOf(parts[1]) >= 0) { + if (options.all_lowercase || options.yandex_lowercase) { + parts[0] = parts[0].toLowerCase(); + } + + parts[1] = 'yandex.ru'; // all yandex domains are equal, 1st preferred + } else if (options.all_lowercase) { + // Any other address + parts[0] = parts[0].toLowerCase(); + } + + return parts.join('@'); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/merge":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/merge.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/rtrim.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = rtrim; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function rtrim(str, chars) { + (0, _assertString.default)(str); // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#Escaping + + var pattern = chars ? new RegExp("[".concat(chars.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), "]+$"), 'g') : /\s+$/g; + return str.replace(pattern, ''); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/stripLow.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = stripLow; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +var _blacklist = _interopRequireDefault(require("./blacklist")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function stripLow(str, keep_new_lines) { + (0, _assertString.default)(str); + var chars = keep_new_lines ? '\\x00-\\x09\\x0B\\x0C\\x0E-\\x1F\\x7F' : '\\x00-\\x1F\\x7F'; + return (0, _blacklist.default)(str, chars); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./blacklist":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/blacklist.js","./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/toBoolean.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = toBoolean; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function toBoolean(str, strict) { + (0, _assertString.default)(str); + + if (strict) { + return str === '1' || /^true$/i.test(str); + } + + return str !== '0' && !/^false$/i.test(str) && str !== ''; +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/toDate.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = toDate; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function toDate(date) { + (0, _assertString.default)(date); + date = Date.parse(date); + return !isNaN(date) ? new Date(date) : null; +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/toFloat.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = toFloat; + +var _isFloat = _interopRequireDefault(require("./isFloat")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function toFloat(str) { + if (!(0, _isFloat.default)(str)) return NaN; + return parseFloat(str); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./isFloat":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isFloat.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/toInt.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = toInt; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function toInt(str, radix) { + (0, _assertString.default)(str); + return parseInt(str, radix || 10); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/trim.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = trim; + +var _rtrim = _interopRequireDefault(require("./rtrim")); + +var _ltrim = _interopRequireDefault(require("./ltrim")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function trim(str, chars) { + return (0, _rtrim.default)((0, _ltrim.default)(str, chars), chars); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./ltrim":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/ltrim.js","./rtrim":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/rtrim.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/unescape.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = unescape; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function unescape(str) { + (0, _assertString.default)(str); + return str.replace(/&/g, '&').replace(/"/g, '"').replace(/'/g, "'").replace(/</g, '<').replace(/>/g, '>').replace(///g, '/').replace(/\/g, '\\').replace(/`/g, '`'); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/algorithms.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.iso7064Check = iso7064Check; +exports.luhnCheck = luhnCheck; +exports.reverseMultiplyAndSum = reverseMultiplyAndSum; +exports.verhoeffCheck = verhoeffCheck; + +/** + * Algorithmic validation functions + * May be used as is or implemented in the workflow of other validators. + */ + +/* + * ISO 7064 validation function + * Called with a string of numbers (incl. check digit) + * to validate according to ISO 7064 (MOD 11, 10). + */ +function iso7064Check(str) { + var checkvalue = 10; + + for (var i = 0; i < str.length - 1; i++) { + checkvalue = (parseInt(str[i], 10) + checkvalue) % 10 === 0 ? 10 * 2 % 11 : (parseInt(str[i], 10) + checkvalue) % 10 * 2 % 11; + } + + checkvalue = checkvalue === 1 ? 0 : 11 - checkvalue; + return checkvalue === parseInt(str[10], 10); +} +/* + * Luhn (mod 10) validation function + * Called with a string of numbers (incl. check digit) + * to validate according to the Luhn algorithm. + */ + + +function luhnCheck(str) { + var checksum = 0; + var second = false; + + for (var i = str.length - 1; i >= 0; i--) { + if (second) { + var product = parseInt(str[i], 10) * 2; + + if (product > 9) { + // sum digits of product and add to checksum + checksum += product.toString().split('').map(function (a) { + return parseInt(a, 10); + }).reduce(function (a, b) { + return a + b; + }, 0); + } else { + checksum += product; + } + } else { + checksum += parseInt(str[i], 10); + } + + second = !second; + } + + return checksum % 10 === 0; +} +/* + * Reverse TIN multiplication and summation helper function + * Called with an array of single-digit integers and a base multiplier + * to calculate the sum of the digits multiplied in reverse. + * Normally used in variations of MOD 11 algorithmic checks. + */ + + +function reverseMultiplyAndSum(digits, base) { + var total = 0; + + for (var i = 0; i < digits.length; i++) { + total += digits[i] * (base - i); + } + + return total; +} +/* + * Verhoeff validation helper function + * Called with a string of numbers + * to validate according to the Verhoeff algorithm. + */ + + +function verhoeffCheck(str) { + var d_table = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [1, 2, 3, 4, 0, 6, 7, 8, 9, 5], [2, 3, 4, 0, 1, 7, 8, 9, 5, 6], [3, 4, 0, 1, 2, 8, 9, 5, 6, 7], [4, 0, 1, 2, 3, 9, 5, 6, 7, 8], [5, 9, 8, 7, 6, 0, 4, 3, 2, 1], [6, 5, 9, 8, 7, 1, 0, 4, 3, 2], [7, 6, 5, 9, 8, 2, 1, 0, 4, 3], [8, 7, 6, 5, 9, 3, 2, 1, 0, 4], [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]]; + var p_table = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [1, 5, 7, 6, 2, 8, 3, 0, 9, 4], [5, 8, 0, 3, 7, 9, 6, 1, 4, 2], [8, 9, 1, 6, 0, 4, 3, 5, 2, 7], [9, 4, 5, 3, 1, 2, 6, 8, 7, 0], [4, 2, 8, 6, 5, 7, 3, 9, 0, 1], [2, 7, 9, 3, 8, 0, 6, 4, 1, 5], [7, 0, 4, 6, 9, 1, 3, 2, 5, 8]]; // Copy (to prevent replacement) and reverse + + var str_copy = str.split('').reverse().join(''); + var checksum = 0; + + for (var i = 0; i < str_copy.length; i++) { + checksum = d_table[checksum][p_table[i % 8][parseInt(str_copy[i], 10)]]; + } + + return checksum === 0; +} +},{}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = assertString; + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function assertString(input) { + var isString = typeof input === 'string' || input instanceof String; + + if (!isString) { + var invalidType = _typeof(input); + + if (input === null) invalidType = 'null';else if (invalidType === 'object') invalidType = input.constructor.name; + throw new TypeError("Expected a string but received a ".concat(invalidType)); + } +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/includes.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +var includes = function includes(arr, val) { + return arr.some(function (arrVal) { + return val === arrVal; + }); +}; + +var _default = includes; +exports.default = _default; +module.exports = exports.default; +module.exports.default = exports.default; +},{}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/merge.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = merge; + +function merge() { + var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + var defaults = arguments.length > 1 ? arguments[1] : undefined; + + for (var key in defaults) { + if (typeof obj[key] === 'undefined') { + obj[key] = defaults[key]; + } + } + + return obj; +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/multilineRegex.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = multilineRegexp; + +/** + * Build RegExp object from an array + * of multiple/multi-line regexp parts + * + * @param {string[]} parts + * @param {string} flags + * @return {object} - RegExp object + */ +function multilineRegexp(parts, flags) { + var regexpAsStringLiteral = parts.join(''); + return new RegExp(regexpAsStringLiteral, flags); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/toString.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = toString; + +function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function toString(input) { + if (_typeof(input) === 'object' && input !== null) { + if (typeof input.toString === 'function') { + input = input.toString(); + } else { + input = '[object Object]'; + } + } else if (input === null || typeof input === 'undefined' || isNaN(input) && !input.length) { + input = ''; + } + + return String(input); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/whitelist.js":[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = whitelist; + +var _assertString = _interopRequireDefault(require("./util/assertString")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function whitelist(str, chars) { + (0, _assertString.default)(str); + return str.replace(new RegExp("[^".concat(chars, "]+"), 'g'), ''); +} + +module.exports = exports.default; +module.exports.default = exports.default; +},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/package.json":[function(require,module,exports){ module.exports={ "name": "doipjs", "version": "0.11.2", "description": "Decentralized OpenPGP Identity Proofs library in Node.js", "main": "src/index.js", "dependencies": { + "@xmpp/client": "^0.12.0", + "@xmpp/debug": "^0.12.0", "bent": "^7.3.12", - "browserify": "^17.0.0", + "browser-or-node": "^1.3.0", + "cors": "^2.8.5", + "dotenv": "^8.2.0", + "express": "^4.17.1", + "express-validator": "^6.10.0", + "irc-upd": "^0.11.0", + "jsdom": "^16.5.1", "merge-options": "^3.0.3", "openpgp": "^4.10.9", - "prettier": "^2.1.2", "query-string": "^6.14.1", - "valid-url": "^1.0.9" + "valid-url": "^1.0.9", + "validator": "^13.5.2" }, "devDependencies": { + "browserify": "^17.0.0", "browserify-shim": "^3.8.14", "chai": "^4.2.0", "chai-as-promised": "^7.1.1", "chai-match-pattern": "^1.2.0", + "docdash": "^1.2.0", + "jsdoc": "^3.6.6", "license-check-and-add": "^3.0.4", "minify": "^6.0.1", - "mocha": "^8.2.0" + "mocha": "^8.2.0", + "nodemon": "^2.0.7", + "prettier": "^2.1.2" }, "scripts": { - "release:bundle": "./node_modules/browserify/bin/cmd.js ./src/index.js --standalone doip -x openpgp -o ./dist/doip.js", - "release:minify": "./node_modules/minify/bin/minify.js ./dist/doip.js > ./dist/doip.min.js", - "prettier:check": "./node_modules/prettier/bin-prettier.js --check .", - "prettier:write": "./node_modules/prettier/bin-prettier.js --write .", - "license:check": "./node_modules/license-check-and-add/dist/src/cli.js check", - "license:add": "./node_modules/license-check-and-add/dist/src/cli.js add", - "license:remove": "./node_modules/license-check-and-add/dist/src/cli.js remove", - "docs": "docsify serve ./docs", - "test": "./node_modules/mocha/bin/mocha" + "release:bundle": "./node_modules/.bin/browserify ./src/index.js --full-paths --standalone doip -x openpgp -x jsdom -x @xmpp/client -x @xmpp/debug -x irc-upd -o ./dist/doip.js", + "release:minify": "./node_modules/.bin/minify ./dist/doip.js > ./dist/doip.min.js", + "prettier:check": "./node_modules/.bin/prettier --check .", + "prettier:write": "./node_modules/.bin/prettier --write .", + "license:check": "./node_modules/.bin/license-check-and-add check", + "license:add": "./node_modules/.bin/license-check-and-add add", + "license:remove": "./node_modules/.bin/license-check-and-add remove", + "docs:lib": "./node_modules/.bin/jsdoc -c jsdoc-lib.json -r -d ./docs", + "test": "./node_modules/.bin/mocha", + "proxy": "NODE_ENV=production node ./src/proxy/", + "proxy:dev": "NODE_ENV=development ./node_modules/.bin/nodemon ./src/proxy/" }, "repository": { "type": "git", @@ -1799,8 +7587,7 @@ module.exports={ } } -},{}],15:[function(require,module,exports){ -(function (global){(function (){ +},{}],"/home/yarmo/dev/doip/doipjs/src/claim.js":[function(require,module,exports){ /* Copyright 2021 Yarmo Mackenbach @@ -1816,329 +7603,291 @@ 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. */ -const path = require('path') -const mergeOptions = require('merge-options') +const validator = require('validator') const validUrl = require('valid-url') -const openpgp = (typeof window !== "undefined" ? window['openpgp'] : typeof global !== "undefined" ? global['openpgp'] : null) -const serviceproviders = require('./serviceproviders') -const keys = require('./keys') -const utils = require('./utils') +const mergeOptions = require('merge-options') +const proofs = require('./proofs') +const verifications = require('./verifications') +const claimDefinitions = require('./claimDefinitions') +const defaults = require('./defaults') +const E = require('./enums') -// Promise.allSettled polyfill -Promise.allSettled = - Promise.allSettled || - ((promises) => - Promise.all( - promises.map((p) => - p - .then((v) => ({ - status: 'fulfilled', - value: v, - })) - .catch((e) => ({ - status: 'rejected', - reason: e, - })) - ) - )) +/** + * @class + * @classdesc OpenPGP-based identity claim + * @property {string} uri - The claim's URI + * @property {string} fingerprint - The fingerprint to verify the claim against + * @property {string} status - The current status of the claim + * @property {Array} matches - The claim definitions matched against the URI + * @property {object} result - The result of the verification process + */ +class Claim { + /** + * Initialize a Claim object + * @constructor + * @param {string} [uri] - The URI of the identity claim + * @param {string} [fingerprint] - The fingerprint of the OpenPGP key + * @example + * const claim = doip.Claim(); + * const claim = doip.Claim('dns:domain.tld?type=TXT'); + * const claim = doip.Claim('dns:domain.tld?type=TXT', '123abc123abc'); + */ + constructor(uri, fingerprint) { + // Import JSON + if (typeof uri === 'object' && 'claimVersion' in uri) { + switch (data.claimVersion) { + case 1: + this._uri = data.uri + this._fingerprint = data.fingerprint + this._status = data.status + this._dataMatches = data.dataMatches + this._verification = data.verification + break -const runVerificationJson = ( - res, - proofData, - checkPath, - checkClaim, - checkRelation -) => { - let re - - if (res.isVerified || !proofData) { - return res - } - - if (Array.isArray(proofData)) { - proofData.forEach((item, i) => { - res = runVerificationJson(res, item, checkPath, checkClaim, checkRelation) - }) - return res - } - - if (checkPath.length == 0) { - switch (checkRelation) { - default: - case 'contains': - re = new RegExp(checkClaim, 'gi') - res.isVerified = re.test(proofData.replace(/\r?\n|\r|\\/g, '')) - break - case 'equals': - res.isVerified = - proofData.replace(/\r?\n|\r|\\/g, '').toLowerCase() == - checkClaim.toLowerCase() - break - case 'oneOf': - re = new RegExp(checkClaim, 'gi') - res.isVerified = re.test(proofData.join('|')) - break - } - return res - } - - try { - checkPath[0] in proofData - } catch (e) { - res.errors.push('err_data_structure_incorrect') - return res - } - - res = runVerificationJson( - res, - proofData[checkPath[0]], - checkPath.slice(1), - checkClaim, - checkRelation - ) - return res -} - -const runVerification = (proofData, spData) => { - let res = { - isVerified: false, - errors: [], - } - - switch (spData.proof.format) { - case 'json': - res = runVerificationJson( - res, - proofData, - spData.claim.path, - utils.generateClaim(spData.claim.fingerprint, spData.claim.format), - spData.claim.relation - ) - break - case 'text': - re = new RegExp( - utils.generateClaim(spData.claim.fingerprint, spData.claim.format), - 'gi' - ) - res.isVerified = re.test(proofData.replace(/\r?\n|\r/, '')) - break - } - - return res -} - -const verify = async (input, fingerprint, opts) => { - if (input instanceof openpgp.key.Key) { - const fingerprintFromKey = await keys.getFingerprint(input) - const userData = await keys.getUserData(input) - - const promises = userData.map(async (user, i) => { - return new Promise(async (resolve, reject) => { - try { - const res = await verify(user.notations, fingerprintFromKey, opts) - resolve(res) - } catch (e) { - reject(e) - } - }) - }) - - return Promise.allSettled(promises).then((values) => { - return values.map((obj, i) => { - if (obj.status == 'fulfilled') { - return obj.value - } else { - return obj.reason - } - }) - }) - } - if (input instanceof Array) { - const promises = input.map(async (uri, i) => { - return new Promise(async (resolve, reject) => { - try { - const res = await verify(uri, fingerprint, opts) - resolve(res) - } catch (e) { - reject(e) - } - }) - }) - - return Promise.allSettled(promises).then((values) => { - return values.map((obj, i) => { - if (obj.status == 'fulfilled') { - return obj.value - } else { - return obj.reason - } - }) - }) - } - - const promiseClaim = new Promise(async (resolve, reject) => { - let objResult = { - isVerified: false, - errors: [], - serviceproviderData: undefined, - } - - const uri = input.replace(/^\s+|\s+$/g, '') - - if (!fingerprint) { - fingerprint = null - } - - const defaultOpts = { - returnMatchesOnly: false, - proxyPolicy: 'adaptive', - doipProxyHostname: 'proxy.keyoxide.org', - twitterBearerToken: null, - nitterInstance: null, - } - opts = mergeOptions(defaultOpts, opts ? opts : {}) - - if (!validUrl.isUri(uri)) { - objResult.errors.push('invalid_uri') - reject(objResult) + default: + throw new Error('Invalid claim version') + break + } return } - const spMatches = serviceproviders.match(uri, opts) - - if ('returnMatchesOnly' in opts && opts.returnMatchesOnly) { - resolve(spMatches) - return + // Verify validity of URI + if (uri && !validUrl.isUri(uri)) { + throw new Error('Invalid URI') + } + + // Verify validity of fingerprint + if (fingerprint) { + try { + validator.isAlphanumeric(fingerprint) + } catch (err) { + throw new Error(`Invalid fingerprint`) + } } - let claimVerificationDone = false, - claimVerificationResult, - sp, - iSp = 0, - res, - proofData, - spData + this._uri = uri ? uri : null + this._fingerprint = fingerprint ? fingerprint : null + this._status = E.ClaimStatus.INIT + this._dataMatches = null + this._verification = null + } - while (!claimVerificationDone && iSp < spMatches.length) { - spData = spMatches[iSp] - spData.claim.fingerprint = fingerprint + get uri() { + return this._uri + } - res = null + get fingerprint() { + return this._fingerprint + } - if (spData.customRequestHandler instanceof Function) { - try { - proofData = await spData.customRequestHandler(spData, opts) - } catch (e) { - objResult.errors.push('custom_request_handler_failed') - } + get status() { + return this._status + } + + get matches() { + if (this._status === E.ClaimStatus.INIT) { + throw new Error('This claim has not yet been matched') + } + return this._dataMatches + } + + get result() { + if (this._status !== E.ClaimStatus.VERIFIED) { + throw new Error('This claim has not yet been verified') + } + return this._verification + } + + set uri(uri) { + if (this._status !== E.ClaimStatus.INIT) { + throw new Error( + 'Cannot change the URI, this claim has already been matched' + ) + } + // Verify validity of URI + if (uri && !validUrl.isUri(uri)) { + throw new Error('The URI was invalid') + } + // Remove leading and trailing spaces + uri = uri.replace(/^\s+|\s+$/g, '') + + this._uri = uri + } + + set fingerprint(fingerprint) { + if (this._status === E.ClaimStatus.VERIFIED) { + throw new Error( + 'Cannot change the fingerprint, this claim has already been verified' + ) + } + this._fingerprint = fingerprint + } + + set status(anything) { + throw new Error("Cannot change a claim's status") + } + + set dataMatches(anything) { + throw new Error("Cannot change a claim's dataMatches") + } + + set verification(anything) { + throw new Error("Cannot change a claim's verification data") + } + + /** + * Match the claim's URI to candidate definitions + * @function + */ + match() { + if (this._status !== E.ClaimStatus.INIT) { + throw new Error('This claim was already matched') + } + if (this._uri === null) { + throw new Error('This claim has no URI') + } + + this._dataMatches = [] + + claimDefinitions.list.every((name, i) => { + const def = claimDefinitions.data[name] + + // If the candidate is invalid, continue matching + if (!def.reURI.test(this._uri)) { + return true + } + + const candidate = def.processURI(this._uri) + if (candidate.match.isAmbiguous) { + // Add to the possible candidates + this._dataMatches.push(candidate) } else { - switch (opts.proxyPolicy) { - case 'adaptive': - if (spData.proof.useProxy) { - try { - proofData = await serviceproviders.proxyRequestHandler( - spData, - opts - ) - } catch (er) {} - } else { - try { - proofData = await serviceproviders.directRequestHandler( - spData, - opts - ) - } catch (er) {} - if (!proofData) { - try { - proofData = await serviceproviders.proxyRequestHandler( - spData, - opts - ) - } catch (er) {} - } - } - break - case 'fallback': - try { - proofData = await serviceproviders.directRequestHandler( - spData, - opts - ) - } catch (er) {} - if (!proofData) { - try { - proofData = await serviceproviders.proxyRequestHandler( - spData, - opts - ) - } catch (er) {} - } - break - case 'always': - try { - proofData = await serviceproviders.proxyRequestHandler( - spData, - opts - ) - } catch (er) {} - break - case 'never': - try { - proofData = await serviceproviders.directRequestHandler( - spData, - opts - ) - } catch (er) {} - break - default: - objResult.errors.push('invalid_proxy_policy') - } + // Set a single candidate and stop + this._dataMatches = [candidate] + return false + } + + // Continue matching + return true + }) + + this._status = E.ClaimStatus.MATCHED + } + + /** + * Verify the claim. The proof for each candidate is sequentially fetched and + * checked for the fingerprint. The verification stops when either a positive + * result was obtained, or an unambiguous claim definition was processed + * regardless of the result. + * @async + * @function + * @param {object} [opts] - Options for proxy, fetchers + */ + async verify(opts) { + if (this._status === E.ClaimStatus.INIT) { + throw new Error('This claim has not yet been matched') + } + if (this._status === E.ClaimStatus.VERIFIED) { + throw new Error('This claim has already been verified') + } + if (this._fingerprint === null) { + throw new Error('This claim has no fingerprint') + } + + // Handle options + opts = mergeOptions(defaults.opts, opts ? opts : {}) + + // For each match + for (let index = 0; index < this._dataMatches.length; index++) { + const claimData = this._dataMatches[index] + + let verificationResult, + proofData = null, + proofFetchError + + try { + proofData = await proofs.fetch(claimData, opts) + } catch (err) { + proofFetchError = err } if (proofData) { - claimVerificationResult = runVerification(proofData, spData) - - if (claimVerificationResult.errors.length == 0) { - claimVerificationDone = true + // Run the verification process + verificationResult = verifications.run( + proofData.result, + claimData, + this._fingerprint + ) + verificationResult.proof = { + fetcher: proofData.fetcher, + viaProxy: proofData.viaProxy, } } else { - objResult.errors.push('unsuccessful_claim_verification') + if (this.isAmbiguous()) { + // Assume a wrong match and continue + continue + } + + // Consider the proof completed but with a negative result + verificationResult = { + result: false, + completed: true, + proof: {}, + errors: [proofFetchError], + } } - iSp++ - } - - if (!claimVerificationResult) { - claimVerificationResult = { - isVerified: false, + if (verificationResult.completed) { + // Store the result, keep a single match and stop verifying + this._verification = verificationResult + this._dataMatches = [claimData] + index = this._dataMatches.length } } - objResult.isVerified = claimVerificationResult.isVerified - objResult.serviceproviderData = spData - resolve(objResult) - return - }) + this._status = E.ClaimStatus.VERIFIED + } - const promiseTimeout = new Promise((resolve) => { - const objResult = { - isVerified: false, - errors: ['verification_timed_out'], - serviceproviderData: undefined, + /** + * Determine the ambiguity of the claim. A claim is only unambiguous if any + * of the candidates is unambiguous. An ambiguous claim should never be + * displayed in an user interface when its result is negative. + * @function + * @returns {boolean} + */ + isAmbiguous() { + if (this._status === E.ClaimStatus.INIT) { + throw new Error('The claim has not been matched yet') } - setTimeout(() => { - resolve(objResult) - return - }, 10000) - }) + if (this._dataMatches.length === 0) { + throw new Error('The claim has no matches') + } + return ( + this._dataMatches.length > 1 || this._dataMatches[0].match.isAmbiguous + ) + } - return await Promise.race([promiseClaim, promiseTimeout]) + /** + * Get a JSON representation of the Claim object. Useful when transferring + * data between instances/machines. + * @function + * @returns {object} + */ + toJSON() { + return { + claimVersion: 1, + uri: this._uri, + fingerprint: this._fingerprint, + status: this._status, + dataMatches: this._dataMatches, + verification: this._verification, + } + } } -exports.verify = verify +module.exports = Claim -}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./keys":17,"./serviceproviders":18,"./utils":37,"merge-options":7,"path":8,"valid-url":13}],16:[function(require,module,exports){ +},{"./claimDefinitions":"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/index.js","./defaults":"/home/yarmo/dev/doip/doipjs/src/defaults.js","./enums":"/home/yarmo/dev/doip/doipjs/src/enums.js","./proofs":"/home/yarmo/dev/doip/doipjs/src/proofs.js","./verifications":"/home/yarmo/dev/doip/doipjs/src/verifications.js","merge-options":"/home/yarmo/dev/doip/doipjs/node_modules/merge-options/index.js","valid-url":"/home/yarmo/dev/doip/doipjs/node_modules/valid-url/index.js","validator":"/home/yarmo/dev/doip/doipjs/node_modules/validator/index.js"}],"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/devto.js":[function(require,module,exports){ /* Copyright 2021 Yarmo Mackenbach @@ -2154,19 +7903,2270 @@ 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. */ -const claims = require('./claims') +const E = require('../enums') + +const reURI = /^https:\/\/dev\.to\/(.*)\/(.*)\/?/ + +const processURI = (uri) => { + const match = uri.match(reURI) + + return { + serviceprovider: { + type: 'web', + name: 'devto', + }, + match: { + regularExpression: reURI, + isAmbiguous: false, + }, + profile: { + display: match[1], + uri: `https://dev.to/${match[1]}`, + qr: null, + }, + proof: { + uri: uri, + request: { + fetcher: E.Fetcher.HTTP, + access: E.ProofAccess.NOCORS, + format: E.ProofFormat.JSON, + data: { + url: `https://dev.to/api/articles/${match[1]}/${match[2]}`, + format: E.ProofFormat.JSON, + }, + }, + }, + claim: { + format: E.ClaimFormat.MESSAGE, + relation: E.ClaimRelation.CONTAINS, + path: ['body_markdown'], + }, + } +} + +const tests = [ + { + uri: 'https://dev.to/alice/post', + shouldMatch: true, + }, + { + uri: 'https://dev.to/alice/post/', + shouldMatch: true, + }, + { + uri: 'https://domain.org/alice/post', + shouldMatch: false, + }, +] + +exports.reURI = reURI +exports.processURI = processURI +exports.tests = tests + +},{"../enums":"/home/yarmo/dev/doip/doipjs/src/enums.js"}],"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/discourse.js":[function(require,module,exports){ +/* +Copyright 2021 Yarmo Mackenbach + +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. +*/ +const E = require('../enums') + +const reURI = /^https:\/\/(.*)\/u\/(.*)\/?/ + +const processURI = (uri) => { + const match = uri.match(reURI) + + return { + serviceprovider: { + type: 'web', + name: 'discourse', + }, + match: { + regularExpression: reURI, + isAmbiguous: true, + }, + profile: { + display: `${match[2]}@${match[1]}`, + uri: uri, + qr: null, + }, + proof: { + uri: uri, + request: { + fetcher: E.Fetcher.HTTP, + access: E.ProofAccess.NOCORS, + format: E.ProofFormat.JSON, + data: { + url: `https://${match[1]}/u/${match[2]}.json`, + format: E.ProofFormat.JSON, + }, + }, + }, + claim: { + format: E.ClaimFormat.MESSAGE, + relation: E.ClaimRelation.CONTAINS, + path: ['user', 'bio_raw'], + }, + } +} + +const tests = [ + { + uri: 'https://domain.org/u/alice', + shouldMatch: true, + }, + { + uri: 'https://domain.org/u/alice/', + shouldMatch: true, + }, + { + uri: 'https://domain.org/alice', + shouldMatch: false, + }, +] + +exports.reURI = reURI +exports.processURI = processURI +exports.tests = tests + +},{"../enums":"/home/yarmo/dev/doip/doipjs/src/enums.js"}],"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/dns.js":[function(require,module,exports){ +/* +Copyright 2021 Yarmo Mackenbach + +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. +*/ +const E = require('../enums') + +const reURI = /^dns:([a-zA-Z0-9\.\-\_]*)(?:\?(.*))?/ + +const processURI = (uri) => { + const match = uri.match(reURI) + + return { + serviceprovider: { + type: 'web', + name: 'dns', + }, + match: { + regularExpression: reURI, + isAmbiguous: false, + }, + profile: { + display: match[1], + uri: `https://${match[1]}`, + qr: null, + }, + proof: { + uri: null, + request: { + fetcher: E.Fetcher.DNS, + access: E.ProofAccess.SERVER, + format: E.ProofFormat.JSON, + data: { + domain: match[1], + }, + }, + }, + claim: { + format: E.ClaimFormat.URI, + relation: E.ClaimRelation.CONTAINS, + path: ['records', 'txt'], + }, + } +} + +const tests = [ + { + uri: 'dns:domain.org', + shouldMatch: true, + }, + { + uri: 'dns:domain.org?type=TXT', + shouldMatch: true, + }, + { + uri: 'https://domain.org', + shouldMatch: false, + }, +] + +exports.reURI = reURI +exports.processURI = processURI +exports.tests = tests + +},{"../enums":"/home/yarmo/dev/doip/doipjs/src/enums.js"}],"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/fediverse.js":[function(require,module,exports){ +/* +Copyright 2021 Yarmo Mackenbach + +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. +*/ +const E = require('../enums') + +const reURI = /^https:\/\/(.*)\/users\/(.*)\/?/ + +const processURI = (uri) => { + const match = uri.match(reURI) + + return { + serviceprovider: { + type: 'web', + name: 'fediverse', + }, + match: { + regularExpression: reURI, + isAmbiguous: true, + }, + profile: { + display: `@${match[2]}@${match[1]}`, + uri: uri, + qr: null, + }, + proof: { + uri: uri, + request: { + fetcher: E.Fetcher.HTTP, + access: E.ProofAccess.GENERIC, + format: E.ProofFormat.JSON, + data: { + url: uri, + format: E.ProofFormat.JSON, + }, + }, + }, + claim: { + format: E.ClaimFormat.FINGERPRINT, + relation: E.ClaimRelation.CONTAINS, + path: ['summary'], + }, + } +} + +const tests = [ + { + uri: 'https://domain.org/users/alice', + shouldMatch: true, + }, + { + uri: 'https://domain.org/users/alice/', + shouldMatch: true, + }, + { + uri: 'https://domain.org/alice', + shouldMatch: false, + }, +] + +exports.reURI = reURI +exports.processURI = processURI +exports.tests = tests + +},{"../enums":"/home/yarmo/dev/doip/doipjs/src/enums.js"}],"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/gitea.js":[function(require,module,exports){ +/* +Copyright 2021 Yarmo Mackenbach + +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. +*/ +const E = require('../enums') + +const reURI = /^https:\/\/(.*)\/(.*)\/gitea_proof\/?/ + +const processURI = (uri) => { + const match = uri.match(reURI) + + return { + serviceprovider: { + type: 'web', + name: 'gitea', + }, + match: { + regularExpression: reURI, + isAmbiguous: true, + }, + profile: { + display: `${match[2]}@${match[1]}`, + uri: `https://${match[1]}/${match[2]}`, + qr: null, + }, + proof: { + uri: uri, + request: { + fetcher: E.Fetcher.HTTP, + access: E.ProofAccess.NOCORS, + format: E.ProofFormat.JSON, + data: { + url: `https://${match[1]}/api/v1/repos/${match[2]}/gitea_proof`, + format: E.ProofFormat.JSON, + }, + }, + }, + claim: { + format: E.ClaimFormat.MESSAGE, + relation: E.ClaimRelation.EQUALS, + path: ['description'], + }, + } +} + +const tests = [ + { + uri: 'https://domain.org/alice/gitea_proof', + shouldMatch: true, + }, + { + uri: 'https://domain.org/alice/gitea_proof/', + shouldMatch: true, + }, + { + uri: 'https://domain.org/alice/other_proof', + shouldMatch: false, + }, +] + +exports.reURI = reURI +exports.processURI = processURI +exports.tests = tests + +},{"../enums":"/home/yarmo/dev/doip/doipjs/src/enums.js"}],"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/github.js":[function(require,module,exports){ +/* +Copyright 2021 Yarmo Mackenbach + +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. +*/ +const E = require('../enums') + +const reURI = /^https:\/\/gist\.github\.com\/(.*)\/(.*)\/?/ + +const processURI = (uri) => { + const match = uri.match(reURI) + + return { + serviceprovider: { + type: 'web', + name: 'github', + }, + match: { + regularExpression: reURI, + isAmbiguous: false, + }, + profile: { + display: match[1], + uri: `https://github.com/${match[1]}`, + qr: null, + }, + proof: { + uri: uri, + request: { + fetcher: E.Fetcher.HTTP, + access: E.ProofAccess.GENERIC, + format: E.ProofFormat.JSON, + data: { + url: `https://api.github.com/gists/${match[2]}`, + format: E.ProofFormat.JSON, + }, + }, + }, + claim: { + format: E.ClaimFormat.MESSAGE, + relation: E.ClaimRelation.CONTAINS, + path: ['files', 'openpgp.md', 'content'], + }, + } +} + +const tests = [ + { + uri: 'https://gist.github.com/Alice/123456789', + shouldMatch: true, + }, + { + uri: 'https://gist.github.com/Alice/123456789/', + shouldMatch: true, + }, + { + uri: 'https://domain.org/Alice/123456789', + shouldMatch: false, + }, +] + +exports.reURI = reURI +exports.processURI = processURI +exports.tests = tests + +},{"../enums":"/home/yarmo/dev/doip/doipjs/src/enums.js"}],"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/gitlab.js":[function(require,module,exports){ +/* +Copyright 2021 Yarmo Mackenbach + +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. +*/ +const E = require('../enums') + +const reURI = /^https:\/\/(.*)\/(.*)\/gitlab_proof\/?/ + +const processURI = (uri) => { + const match = uri.match(reURI) + + return { + serviceprovider: { + type: 'web', + name: 'gitlab', + }, + match: { + regularExpression: reURI, + isAmbiguous: true, + }, + profile: { + display: `${match[2]}@${match[1]}`, + uri: `https://${match[1]}/${match[2]}`, + qr: null, + }, + proof: { + uri: uri, + request: { + fetcher: E.Fetcher.GITLAB, + access: E.ProofAccess.GENERIC, + format: E.ProofFormat.JSON, + data: { + domain: match[1], + username: match[2], + }, + }, + }, + claim: { + format: E.ClaimFormat.MESSAGE, + relation: E.ClaimRelation.EQUALS, + path: ['description'], + }, + } +} + +const tests = [ + { + uri: 'https://gitlab.domain.org/alice/gitlab_proof', + shouldMatch: true, + }, + { + uri: 'https://gitlab.domain.org/alice/gitlab_proof/', + shouldMatch: true, + }, + { + uri: 'https://domain.org/alice/other_proof', + shouldMatch: false, + }, +] + +exports.reURI = reURI +exports.processURI = processURI +exports.tests = tests + +},{"../enums":"/home/yarmo/dev/doip/doipjs/src/enums.js"}],"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/hackernews.js":[function(require,module,exports){ +/* +Copyright 2021 Yarmo Mackenbach + +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. +*/ +const E = require('../enums') + +const reURI = /^https:\/\/news\.ycombinator\.com\/user\?id=(.*)\/?/ + +const processURI = (uri) => { + const match = uri.match(reURI) + + return { + serviceprovider: { + type: 'web', + name: 'hackernews', + }, + match: { + regularExpression: reURI, + isAmbiguous: false, + }, + profile: { + display: match[1], + uri: uri, + qr: null, + }, + proof: { + uri: `https://hacker-news.firebaseio.com/v0/user/${match[1]}.json`, + request: { + fetcher: E.Fetcher.HTTP, + access: E.ProofAccess.NOCORS, + format: E.ProofFormat.JSON, + data: { + url: `https://hacker-news.firebaseio.com/v0/user/${match[1]}.json`, + format: E.ProofFormat.JSON, + }, + }, + }, + claim: { + format: E.ClaimFormat.URI, + relation: E.ClaimRelation.CONTAINS, + path: ['about'], + }, + } +} + +const tests = [ + { + uri: 'https://news.ycombinator.com/user?id=Alice', + shouldMatch: true, + }, + { + uri: 'https://news.ycombinator.com/user?id=Alice/', + shouldMatch: true, + }, + { + uri: 'https://domain.org/user?id=Alice', + shouldMatch: false, + }, +] + +exports.reURI = reURI +exports.processURI = processURI +exports.tests = tests + +},{"../enums":"/home/yarmo/dev/doip/doipjs/src/enums.js"}],"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/index.js":[function(require,module,exports){ +/* +Copyright 2021 Yarmo Mackenbach + +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. +*/ +const list = [ + 'dns', + 'irc', + 'xmpp', + 'matrix', + 'twitter', + 'reddit', + 'liberapay', + 'hackernews', + 'lobsters', + 'devto', + 'gitea', + 'gitlab', + 'github', + 'mastodon', + 'fediverse', + 'discourse', + 'owncast', +] + +const data = { + dns: require('./dns'), + irc: require('./irc'), + xmpp: require('./xmpp'), + matrix: require('./matrix'), + twitter: require('./twitter'), + reddit: require('./reddit'), + liberapay: require('./liberapay'), + hackernews: require('./hackernews'), + lobsters: require('./lobsters'), + devto: require('./devto'), + gitea: require('./gitea'), + gitlab: require('./gitlab'), + github: require('./github'), + mastodon: require('./mastodon'), + fediverse: require('./fediverse'), + discourse: require('./discourse'), + owncast: require('./owncast'), +} + +exports.list = list +exports.data = data + +},{"./devto":"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/devto.js","./discourse":"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/discourse.js","./dns":"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/dns.js","./fediverse":"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/fediverse.js","./gitea":"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/gitea.js","./github":"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/github.js","./gitlab":"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/gitlab.js","./hackernews":"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/hackernews.js","./irc":"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/irc.js","./liberapay":"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/liberapay.js","./lobsters":"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/lobsters.js","./mastodon":"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/mastodon.js","./matrix":"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/matrix.js","./owncast":"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/owncast.js","./reddit":"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/reddit.js","./twitter":"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/twitter.js","./xmpp":"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/xmpp.js"}],"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/irc.js":[function(require,module,exports){ +/* +Copyright 2021 Yarmo Mackenbach + +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. +*/ +const E = require('../enums') + +const reURI = /^irc\:\/\/(.*)\/([a-zA-Z0-9]*)/ + +const processURI = (uri) => { + const match = uri.match(reURI) + + return { + serviceprovider: { + type: 'communication', + name: 'irc', + }, + match: { + regularExpression: reURI, + isAmbiguous: false, + }, + profile: { + display: `irc://${match[1]}/${match[2]}`, + uri: uri, + qr: null, + }, + proof: { + uri: null, + request: { + fetcher: E.Fetcher.IRC, + access: E.ProofAccess.SERVER, + format: E.ProofFormat.JSON, + data: { + domain: match[1], + nick: match[2], + }, + }, + }, + claim: { + format: E.ClaimFormat.URI, + relation: E.ClaimRelation.CONTAINS, + path: [], + }, + } +} + +const tests = [ + { + uri: 'irc://chat.ircserver.org/Alice1', + shouldMatch: true, + }, + { + uri: 'irc://chat.ircserver.org/alice?param=123', + shouldMatch: true, + }, + { + uri: 'https://chat.ircserver.org/alice', + shouldMatch: false, + }, +] + +exports.reURI = reURI +exports.processURI = processURI +exports.tests = tests + +},{"../enums":"/home/yarmo/dev/doip/doipjs/src/enums.js"}],"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/liberapay.js":[function(require,module,exports){ +/* +Copyright 2021 Yarmo Mackenbach + +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. +*/ +const E = require('../enums') + +const reURI = /^https:\/\/liberapay\.com\/(.*)\/?/ + +const processURI = (uri) => { + const match = uri.match(reURI) + + return { + serviceprovider: { + type: 'web', + name: 'liberapay', + }, + match: { + regularExpression: reURI, + isAmbiguous: false, + }, + profile: { + display: match[1], + uri: uri, + qr: null, + }, + proof: { + uri: uri, + request: { + fetcher: E.Fetcher.HTTP, + access: E.ProofAccess.GENERIC, + format: E.ProofFormat.JSON, + data: { + url: `https://liberapay.com/${match[1]}/public.json`, + format: E.ProofFormat.JSON, + }, + }, + }, + claim: { + format: E.ClaimFormat.MESSAGE, + relation: E.ClaimRelation.CONTAINS, + path: ['statements', 'content'], + }, + } +} + +const tests = [ + { + uri: 'https://liberapay.com/alice', + shouldMatch: true, + }, + { + uri: 'https://liberapay.com/alice/', + shouldMatch: true, + }, + { + uri: 'https://domain.org/alice', + shouldMatch: false, + }, +] + +exports.reURI = reURI +exports.processURI = processURI +exports.tests = tests + +},{"../enums":"/home/yarmo/dev/doip/doipjs/src/enums.js"}],"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/lobsters.js":[function(require,module,exports){ +/* +Copyright 2021 Yarmo Mackenbach + +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. +*/ +const E = require('../enums') + +const reURI = /^https:\/\/lobste\.rs\/u\/(.*)\/?/ + +const processURI = (uri) => { + const match = uri.match(reURI) + + return { + serviceprovider: { + type: 'web', + name: 'lobsters', + }, + match: { + regularExpression: reURI, + isAmbiguous: false, + }, + profile: { + display: match[1], + uri: uri, + qr: null, + }, + proof: { + uri: `https://lobste.rs/u/${match[1]}.json`, + request: { + fetcher: E.Fetcher.HTTP, + access: E.ProofAccess.NOCORS, + format: E.ProofFormat.JSON, + data: { + url: `https://lobste.rs/u/${match[1]}.json`, + format: E.ProofFormat.JSON, + }, + }, + }, + claim: { + format: E.ClaimFormat.MESSAGE, + relation: E.ClaimRelation.CONTAINS, + path: ['about'], + }, + } +} + +const tests = [ + { + uri: 'https://lobste.rs/u/Alice', + shouldMatch: true, + }, + { + uri: 'https://lobste.rs/u/Alice/', + shouldMatch: true, + }, + { + uri: 'https://domain.org/u/Alice', + shouldMatch: false, + }, +] + +exports.reURI = reURI +exports.processURI = processURI +exports.tests = tests + +},{"../enums":"/home/yarmo/dev/doip/doipjs/src/enums.js"}],"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/mastodon.js":[function(require,module,exports){ +/* +Copyright 2021 Yarmo Mackenbach + +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. +*/ +const E = require('../enums') + +const reURI = /^https:\/\/(.*)\/@(.*)\/?/ + +const processURI = (uri) => { + const match = uri.match(reURI) + + return { + serviceprovider: { + type: 'web', + name: 'mastodon', + }, + match: { + regularExpression: reURI, + isAmbiguous: true, + }, + profile: { + display: `@${match[2]}@${match[1]}`, + uri: uri, + qr: null, + }, + proof: { + uri: uri, + request: { + fetcher: E.Fetcher.HTTP, + access: E.ProofAccess.GENERIC, + format: E.ProofFormat.JSON, + data: { + url: uri, + format: E.ProofFormat.JSON, + }, + }, + }, + claim: { + format: E.ClaimFormat.FINGERPRINT, + relation: E.ClaimRelation.CONTAINS, + path: ['attachment', 'value'], + }, + } +} + +const tests = [ + { + uri: 'https://domain.org/@alice', + shouldMatch: true, + }, + { + uri: 'https://domain.org/@alice/', + shouldMatch: true, + }, + { + uri: 'https://domain.org/alice', + shouldMatch: false, + }, +] + +exports.reURI = reURI +exports.processURI = processURI +exports.tests = tests + +},{"../enums":"/home/yarmo/dev/doip/doipjs/src/enums.js"}],"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/matrix.js":[function(require,module,exports){ +/* +Copyright 2021 Yarmo Mackenbach + +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. +*/ +const E = require('../enums') +const queryString = require('query-string') + +const reURI = /^matrix\:u\/(?:\@)?([^@:]*\:[^?]*)(\?.*)?/ + +const processURI = (uri) => { + const match = uri.match(reURI) + + if (!match[2]) { + return null + } + + const params = queryString.parse(match[2]) + + if (!('org.keyoxide.e' in params && 'org.keyoxide.r' in params)) { + return null + } + + const profileUrl = `https://matrix.to/#/@${match[1]}` + const eventUrl = `https://matrix.to/#/${params['org.keyoxide.r']}/${params['org.keyoxide.e']}` + + return { + serviceprovider: { + type: 'communication', + name: 'matrix', + }, + match: { + regularExpression: reURI, + isAmbiguous: false, + }, + profile: { + display: `@${match[1]}`, + uri: profileUrl, + qr: null, + }, + proof: { + uri: eventUrl, + request: { + fetcher: E.Fetcher.MATRIX, + access: E.ProofAccess.GRANTED, + format: E.ProofFormat.JSON, + data: { + eventId: params['org.keyoxide.e'], + roomId: params['org.keyoxide.r'], + }, + }, + }, + claim: { + format: E.ClaimFormat.MESSAGE, + relation: E.ClaimRelation.CONTAINS, + path: ['content', 'body'], + }, + } +} + +const tests = [ + { + uri: + 'matrix:u/alice:matrix.domain.org?org.keyoxide.r=!123:domain.org&org.keyoxide.e=$123', + shouldMatch: true, + }, + { + uri: 'matrix:u/alice:matrix.domain.org', + shouldMatch: true, + }, + { + uri: 'xmpp:alice@domain.org', + shouldMatch: false, + }, + { + uri: 'https://domain.org/@alice', + shouldMatch: false, + }, +] + +exports.reURI = reURI +exports.processURI = processURI +exports.tests = tests + +},{"../enums":"/home/yarmo/dev/doip/doipjs/src/enums.js","query-string":"/home/yarmo/dev/doip/doipjs/node_modules/query-string/index.js"}],"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/owncast.js":[function(require,module,exports){ +/* +Copyright 2021 Yarmo Mackenbach + +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. +*/ +const E = require('../enums') + +const reURI = /^https:\/\/(.*)/ + +const processURI = (uri) => { + const match = uri.match(reURI) + + return { + serviceprovider: { + type: 'web', + name: 'owncast', + }, + match: { + regularExpression: reURI, + isAmbiguous: true, + }, + profile: { + display: match[1], + uri: uri, + qr: null, + }, + proof: { + uri: `${uri}/api/config`, + request: { + fetcher: E.Fetcher.HTTP, + access: E.ProofAccess.GENERIC, + format: E.ProofFormat.JSON, + data: { + url: `${uri}/api/config`, + format: E.ProofFormat.JSON, + }, + }, + }, + claim: { + format: E.ClaimFormat.FINGERPRINT, + relation: E.ClaimRelation.CONTAINS, + path: ['socialHandles', 'url'], + }, + } +} + +const tests = [ + { + uri: 'https://live.domain.org', + shouldMatch: true, + }, + { + uri: 'https://live.domain.org/', + shouldMatch: true, + }, + { + uri: 'https://domain.org/live', + shouldMatch: true, + }, + { + uri: 'https://domain.org/live/', + shouldMatch: true, + }, +] + +exports.reURI = reURI +exports.processURI = processURI +exports.tests = tests + +},{"../enums":"/home/yarmo/dev/doip/doipjs/src/enums.js"}],"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/reddit.js":[function(require,module,exports){ +/* +Copyright 2021 Yarmo Mackenbach + +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. +*/ +const E = require('../enums') + +const reURI = /^https:\/\/(?:www\.)?reddit\.com\/user\/(.*)\/comments\/(.*)\/(.*)\/?/ + +const processURI = (uri) => { + const match = uri.match(reURI) + + return { + serviceprovider: { + type: 'web', + name: 'reddit', + }, + match: { + regularExpression: reURI, + isAmbiguous: false, + }, + profile: { + display: match[1], + uri: `https://www.reddit.com/user/${match[1]}`, + qr: null, + }, + proof: { + uri: uri, + request: { + fetcher: E.Fetcher.HTTP, + access: E.ProofAccess.NOCORS, + format: E.ProofFormat.JSON, + data: { + url: `https://www.reddit.com/user/${match[1]}/comments/${match[2]}.json`, + format: E.ProofFormat.JSON, + }, + }, + }, + claim: { + format: E.ClaimFormat.MESSAGE, + relation: E.ClaimRelation.CONTAINS, + path: ['data', 'children', 'data', 'selftext'], + }, + } +} + +const tests = [ + { + uri: 'https://www.reddit.com/user/Alice/comments/123456/post', + shouldMatch: true, + }, + { + uri: 'https://www.reddit.com/user/Alice/comments/123456/post/', + shouldMatch: true, + }, + { + uri: 'https://reddit.com/user/Alice/comments/123456/post', + shouldMatch: true, + }, + { + uri: 'https://reddit.com/user/Alice/comments/123456/post/', + shouldMatch: true, + }, + { + uri: 'https://domain.org/user/Alice/comments/123456/post', + shouldMatch: false, + }, +] + +exports.reURI = reURI +exports.processURI = processURI +exports.tests = tests + +},{"../enums":"/home/yarmo/dev/doip/doipjs/src/enums.js"}],"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/twitter.js":[function(require,module,exports){ +/* +Copyright 2021 Yarmo Mackenbach + +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. +*/ +const E = require('../enums') + +const reURI = /^https:\/\/twitter\.com\/(.*)\/status\/([0-9]*)(?:\?.*)?/ + +const processURI = (uri) => { + const match = uri.match(reURI) + + return { + serviceprovider: { + type: 'web', + name: 'twitter', + }, + match: { + regularExpression: reURI, + isAmbiguous: false, + }, + profile: { + display: `@${match[1]}`, + uri: `https://twitter.com/${match[1]}`, + qr: null, + }, + proof: { + uri: uri, + request: { + fetcher: E.Fetcher.TWITTER, + access: E.ProofAccess.GRANTED, + format: E.ProofFormat.TEXT, + data: { + tweetId: match[2], + }, + }, + }, + claim: { + format: E.ClaimFormat.MESSAGE, + relation: E.ClaimRelation.CONTAINS, + path: [], + }, + } +} + +const tests = [ + { + uri: 'https://twitter.com/alice/status/1234567890123456789', + shouldMatch: true, + }, + { + uri: 'https://twitter.com/alice/status/1234567890123456789/', + shouldMatch: true, + }, + { + uri: 'https://domain.org/alice/status/1234567890123456789', + shouldMatch: false, + }, +] + +exports.reURI = reURI +exports.processURI = processURI +exports.tests = tests + +},{"../enums":"/home/yarmo/dev/doip/doipjs/src/enums.js"}],"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/xmpp.js":[function(require,module,exports){ +/* +Copyright 2021 Yarmo Mackenbach + +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. +*/ +const E = require('../enums') + +const reURI = /^xmpp:([a-zA-Z0-9\.\-\_]*)@([a-zA-Z0-9\.\-\_]*)(?:\?(.*))?/ + +const processURI = (uri) => { + const match = uri.match(reURI) + + return { + serviceprovider: { + type: 'communication', + name: 'xmpp', + }, + match: { + regularExpression: reURI, + isAmbiguous: false, + }, + profile: { + display: `${match[1]}@${match[2]}`, + uri: uri, + qr: uri, + }, + proof: { + uri: null, + request: { + fetcher: E.Fetcher.XMPP, + access: E.ProofAccess.SERVER, + format: E.ProofFormat.TEXT, + data: { + id: `${match[1]}@${match[2]}`, + field: 'note', + }, + }, + }, + claim: { + format: E.ClaimFormat.MESSAGE, + relation: E.ClaimRelation.CONTAINS, + path: [], + }, + } +} + +const tests = [ + { + uri: 'xmpp:alice@domain.org', + shouldMatch: true, + }, + { + uri: 'xmpp:alice@domain.org?omemo-sid-123456789=A1B2C3D4E5F6G7H8I9', + shouldMatch: true, + }, + { + uri: 'https://domain.org', + shouldMatch: false, + }, +] + +exports.reURI = reURI +exports.processURI = processURI +exports.tests = tests + +},{"../enums":"/home/yarmo/dev/doip/doipjs/src/enums.js"}],"/home/yarmo/dev/doip/doipjs/src/defaults.js":[function(require,module,exports){ +/* +Copyright 2021 Yarmo Mackenbach + +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. +*/ +const E = require('./enums') + +/** + * Contains default values + * @module defaults + */ + +/** + * The default options used throughout the library + * @constant {object} + * @property {object} proxy - Options related to the proxy + * @property {string|null} proxy.hostname - The hostname of the proxy + * @property {string} proxy.policy - The policy that defines when to use a proxy ({@link module:enums~ProxyPolicy|here}) + * @property {object} claims - Options related to claim verification + * @property {object} claims.irc - Options related to the verification of IRC claims + * @property {string|null} claims.irc.nick - The nick that the library uses to connect to the IRC server + * @property {object} claims.matrix - Options related to the verification of Matrix claims + * @property {string|null} claims.matrix.instance - The server hostname on which the library can log in + * @property {string|null} claims.matrix.accessToken - The access token required to identify the library ({@link https://www.matrix.org/docs/guides/client-server-api|Matrix docs}) + * @property {object} claims.xmpp - Options related to the verification of XMPP claims + * @property {string|null} claims.xmpp.service - The server hostname on which the library can log in + * @property {string|null} claims.xmpp.username - The username used to log in + * @property {string|null} claims.xmpp.password - The password used to log in + * @property {object} claims.twitter - Options related to the verification of Twitter claims + * @property {string|null} claims.twitter.bearerToken - The Twitter API's bearer token ({@link https://developer.twitter.com/en/docs/authentication/oauth-2-0/bearer-tokens|Twitter docs}) + */ +const opts = { + proxy: { + hostname: null, + policy: E.ProxyPolicy.NEVER, + }, + claims: { + irc: { + nick: null, + }, + matrix: { + instance: null, + accessToken: null, + }, + xmpp: { + service: null, + username: null, + password: null, + }, + twitter: { + bearerToken: null, + }, + }, +} + +exports.opts = opts + +},{"./enums":"/home/yarmo/dev/doip/doipjs/src/enums.js"}],"/home/yarmo/dev/doip/doipjs/src/enums.js":[function(require,module,exports){ +/* +Copyright 2021 Yarmo Mackenbach + +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. +*/ +/** + * Contains enums + * @module enums + */ + +/** + * The proxy policy that decides how to fetch a proof + * @readonly + * @enum {string} + */ +const ProxyPolicy = { + /** Proxy usage decision depends on environment and service provider */ + ADAPTIVE: 'adaptive', + /** Always use a proxy */ + ALWAYS: 'always', + /** Never use a proxy, skip a verification if a proxy is inevitable */ + NEVER: 'never', +} +Object.freeze(ProxyPolicy) + +/** + * Methods for fetching proofs + * @readonly + * @enum {string} + */ +const Fetcher = { + /** Basic HTTP requests */ + HTTP: 'http', + /** DNS module from Node.js */ + DNS: 'dns', + /** IRC module from Node.js */ + IRC: 'irc', + /** XMPP module from Node.js */ + XMPP: 'xmpp', + /** HTTP request to Matrix API */ + MATRIX: 'matrix', + /** HTTP request to Gitlab API */ + GITLAB: 'gitlab', + /** HTTP request to Twitter API */ + TWITTER: 'twitter', +} +Object.freeze(Fetcher) + +/** + * Levels of access restriction for proof fetching + * @readonly + * @enum {number} + */ +const ProofAccess = { + /** Any HTTP request will work */ + GENERIC: 0, + /** CORS requests are denied */ + NOCORS: 1, + /** HTTP requests must contain API or access tokens */ + GRANTED: 2, + /** Not accessible by HTTP request, needs server software */ + SERVER: 3, +} +Object.freeze(ProofAccess) + +/** + * Format of proof + * @readonly + * @enum {string} + */ +const ProofFormat = { + /** JSON format */ + JSON: 'json', + /** Plaintext format */ + TEXT: 'text', +} +Object.freeze(ProofFormat) + +/** + * Format of claim + * @readonly + * @enum {number} + */ +const ClaimFormat = { + /** `openpgp4fpr:123123123` */ + URI: 0, + /** `123123123` */ + FINGERPRINT: 1, + /** `[Verifying my OpenPGP key: openpgp4fpr:123123123]` */ + MESSAGE: 2, +} +Object.freeze(ClaimFormat) + +/** + * How to find the claim inside the proof's JSON data + * @readonly + * @enum {number} + */ +const ClaimRelation = { + /** Claim is somewhere in the JSON field's textual content */ + CONTAINS: 0, + /** Claim is equal to the JSON field's textual content */ + EQUALS: 1, + /** Claim is equal to an element of the JSON field's array of strings */ + ONEOF: 2, +} +Object.freeze(ClaimRelation) + +/** + * Status of the Claim instance + * @readonly + * @enum {string} + */ +const ClaimStatus = { + /** Claim has been initialized */ + INIT: 'init', + /** Claim has matched its URI to candidate claim definitions */ + MATCHED: 'matched', + /** Claim has verified one or multiple candidate claim definitions */ + VERIFIED: 'verified', +} +Object.freeze(ClaimStatus) + +exports.ProxyPolicy = ProxyPolicy +exports.Fetcher = Fetcher +exports.ProofAccess = ProofAccess +exports.ProofFormat = ProofFormat +exports.ClaimFormat = ClaimFormat +exports.ClaimRelation = ClaimRelation +exports.ClaimStatus = ClaimStatus + +},{}],"/home/yarmo/dev/doip/doipjs/src/fetcher/dns.js":[function(require,module,exports){ +/* +Copyright 2021 Yarmo Mackenbach + +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. +*/ +const dns = require('dns') + +/** + * @module fetcher/dns + */ + +/** + * The request's timeout value in milliseconds + * @constant {number} timeout + */ +module.exports.timeout = 5000 + +/** + * Execute a fetch request + * @function + * @async + * @param {object} data - Data used in the request + * @param {string} data.domain - The targeted domain + * @returns {object} + */ +module.exports.fn = async (data, opts) => { + let timeoutHandle + const timeoutPromise = new Promise((resolve, reject) => { + timeoutHandle = setTimeout( + () => reject(new Error('Request was timed out')), + data.fetcherTimeout ? data.fetcherTimeout : module.exports.timeout + ) + }) + + const fetchPromise = new Promise((resolve, reject) => { + dns.resolveTxt(data.domain, (err, records) => { + if (err) { + reject(err) + return + } + + resolve({ + domain: data.domain, + records: { + txt: records, + }, + }) + }) + }) + + return Promise.race([fetchPromise, timeoutPromise]).then((result) => { + clearTimeout(timeoutHandle) + return result + }) +} + +},{"dns":"/home/yarmo/dev/doip/doipjs/node_modules/browserify/lib/_empty.js"}],"/home/yarmo/dev/doip/doipjs/src/fetcher/gitlab.js":[function(require,module,exports){ +/* +Copyright 2021 Yarmo Mackenbach + +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. +*/ +const bent = require('bent') +const req = bent('GET') + +/** + * @module fetcher/gitlab + */ + +/** + * The request's timeout value in milliseconds + * @constant {number} timeout + */ +module.exports.timeout = 5000 + +/** + * Execute a fetch request + * @function + * @async + * @param {object} data - Data used in the request + * @param {string} data.username - The username of the targeted account + * @param {string} data.domain - The domain on which the targeted account is registered + * @returns {object} + */ +module.exports.fn = async (data, opts) => { + let timeoutHandle + const timeoutPromise = new Promise((resolve, reject) => { + timeoutHandle = setTimeout( + () => reject(new Error('Request was timed out')), + data.fetcherTimeout ? data.fetcherTimeout : module.exports.timeout + ) + }) + + const fetchPromise = new Promise(async (resolve, reject) => { + const urlUser = `https://${data.domain}/api/v4/users?username=${data.username}` + const resUser = await req(urlUser, null, { Accept: 'application/json' }) + const jsonUser = await resUser.json() + + const user = jsonUser.find((user) => user.username === data.username) + if (!user) { + reject(`No user with username ${data.username}`) + } + + const urlProject = `https://${data.domain}/api/v4/users/${user.id}/projects` + const resProject = await req(urlProject, null, { + Accept: 'application/json', + }) + const jsonProject = await resProject.json() + + const project = jsonProject.find((proj) => proj.path === 'gitlab_proof') + if (!project) { + reject(`No project found`) + } + + resolve(project) + }) + + return Promise.race([fetchPromise, timeoutPromise]).then((result) => { + clearTimeout(timeoutHandle) + return result + }) +} + +},{"bent":"/home/yarmo/dev/doip/doipjs/node_modules/bent/src/browser.js"}],"/home/yarmo/dev/doip/doipjs/src/fetcher/http.js":[function(require,module,exports){ +/* +Copyright 2021 Yarmo Mackenbach + +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. +*/ +const bent = require('bent') +const req = bent('GET') +const E = require('../enums') + +/** + * @module fetcher/http + */ + +/** + * The request's timeout value in milliseconds + * @constant {number} timeout + */ +module.exports.timeout = 5000 + +/** + * Execute a fetch request + * @function + * @async + * @param {object} data - Data used in the request + * @param {string} data.url - The URL pointing at targeted content + * @param {string} data.format - The format of the targeted content + * @returns {object|string} + */ +module.exports.fn = async (data, opts) => { + let timeoutHandle + const timeoutPromise = new Promise((resolve, reject) => { + timeoutHandle = setTimeout( + () => reject(new Error('Request was timed out')), + data.fetcherTimeout ? data.fetcherTimeout : module.exports.timeout + ) + }) + + const fetchPromise = new Promise((resolve, reject) => { + if (!data.url) { + reject('No valid URI provided') + return + } + + switch (data.format) { + case E.ProofFormat.JSON: + req(data.url, null, { + Accept: 'application/json', + 'User-Agent': `doipjs/${require('../../package.json').version}`, + }) + .then(async (res) => { + return await res.json() + }) + .then((res) => { + resolve(res) + }) + .catch((e) => { + reject(e) + }) + break + case E.ProofFormat.TEXT: + req(data.url) + .then(async (res) => { + return await res.text() + }) + .then((res) => { + resolve(res) + }) + .catch((e) => { + reject(e) + }) + break + default: + reject('No specified data format') + break + } + }) + + return Promise.race([fetchPromise, timeoutPromise]).then((result) => { + clearTimeout(timeoutHandle) + return result + }) +} + +},{"../../package.json":"/home/yarmo/dev/doip/doipjs/package.json","../enums":"/home/yarmo/dev/doip/doipjs/src/enums.js","bent":"/home/yarmo/dev/doip/doipjs/node_modules/bent/src/browser.js"}],"/home/yarmo/dev/doip/doipjs/src/fetcher/index.js":[function(require,module,exports){ +/* +Copyright 2021 Yarmo Mackenbach + +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. +*/ + +exports.dns = require('./dns') +exports.gitlab = require('./gitlab') +exports.http = require('./http') +exports.irc = require('./irc') +exports.matrix = require('./matrix') +exports.twitter = require('./twitter') +exports.xmpp = require('./xmpp') +},{"./dns":"/home/yarmo/dev/doip/doipjs/src/fetcher/dns.js","./gitlab":"/home/yarmo/dev/doip/doipjs/src/fetcher/gitlab.js","./http":"/home/yarmo/dev/doip/doipjs/src/fetcher/http.js","./irc":"/home/yarmo/dev/doip/doipjs/src/fetcher/irc.js","./matrix":"/home/yarmo/dev/doip/doipjs/src/fetcher/matrix.js","./twitter":"/home/yarmo/dev/doip/doipjs/src/fetcher/twitter.js","./xmpp":"/home/yarmo/dev/doip/doipjs/src/fetcher/xmpp.js"}],"/home/yarmo/dev/doip/doipjs/src/fetcher/irc.js":[function(require,module,exports){ +/* +Copyright 2021 Yarmo Mackenbach + +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. +*/ +const irc = require('irc-upd') +const validator = require('validator') + +/** + * @module fetcher/irc + */ + +/** + * The request's timeout value in milliseconds + * @constant {number} timeout + */ +module.exports.timeout = 20000 + +/** + * Execute a fetch request + * @function + * @async + * @param {object} data - Data used in the request + * @param {string} data.nick - The nick of the targeted account + * @param {string} data.domain - The domain on which the targeted account is registered + * @param {object} opts - Options used to enable the request + * @param {string} opts.claims.irc.nick - The nick to be used by the library to log in + * @returns {object} + */ +module.exports.fn = async (data, opts) => { + let timeoutHandle + const timeoutPromise = new Promise((resolve, reject) => { + timeoutHandle = setTimeout( + () => reject(new Error('Request was timed out')), + data.fetcherTimeout ? data.fetcherTimeout : module.exports.timeout + ) + }) + + const fetchPromise = new Promise((resolve, reject) => { + try { + validator.isAscii(opts.claims.irc.nick) + } catch (err) { + throw new Error(`IRC fetcher was not set up properly (${err.message})`) + } + + try { + const client = new irc.Client(data.domain, opts.claims.irc.nick, { + port: 6697, + secure: true, + channels: [], + }) + const reKey = /[a-zA-Z0-9\-\_]+\s+:\s(openpgp4fpr\:.*)/ + const reEnd = /End\sof\s.*\staxonomy./ + let keys = [] + + client.addListener('registered', (message) => { + client.send(`PRIVMSG NickServ :TAXONOMY ${data.nick}`) + }) + client.addListener('notice', (nick, to, text, message) => { + if (reKey.test(text)) { + const match = text.match(reKey) + keys.push(match[1]) + } + if (reEnd.test(text)) { + client.disconnect() + resolve(keys) + } + }) + } catch (error) { + reject(error) + } + }) + + return Promise.race([fetchPromise, timeoutPromise]).then((result) => { + clearTimeout(timeoutHandle) + return result + }) +} + +},{"irc-upd":"irc-upd","validator":"/home/yarmo/dev/doip/doipjs/node_modules/validator/index.js"}],"/home/yarmo/dev/doip/doipjs/src/fetcher/matrix.js":[function(require,module,exports){ +/* +Copyright 2021 Yarmo Mackenbach + +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. +*/ +const bent = require('bent') +const bentReq = bent('GET') +const validator = require('validator') + +/** + * @module fetcher/matrix + */ + +/** + * The request's timeout value in milliseconds + * @constant {number} timeout + */ +module.exports.timeout = 5000 + +/** + * Execute a fetch request + * @function + * @async + * @param {object} data - Data used in the request + * @param {string} data.eventId - The identifier of the targeted post + * @param {string} data.roomId - The identifier of the room containing the targeted post + * @param {object} opts - Options used to enable the request + * @param {string} opts.claims.matrix.instance - The server hostname on which the library can log in + * @param {string} opts.claims.matrix.accessToken - The access token required to identify the library ({@link https://www.matrix.org/docs/guides/client-server-api|Matrix docs}) + * @returns {object} + */ +module.exports.fn = async (data, opts) => { + let timeoutHandle + const timeoutPromise = new Promise((resolve, reject) => { + timeoutHandle = setTimeout( + () => reject(new Error('Request was timed out')), + data.fetcherTimeout ? data.fetcherTimeout : module.exports.timeout + ) + }) + + const fetchPromise = new Promise((resolve, reject) => { + try { + validator.isFQDN(opts.claims.matrix.instance) + validator.isAscii(opts.claims.matrix.accessToken) + } catch (err) { + throw new Error(`Matrix fetcher was not set up properly (${err.message})`) + } + + const url = `https://${opts.claims.matrix.instance}/_matrix/client/r0/rooms/${data.roomId}/event/${data.eventId}?access_token=${opts.claims.matrix.accessToken}` + bentReq(url, null, { + Accept: 'application/json', + }) + .then(async (res) => { + return await res.json() + }) + .then((res) => { + resolve(res) + }) + .catch((error) => { + reject(error) + }) + }) + + return Promise.race([fetchPromise, timeoutPromise]).then((result) => { + clearTimeout(timeoutHandle) + return result + }) +} + +},{"bent":"/home/yarmo/dev/doip/doipjs/node_modules/bent/src/browser.js","validator":"/home/yarmo/dev/doip/doipjs/node_modules/validator/index.js"}],"/home/yarmo/dev/doip/doipjs/src/fetcher/twitter.js":[function(require,module,exports){ +/* +Copyright 2021 Yarmo Mackenbach + +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. +*/ +const bent = require('bent') +const bentReq = bent('GET') +const validator = require('validator') + +/** + * @module fetcher/twitter + */ + +/** + * The request's timeout value in milliseconds + * @constant {number} timeout + */ +module.exports.timeout = 5000 + +/** + * Execute a fetch request + * @function + * @async + * @param {object} data - Data used in the request + * @param {number|string} data.tweetId - Identifier of the tweet + * @param {object} opts - Options used to enable the request + * @param {string} opts.claims.twitter.bearerToken - The Twitter API's bearer token + * @returns {object} + */ +module.exports.fn = async (data, opts) => { + let timeoutHandle + const timeoutPromise = new Promise((resolve, reject) => { + timeoutHandle = setTimeout( + () => reject(new Error('Request was timed out')), + data.fetcherTimeout ? data.fetcherTimeout : module.exports.timeout + ) + }) + + const fetchPromise = new Promise((resolve, reject) => { + try { + validator.isAscii(opts.claims.twitter.bearerToken) + } catch (err) { + throw new Error( + `Twitter fetcher was not set up properly (${err.message})` + ) + } + + bentReq( + `https://api.twitter.com/1.1/statuses/show.json?id=${data.tweetId}&tweet_mode=extended`, + null, + { + Accept: 'application/json', + Authorization: `Bearer ${opts.claims.twitter.bearerToken}`, + } + ) + .then(async (data) => { + return await data.json() + }) + .then((data) => { + resolve(data.full_text) + }) + .catch((error) => { + reject(error) + }) + }) + + return Promise.race([fetchPromise, timeoutPromise]).then((result) => { + clearTimeout(timeoutHandle) + return result + }) +} + +},{"bent":"/home/yarmo/dev/doip/doipjs/node_modules/bent/src/browser.js","validator":"/home/yarmo/dev/doip/doipjs/node_modules/validator/index.js"}],"/home/yarmo/dev/doip/doipjs/src/fetcher/xmpp.js":[function(require,module,exports){ +(function (process){(function (){ +/* +Copyright 2021 Yarmo Mackenbach + +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. +*/ +const jsdom = require('jsdom') +const { client, xml } = require('@xmpp/client') +const debug = require('@xmpp/debug') +const validator = require('validator') + +/** + * @module fetcher/xmpp + */ + +/** + * The request's timeout value in milliseconds + * @constant {number} timeout + */ +module.exports.timeout = 5000 + +let xmpp = null, + iqCaller = null + +const xmppStart = async (service, username, password) => { + return new Promise((resolve, reject) => { + const xmpp = client({ + service: service, + username: username, + password: password, + }) + if (process.env.NODE_ENV !== 'production') { + debug(xmpp, true) + } + const { iqCaller } = xmpp + xmpp.start() + xmpp.on('online', (address) => { + resolve({ xmpp: xmpp, iqCaller: iqCaller }) + }) + xmpp.on('error', (error) => { + reject(error) + }) + }) +} + +/** + * Execute a fetch request + * @function + * @async + * @param {object} data - Data used in the request + * @param {string} data.id - The identifier of the targeted account + * @param {string} data.field - The vCard field to return (should be "note") + * @param {object} opts - Options used to enable the request + * @param {string} opts.claims.xmpp.service - The server hostname on which the library can log in + * @param {string} opts.claims.xmpp.username - The username used to log in + * @param {string} opts.claims.xmpp.password - The password used to log in + * @returns {object} + */ +module.exports.fn = async (data, opts) => { + let timeoutHandle + const timeoutPromise = new Promise((resolve, reject) => { + timeoutHandle = setTimeout( + () => reject(new Error('Request was timed out')), + data.fetcherTimeout ? data.fetcherTimeout : module.exports.timeout + ) + }) + + const fetchPromise = new Promise(async (resolve, reject) => { + try { + validator.isFQDN(opts.claims.xmpp.service) + validator.isAscii(opts.claims.xmpp.username) + validator.isAscii(opts.claims.xmpp.password) + } catch (err) { + throw new Error(`XMPP fetcher was not set up properly (${err.message})`) + } + + if (!xmpp || xmpp.status !== 'online') { + const xmppStartRes = await xmppStart( + opts.claims.xmpp.service, + opts.claims.xmpp.username, + opts.claims.xmpp.password + ) + xmpp = xmppStartRes.xmpp + iqCaller = xmppStartRes.iqCaller + } + + const response = await iqCaller.request( + xml('iq', { type: 'get', to: data.id }, xml('vCard', 'vcard-temp')), + 30 * 1000 + ) + + const vcardRow = response.getChild('vCard', 'vcard-temp').toString() + const dom = new jsdom.JSDOM(vcardRow) + + try { + let vcard + + switch (data.field.toLowerCase()) { + case 'desc': + case 'note': + vcard = dom.window.document.querySelector('note text') + if (!vcard) { + vcard = dom.window.document.querySelector('DESC') + } + if (vcard) { + vcard = vcard.textContent + } else { + throw new Error('No DESC or NOTE field found in vCard') + } + break + + default: + vcard = dom.window.document.querySelector(data).textContent + break + } + xmpp.stop() + resolve(vcard) + } catch (error) { + reject(error) + } + }) + + return Promise.race([fetchPromise, timeoutPromise]).then((result) => { + clearTimeout(timeoutHandle) + return result + }) +} + +}).call(this)}).call(this,require('_process')) +},{"@xmpp/client":"@xmpp/client","@xmpp/debug":"@xmpp/debug","_process":"/home/yarmo/dev/doip/doipjs/node_modules/process/browser.js","jsdom":"jsdom","validator":"/home/yarmo/dev/doip/doipjs/node_modules/validator/index.js"}],"/home/yarmo/dev/doip/doipjs/src/index.js":[function(require,module,exports){ +/* +Copyright 2021 Yarmo Mackenbach + +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. +*/ +const Claim = require('./claim') +const claimDefinitions = require('./claimDefinitions') +const proofs = require('./proofs') const keys = require('./keys') const signatures = require('./signatures') -const serviceproviders = require('./serviceproviders') +const enums = require('./enums') +const defaults = require('./defaults') const utils = require('./utils') -exports.claims = claims +exports.Claim = Claim +exports.claimDefinitions = claimDefinitions +exports.proofs = proofs exports.keys = keys exports.signatures = signatures -exports.serviceproviders = serviceproviders +exports.enums = enums +exports.defaults = defaults exports.utils = utils -},{"./claims":15,"./keys":17,"./serviceproviders":18,"./signatures":36,"./utils":37}],17:[function(require,module,exports){ +},{"./claim":"/home/yarmo/dev/doip/doipjs/src/claim.js","./claimDefinitions":"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/index.js","./defaults":"/home/yarmo/dev/doip/doipjs/src/defaults.js","./enums":"/home/yarmo/dev/doip/doipjs/src/enums.js","./keys":"/home/yarmo/dev/doip/doipjs/src/keys.js","./proofs":"/home/yarmo/dev/doip/doipjs/src/proofs.js","./signatures":"/home/yarmo/dev/doip/doipjs/src/signatures.js","./utils":"/home/yarmo/dev/doip/doipjs/src/utils.js"}],"/home/yarmo/dev/doip/doipjs/src/keys.js":[function(require,module,exports){ (function (global){(function (){ /* Copyright 2021 Yarmo Mackenbach @@ -2183,17 +10183,31 @@ 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. */ -const path = require('path') const bent = require('bent') const req = bent('GET') const validUrl = require('valid-url') const openpgp = (typeof window !== "undefined" ? window['openpgp'] : typeof global !== "undefined" ? global['openpgp'] : null) -const mergeOptions = require('merge-options') +const Claim = require('./claim') -const fetchHKP = (identifier, keyserverBaseUrl) => { +/** + * Functions related to the fetching and handling of keys + * @module keys + */ + +/** + * Fetch a public key using keyservers + * @function + * @param {string} identifier - Fingerprint or email address + * @param {string} [keyserverDomain=keys.openpgp.org] - Domain of the keyserver + * @returns {openpgp.key.Key} + * @example + * const key1 = doip.keys.fetchHKP('alice@domain.tld'); + * const key2 = doip.keys.fetchHKP('123abc123abc'); + */ + exports.fetchHKP = (identifier, keyserverDomain) => { return new Promise(async (resolve, reject) => { - keyserverBaseUrl = keyserverBaseUrl - ? `https://${keyserverBaseUrl}` + const keyserverBaseUrl = keyserverDomain + ? `https://${keyserverDomain}` : 'https://keys.openpgp.org' const hkp = new openpgp.HKP(keyserverBaseUrl) @@ -2222,7 +10236,15 @@ const fetchHKP = (identifier, keyserverBaseUrl) => { }) } -const fetchWKD = (identifier) => { +/** + * Fetch a public key using Web Key Directory + * @function + * @param {string} identifier - Identifier of format 'username@domain.tld` + * @returns {openpgp.key.Key} + * @example + * const key = doip.keys.fetchWKD('alice@domain.tld'); + */ +exports.fetchWKD = (identifier) => { return new Promise(async (resolve, reject) => { const wkd = new openpgp.WKD() const lookupOpts = { @@ -2246,7 +10268,16 @@ const fetchWKD = (identifier) => { }) } -const fetchKeybase = (username, fingerprint) => { +/** + * Fetch a public key from Keybase + * @function + * @param {string} username - Keybase username + * @param {string} fingerprint - Fingerprint of key + * @returns {openpgp.key.Key} + * @example + * const key = doip.keys.fetchKeybase('alice', '123abc123abc'); + */ +exports.fetchKeybase = (username, fingerprint) => { return new Promise(async (resolve, reject) => { const keyLink = `https://keybase.io/${username}/pgp_keys.asc?fingerprint=${fingerprint}` try { @@ -2278,7 +10309,21 @@ const fetchKeybase = (username, fingerprint) => { }) } -const fetchPlaintext = (rawKeyContent) => { +/** + * Get a public key from plaintext data + * @function + * @param {string} rawKeyContent - Plaintext ASCII-formatted public key data + * @returns {openpgp.key.Key} + * @example + * const plainkey = `-----BEGIN PGP PUBLIC KEY BLOCK----- + * + * mQINBF0mIsIBEADacleiyiV+z6FIunvLWrO6ZETxGNVpqM+WbBQKdW1BVrJBBolg + * [...] + * =6lib + * -----END PGP PUBLIC KEY BLOCK-----` + * const key = doip.keys.fetchPlaintext(plainkey); + */ +exports.fetchPlaintext = (rawKeyContent) => { return new Promise(async (resolve, reject) => { const publicKey = (await openpgp.key.readArmored(rawKeyContent)).keys[0] @@ -2286,23 +10331,17 @@ const fetchPlaintext = (rawKeyContent) => { }) } -const fetchSignature = (rawSignatureContent, keyserverBaseUrl) => { - return new Promise(async (resolve, reject) => { - let sig = await openpgp.signature.readArmored(rawSignatureContent) - if ('compressed' in sig.packets[0]) { - sig = sig.packets[0] - let sigContent = await openpgp.stream.readToEnd( - await sig.packets[1].getText() - ) - } - const sigUserId = sig.packets[0].signersUserId - const sigKeyId = await sig.packets[0].issuerKeyId.toHex() - - resolve(fetchHKP(sigUserId ? sigUserId : sigKeyId, keyserverBaseUrl)) - }) -} - -const fetchURI = (uri) => { +/** + * Fetch a public key using an URI + * @function + * @param {string} uri - URI that defines the location of the key + * @returns {openpgp.key.Key} + * @example + * const key1 = doip.keys.fetchURI('hkp:alice@domain.tld'); + * const key2 = doip.keys.fetchURI('hkp:123abc123abc'); + * const key3 = doip.keys.fetchURI('wkd:alice@domain.tld'); + */ +exports.fetchURI = (uri) => { return new Promise(async (resolve, reject) => { if (!validUrl.isUri(uri)) { reject('Invalid URI') @@ -2318,14 +10357,14 @@ const fetchURI = (uri) => { switch (match[1]) { case 'hkp': resolve( - fetchHKP(match[3] ? match[3] : match[2], match[3] ? match[2] : null) + exports.fetchHKP(match[3] ? match[3] : match[2], match[3] ? match[2] : null) ) break case 'wkd': - resolve(fetchWKD(match[2])) + resolve(exports.fetchWKD(match[2])) break case 'kb': - resolve(fetchKeybase(match[2], match.length >= 4 ? match[3] : null)) + resolve(exports.fetchKeybase(match[2], match.length >= 4 ? match[3] : null)) break default: reject('Invalid URI protocol') @@ -2334,16 +10373,28 @@ const fetchURI = (uri) => { }) } -const process = (publicKey) => { +/** + * Process a public key to get user data and claims + * @function + * @param {openpgp.key.Key} publicKey - The public key to process + * @returns {object} + * @example + * const key = doip.keys.fetchURI('hkp:alice@domain.tld'); + * const data = doip.keys.process(key); + * data.users[0].claims.forEach(claim => { + * console.log(claim.uri); + * }); + */ +exports.process = (publicKey) => { return new Promise(async (resolve, reject) => { - if (!publicKey) { + if (!publicKey || !(publicKey instanceof openpgp.key.Key)) { reject('Invalid public key') } + const fingerprint = await publicKey.primaryKey.getFingerprint() const primaryUser = await publicKey.getPrimaryUser() const users = publicKey.users - let primaryUserIndex, - usersOutput = [] + let usersOutput = [] users.forEach((user, i) => { usersOutput[i] = { @@ -2354,19 +10405,19 @@ const process = (publicKey) => { comment: user.userId ? user.userId.comment : null, isPrimary: primaryUser.index === i, }, + claims: [], } if ('selfCertifications' in user && user.selfCertifications.length > 0) { const notations = user.selfCertifications[0].rawNotations - usersOutput[i].notations = notations.map( + usersOutput[i].claims = notations.map( ({ name, value, humanReadable }) => { if (humanReadable && name === 'proof@metacode.biz') { - return openpgp.util.decode_utf8(value) + const notation = openpgp.util.decode_utf8(value) + return new Claim(notation, fingerprint) } } ) - } else { - usersOutput[i].notations = [] } }) @@ -2374,418 +10425,16 @@ const process = (publicKey) => { fingerprint: fingerprint, users: usersOutput, primaryUserIndex: primaryUser.index, - }) - }) -} - -const getUserData = (publicKey) => { - return new Promise(async (resolve, reject) => { - const keyData = await process(publicKey) - - resolve(keyData.users) - }) -} - -const getFingerprint = (publicKey) => { - return new Promise(async (resolve, reject) => { - const keyData = await process(publicKey) - - resolve(keyData.fingerprint) - }) -} - -exports.fetch = { - uri: fetchURI, - hkp: fetchHKP, - wkd: fetchWKD, - keybase: fetchKeybase, - plaintext: fetchPlaintext, - signature: fetchSignature, -} -exports.process = process -exports.getUserData = getUserData -exports.getFingerprint = getFingerprint - -}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"bent":1,"merge-options":7,"path":8,"valid-url":13}],18:[function(require,module,exports){ -/* -Copyright 2021 Yarmo Mackenbach - -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. -*/ -const bent = require('bent') -const req = bent('GET') -const utils = require('./utils') - -const list = [ - 'dns', - 'irc', - 'xmpp', - 'matrix', - 'twitter', - 'reddit', - 'liberapay', - 'hackernews', - 'lobsters', - 'devto', - 'gitea', - 'gitlab', - 'github', - 'mastodon', - 'fediverse', - 'discourse', - 'owncast', -] - -const data = { - dns: require('./serviceproviders/dns'), - irc: require('./serviceproviders/irc'), - xmpp: require('./serviceproviders/xmpp'), - matrix: require('./serviceproviders/matrix'), - twitter: require('./serviceproviders/twitter'), - reddit: require('./serviceproviders/reddit'), - liberapay: require('./serviceproviders/liberapay'), - hackernews: require('./serviceproviders/hackernews'), - lobsters: require('./serviceproviders/lobsters'), - devto: require('./serviceproviders/devto'), - gitea: require('./serviceproviders/gitea'), - gitlab: require('./serviceproviders/gitlab'), - github: require('./serviceproviders/github'), - mastodon: require('./serviceproviders/mastodon'), - fediverse: require('./serviceproviders/fediverse'), - discourse: require('./serviceproviders/discourse'), - owncast: require('./serviceproviders/owncast'), -} - -const match = (uri, opts) => { - let matches = [], - sp - - list.forEach((spName, i) => { - sp = data[spName] - if (sp.reURI.test(uri)) { - matches.push(sp.processURI(uri, opts)) - } - }) - - return matches -} - -const directRequestHandler = (spData, opts) => { - return new Promise(async (resolve, reject) => { - const url = spData.proof.fetch ? spData.proof.fetch : spData.proof.uri - if (!url) { - reject('No valid URI provided') - return - } - let res - - switch (spData.proof.format) { - case 'json': - req(url, null, { - Accept: 'application/json', - 'User-Agent': `doipjs/${require('../package.json').version}`, - }) - .then(async (res) => { - return await res.json() - }) - .then((res) => { - resolve(res) - }) - .catch((e) => { - reject(e) - }) - break - case 'text': - req(url) - .then(async (res) => { - return await res.text() - }) - .then((res) => { - resolve(res) - }) - .catch((e) => { - reject(e) - }) - break - default: - reject('No specified proof data format') - break - } - }) -} - -const proxyRequestHandler = (spData, opts) => { - return new Promise(async (resolve, reject) => { - const url = spData.proof.fetch ? spData.proof.fetch : spData.proof.uri - req(utils.generateProxyURL(spData.proof.format, url, opts), null, { - Accept: 'application/json', - }) - .then(async (res) => { - return await res.json() - }) - .then((res) => { - resolve(res.content) - }) - .catch((e) => { - reject(e) - }) - }) -} - -exports.list = list -exports.data = data -exports.match = match -exports.directRequestHandler = directRequestHandler -exports.proxyRequestHandler = proxyRequestHandler - -},{"../package.json":14,"./serviceproviders/devto":19,"./serviceproviders/discourse":20,"./serviceproviders/dns":21,"./serviceproviders/fediverse":22,"./serviceproviders/gitea":23,"./serviceproviders/github":24,"./serviceproviders/gitlab":25,"./serviceproviders/hackernews":26,"./serviceproviders/irc":27,"./serviceproviders/liberapay":28,"./serviceproviders/lobsters":29,"./serviceproviders/mastodon":30,"./serviceproviders/matrix":31,"./serviceproviders/owncast":32,"./serviceproviders/reddit":33,"./serviceproviders/twitter":34,"./serviceproviders/xmpp":35,"./utils":37,"bent":1}],19:[function(require,module,exports){ -/* -Copyright 2021 Yarmo Mackenbach - -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. -*/ -const reURI = /^https:\/\/dev\.to\/(.*)\/(.*)\/?/ - -const processURI = (uri, opts) => { - if (!opts) { - opts = {} - } - const match = uri.match(reURI) - - return { - serviceprovider: { - type: 'web', - name: 'devto', - }, - profile: { - display: match[1], - uri: `https://dev.to/${match[1]}`, - qr: null, - }, - proof: { - uri: uri, - fetch: `https://dev.to/api/articles/${match[1]}/${match[2]}`, - useProxy: true, - format: 'json', - }, - claim: { - fingerprint: null, - format: 'message', - path: ['body_markdown'], - relation: 'contains', - }, - customRequestHandler: null, - } -} - -const tests = [ - { - uri: 'https://dev.to/alice/post', - shouldMatch: true, - }, - { - uri: 'https://dev.to/alice/post/', - shouldMatch: true, - }, - { - uri: 'https://domain.org/alice/post', - shouldMatch: false, - }, -] - -exports.reURI = reURI -exports.processURI = processURI -exports.tests = tests - -},{}],20:[function(require,module,exports){ -/* -Copyright 2021 Yarmo Mackenbach - -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. -*/ -const reURI = /^https:\/\/(.*)\/u\/(.*)\/?/ - -const processURI = (uri, opts) => { - if (!opts) { - opts = {} - } - const match = uri.match(reURI) - - return { - serviceprovider: { - type: 'web', - name: 'discourse', - }, - profile: { - display: `${match[2]}@${match[1]}`, - uri: uri, - qr: null, - }, - proof: { - uri: uri, - fetch: `https://${match[1]}/u/${match[2]}.json`, - useProxy: true, - format: 'json', - }, - claim: { - fingerprint: null, - format: 'message', - path: ['user', 'bio_raw'], - relation: 'contains', - }, - customRequestHandler: null, - } -} - -const tests = [ - { - uri: 'https://domain.org/u/alice', - shouldMatch: true, - }, - { - uri: 'https://domain.org/u/alice/', - shouldMatch: true, - }, - { - uri: 'https://domain.org/alice', - shouldMatch: false, - }, -] - -exports.reURI = reURI -exports.processURI = processURI -exports.tests = tests - -},{}],21:[function(require,module,exports){ -/* -Copyright 2021 Yarmo Mackenbach - -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. -*/ -const dns = require('dns') -const bent = require('bent') -const req = bent('GET') -const utils = require('../utils') -const reURI = /^dns:([a-zA-Z0-9\.\-\_]*)(?:\?(.*))?/ - -const customRequestHandler = async (spData, opts) => { - if ('resolveTxt' in dns) { - const prom = async () => { - return new Promise((resolve, reject) => { - dns.resolveTxt(spData.profile.display, (err, records) => { - if (err) reject(err) - resolve(records) - }) - }) - } - return { - hostname: spData.profile.display, - records: { - txt: await prom(), + key: { + data: publicKey, + fetchMethod: null, + uri: null, }, - } - } else { - const res = await req(spData.proof.uri, null, { - Accept: 'application/json', }) - const json = await res.json() - return json - } + }) } - -const processURI = (uri, opts) => { - if (!opts) { - opts = {} - } - const match = uri.match(reURI) - - return { - serviceprovider: { - type: 'web', - name: 'dns', - }, - profile: { - display: match[1], - uri: `https://${match[1]}`, - qr: null, - }, - proof: { - uri: utils.generateProxyURL('dns', match[1], opts), - fetch: null, - useProxy: false, - format: 'json', - }, - claim: { - fingerprint: null, - format: 'uri', - path: ['records', 'txt'], - relation: 'contains', - }, - customRequestHandler: customRequestHandler, - } -} - -const tests = [ - { - uri: 'dns:domain.org', - shouldMatch: true, - }, - { - uri: 'dns:domain.org?type=TXT', - shouldMatch: true, - }, - { - uri: 'https://domain.org', - shouldMatch: false, - }, -] - -exports.reURI = reURI -exports.processURI = processURI -exports.tests = tests - -},{"../utils":37,"bent":1,"dns":3}],22:[function(require,module,exports){ +}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./claim":"/home/yarmo/dev/doip/doipjs/src/claim.js","bent":"/home/yarmo/dev/doip/doipjs/node_modules/bent/src/browser.js","valid-url":"/home/yarmo/dev/doip/doipjs/node_modules/valid-url/index.js"}],"/home/yarmo/dev/doip/doipjs/src/proofs.js":[function(require,module,exports){ /* Copyright 2021 Yarmo Mackenbach @@ -2801,1090 +10450,188 @@ 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. */ -const reURI = /^https:\/\/(.*)\/users\/(.*)\/?/ +const jsEnv = require('browser-or-node') +const fetcher = require('./fetcher') +const utils = require('./utils') +const E = require('./enums') -const processURI = (uri, opts) => { - if (!opts) { - opts = {} +/** + * @module proofs + */ + +/** + * Delegate the proof request to the correct fetcher. + * This method uses the current environment (browser/node), certain values from + * the `data` parameter and the proxy policy set in the `opts` parameter to + * choose the right approach to fetch the proof. An error will be thrown if no + * approach is possible. + * @async + * @param {object} data - Data from a claim definition + * @param {object} opts - Options to enable the request + * @returns {Promise} + */ +const fetch = (data, opts) => { + switch (data.proof.request.fetcher) { + case E.Fetcher.HTTP: + data.proof.request.data.format = data.proof.request.format + break + + default: + break } - const match = uri.match(reURI) - return { - serviceprovider: { - type: 'web', - name: 'fediverse', - }, - profile: { - display: `@${match[2]}@${match[1]}`, - uri: uri, - qr: null, - }, - proof: { - uri: uri, - fetch: null, - useProxy: false, - format: 'json', - }, - claim: { - fingerprint: null, - format: 'fingerprint', - path: ['summary'], - relation: 'contains', - }, - customRequestHandler: null, + if (jsEnv.isNode) { + return handleNodeRequests(data, opts) + } + + return handleBrowserRequests(data, opts) +} + +const handleBrowserRequests = (data, opts) => { + switch (opts.proxy.policy) { + case E.ProxyPolicy.ALWAYS: + return createProxyRequestPromise(data, opts) + break + + case E.ProxyPolicy.NEVER: + switch (data.proof.request.access) { + case E.ProofAccess.GENERIC: + case E.ProofAccess.GRANTED: + return createDefaultRequestPromise(data, opts) + break + case E.ProofAccess.NOCORS: + case E.ProofAccess.SERVER: + throw new Error( + 'Impossible to fetch proof (bad combination of service access and proxy policy)' + ) + break + default: + throw new Error('Invalid proof access value') + break + } + break + + case E.ProxyPolicy.ADAPTIVE: + switch (data.proof.request.access) { + case E.ProofAccess.GENERIC: + return createDefaultRequestPromise(data, opts) + break + case E.ProofAccess.NOCORS: + return createProxyRequestPromise(data, opts) + break + case E.ProofAccess.GRANTED: + return createFallbackRequestPromise(data, opts) + break + case E.ProofAccess.SERVER: + throw new Error( + 'Impossible to fetch proof (bad combination of service access and proxy policy)' + ) + break + default: + throw new Error('Invalid proof access value') + break + } + break + + default: + throw new Error('Invalid proxy policy') + break } } -const tests = [ - { - uri: 'https://domain.org/users/alice', - shouldMatch: true, - }, - { - uri: 'https://domain.org/users/alice/', - shouldMatch: true, - }, - { - uri: 'https://domain.org/alice', - shouldMatch: false, - }, -] +const handleNodeRequests = (data, opts) => { + switch (opts.proxy.policy) { + case E.ProxyPolicy.ALWAYS: + return createProxyRequestPromise(data, opts) + break -exports.reURI = reURI -exports.processURI = processURI -exports.tests = tests + case E.ProxyPolicy.NEVER: + return createDefaultRequestPromise(data, opts) + break -},{}],23:[function(require,module,exports){ -/* -Copyright 2021 Yarmo Mackenbach + case E.ProxyPolicy.ADAPTIVE: + return createFallbackRequestPromise(data, opts) + break -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. -*/ -const reURI = /^https:\/\/(.*)\/(.*)\/gitea_proof\/?/ - -const processURI = (uri, opts) => { - if (!opts) { - opts = {} - } - const match = uri.match(reURI) - - return { - serviceprovider: { - type: 'web', - name: 'gitea', - }, - profile: { - display: `${match[2]}@${match[1]}`, - uri: `https://${match[1]}/${match[2]}`, - qr: null, - }, - proof: { - uri: uri, - fetch: `https://${match[1]}/api/v1/repos/${match[2]}/gitea_proof`, - useProxy: true, - format: 'json', - }, - claim: { - fingerprint: null, - format: 'message', - path: ['description'], - relation: 'equals', - }, - customRequestHandler: null, + default: + throw new Error('Invalid proxy policy') + break } } -const tests = [ - { - uri: 'https://domain.org/alice/gitea_proof', - shouldMatch: true, - }, - { - uri: 'https://domain.org/alice/gitea_proof/', - shouldMatch: true, - }, - { - uri: 'https://domain.org/alice/other_proof', - shouldMatch: false, - }, -] - -exports.reURI = reURI -exports.processURI = processURI -exports.tests = tests - -},{}],24:[function(require,module,exports){ -/* -Copyright 2021 Yarmo Mackenbach - -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. -*/ -const reURI = /^https:\/\/gist\.github\.com\/(.*)\/(.*)\/?/ - -const processURI = (uri, opts) => { - if (!opts) { - opts = {} - } - const match = uri.match(reURI) - - return { - serviceprovider: { - type: 'web', - name: 'github', - }, - profile: { - display: match[1], - uri: `https://github.com/${match[1]}`, - qr: null, - }, - proof: { - uri: uri, - fetch: `https://api.github.com/gists/${match[2]}`, - useProxy: false, - format: 'json', - }, - claim: { - fingerprint: null, - format: 'message', - path: ['files', 'openpgp.md', 'content'], - relation: 'contains', - }, - customRequestHandler: null, - } +const createDefaultRequestPromise = (data, opts) => { + return new Promise((resolve, reject) => { + fetcher[data.proof.request.fetcher] + .fn(data.proof.request.data, opts) + .then((res) => { + return resolve({ + fetcher: data.proof.request.fetcher, + data: data, + viaProxy: false, + result: res, + }) + }) + .catch((err) => { + return reject(err) + }) + }) } -const tests = [ - { - uri: 'https://gist.github.com/Alice/123456789', - shouldMatch: true, - }, - { - uri: 'https://gist.github.com/Alice/123456789/', - shouldMatch: true, - }, - { - uri: 'https://domain.org/Alice/123456789', - shouldMatch: false, - }, -] - -exports.reURI = reURI -exports.processURI = processURI -exports.tests = tests - -},{}],25:[function(require,module,exports){ -/* -Copyright 2021 Yarmo Mackenbach - -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. -*/ -const bent = require('bent') -const req = bent('GET') - -const reURI = /^https:\/\/(.*)\/(.*)\/gitlab_proof\/?/ - -const customRequestHandler = async (spData, opts) => { - const match = spData.proof.uri.match(reURI) - - const urlUser = `https://${match[1]}/api/v4/users?username=${match[2]}` - let resUser - try { - resUser = await req(urlUser, null, { Accept: 'application/json' }) - } catch (e) { - resUser = await req(utils.generateProxyURL('web', urlUser, opts), null, { - Accept: 'application/json', - }) - } - const jsonUser = await resUser.json() - - const user = jsonUser.find((user) => user.username === match[2]) - if (!user) { - throw new Error(`No user with username ${match[2]}`) - } - - const urlProject = `https://${match[1]}/api/v4/users/${user.id}/projects` - let resProject - try { - resProject = await req(urlProject, null, { Accept: 'application/json' }) - } catch (e) { - resProject = await req( - utils.generateProxyURL('web', urlProject, opts), - null, - { Accept: 'application/json' } - ) - } - const jsonProject = await resProject.json() - - const project = jsonProject.find((proj) => proj.path === 'gitlab_proof') - if (!project) { - throw new Error(`No project at ${spData.proof.uri}`) - } - - return project -} - -const processURI = (uri, opts) => { - if (!opts) { - opts = {} - } - const match = uri.match(reURI) - - return { - serviceprovider: { - type: 'web', - name: 'gitlab', - }, - profile: { - display: `${match[2]}@${match[1]}`, - uri: `https://${match[1]}/${match[2]}`, - qr: null, - }, - proof: { - uri: uri, - fetch: null, - useProxy: false, - format: 'json', - }, - claim: { - fingerprint: null, - format: 'message', - path: ['description'], - relation: 'equals', - }, - customRequestHandler: customRequestHandler, - } -} - -const tests = [ - { - uri: 'https://gitlab.domain.org/alice/gitlab_proof', - shouldMatch: true, - }, - { - uri: 'https://gitlab.domain.org/alice/gitlab_proof/', - shouldMatch: true, - }, - { - uri: 'https://domain.org/alice/other_proof', - shouldMatch: false, - }, -] - -exports.reURI = reURI -exports.processURI = processURI -exports.tests = tests - -},{"bent":1}],26:[function(require,module,exports){ -/* -Copyright 2021 Yarmo Mackenbach - -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. -*/ -const reURI = /^https:\/\/news\.ycombinator\.com\/user\?id=(.*)\/?/ - -const processURI = (uri, opts) => { - if (!opts) { - opts = {} - } - const match = uri.match(reURI) - - return { - serviceprovider: { - type: 'web', - name: 'hackernews', - }, - profile: { - display: match[1], - uri: uri, - qr: null, - }, - proof: { - uri: `https://hacker-news.firebaseio.com/v0/user/${match[1]}.json`, - fetch: null, - useProxy: true, - format: 'json', - }, - claim: { - fingerprint: null, - format: 'uri', - path: ['about'], - relation: 'contains', - }, - customRequestHandler: null, - } -} - -const tests = [ - { - uri: 'https://news.ycombinator.com/user?id=Alice', - shouldMatch: true, - }, - { - uri: 'https://news.ycombinator.com/user?id=Alice/', - shouldMatch: true, - }, - { - uri: 'https://domain.org/user?id=Alice', - shouldMatch: false, - }, -] - -exports.reURI = reURI -exports.processURI = processURI -exports.tests = tests - -},{}],27:[function(require,module,exports){ -/* -Copyright 2021 Yarmo Mackenbach - -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. -*/ -const utils = require('../utils') -const reURI = /^irc\:\/\/(.*)\/([a-zA-Z0-9]*)/ - -const processURI = (uri, opts) => { - if (!opts) { - opts = {} - } - const match = uri.match(reURI) - - return { - serviceprovider: { - type: 'communication', - name: 'irc', - }, - profile: { - display: `irc://${match[1]}/${match[2]}`, - uri: uri, - qr: null, - }, - proof: { - uri: utils.generateProxyURL('irc', [match[1], match[2]], opts), - fetch: null, - useProxy: false, - format: 'json', - }, - claim: { - fingerprint: null, - format: 'uri', - path: ['data'], - relation: 'contains', - }, - customRequestHandler: null, - } -} - -const tests = [ - { - uri: 'irc://chat.ircserver.org/Alice1', - shouldMatch: true, - }, - { - uri: 'irc://chat.ircserver.org/alice?param=123', - shouldMatch: true, - }, - { - uri: 'https://chat.ircserver.org/alice', - shouldMatch: false, - }, -] - -exports.reURI = reURI -exports.processURI = processURI -exports.tests = tests - -},{"../utils":37}],28:[function(require,module,exports){ -/* -Copyright 2021 Yarmo Mackenbach - -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. -*/ -const reURI = /^https:\/\/liberapay\.com\/(.*)\/?/ - -const processURI = (uri, opts) => { - if (!opts) { - opts = {} - } - const match = uri.match(reURI) - - return { - serviceprovider: { - type: 'web', - name: 'liberapay', - }, - profile: { - display: match[1], - uri: uri, - qr: null, - }, - proof: { - uri: uri, - fetch: `https://liberapay.com/${match[1]}/public.json`, - useProxy: false, - format: 'json', - }, - claim: { - fingerprint: null, - format: 'message', - path: ['statements', 'content'], - relation: 'contains', - }, - customRequestHandler: null, - } -} - -const tests = [ - { - uri: 'https://liberapay.com/alice', - shouldMatch: true, - }, - { - uri: 'https://liberapay.com/alice/', - shouldMatch: true, - }, - { - uri: 'https://domain.org/alice', - shouldMatch: false, - }, -] - -exports.reURI = reURI -exports.processURI = processURI -exports.tests = tests - -},{}],29:[function(require,module,exports){ -/* -Copyright 2021 Yarmo Mackenbach - -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. -*/ -const reURI = /^https:\/\/lobste\.rs\/u\/(.*)\/?/ - -const processURI = (uri, opts) => { - if (!opts) { - opts = {} - } - const match = uri.match(reURI) - - return { - serviceprovider: { - type: 'web', - name: 'lobsters', - }, - profile: { - display: match[1], - uri: uri, - qr: null, - }, - proof: { - uri: `https://lobste.rs/u/${match[1]}.json`, - fetch: null, - useProxy: true, - format: 'json', - }, - claim: { - fingerprint: null, - format: 'message', - path: ['about'], - relation: 'contains', - }, - customRequestHandler: null, - } -} - -const tests = [ - { - uri: 'https://lobste.rs/u/Alice', - shouldMatch: true, - }, - { - uri: 'https://lobste.rs/u/Alice/', - shouldMatch: true, - }, - { - uri: 'https://domain.org/u/Alice', - shouldMatch: false, - }, -] - -exports.reURI = reURI -exports.processURI = processURI -exports.tests = tests - -},{}],30:[function(require,module,exports){ -/* -Copyright 2021 Yarmo Mackenbach - -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. -*/ -const reURI = /^https:\/\/(.*)\/@(.*)\/?/ - -const processURI = (uri, opts) => { - if (!opts) { - opts = {} - } - const match = uri.match(reURI) - - return { - serviceprovider: { - type: 'web', - name: 'mastodon', - }, - profile: { - display: `@${match[2]}@${match[1]}`, - uri: uri, - qr: null, - }, - proof: { - uri: uri, - fetch: null, - useProxy: false, - format: 'json', - }, - claim: { - fingerprint: null, - format: 'fingerprint', - path: ['attachment', 'value'], - relation: 'contains', - }, - customRequestHandler: null, - } -} - -const tests = [ - { - uri: 'https://domain.org/@alice', - shouldMatch: true, - }, - { - uri: 'https://domain.org/@alice/', - shouldMatch: true, - }, - { - uri: 'https://domain.org/alice', - shouldMatch: false, - }, -] - -exports.reURI = reURI -exports.processURI = processURI -exports.tests = tests - -},{}],31:[function(require,module,exports){ -/* -Copyright 2021 Yarmo Mackenbach - -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. -*/ -const bent = require('bent') -const req = bent('GET') -const queryString = require('query-string') -const utils = require('../utils') -const reURI = /^matrix\:u\/(\@[^:]*\:[^?]*)(\?.*)?/ - -const processURI = (uri, opts) => { - if (!opts) { - opts = {} - } - const match = uri.match(reURI) - - let profileUrl = null, - eventUrl = null, - proofUrl = null - - if (match[2]) { - const params = queryString.parse(match[2]) - if ('org.keyoxide.e' in params && 'org.keyoxide.r' in params) { - profileUrl = `https://matrix.to/#/${match[1]}` - eventUrl = `https://matrix.to/#/${params['org.keyoxide.r']}/${params['org.keyoxide.e']}` - proofUrl = utils.generateProxyURL( - 'matrix', - [params['org.keyoxide.r'], params['org.keyoxide.e']], +const createProxyRequestPromise = (data, opts) => { + return new Promise((resolve, reject) => { + let proxyUrl + try { + proxyUrl = utils.generateProxyURL( + data.proof.request.fetcher, + data.proof.request.data, opts ) + } catch (err) { + reject(err) } - } - return { - serviceprovider: { - type: 'communication', - name: 'matrix', - }, - profile: { - display: match[1], - uri: profileUrl, - qr: null, - }, - proof: { - uri: eventUrl, - fetch: proofUrl, - useProxy: false, - format: 'json', - }, - claim: { - fingerprint: null, - format: 'message', - path: ['data', 'content', 'body'], - relation: 'contains', - }, - customRequestHandler: null, - } -} - -const tests = [ - { - uri: 'matrix:u/@alice:matrix.domain.org', - shouldMatch: true, - }, - { - uri: - 'matrix:u/@alice:matrix.domain.org?org.keyoxide.r=!123:domain.org&org.keyoxide.e=$123', - shouldMatch: true, - }, - { - uri: 'xmpp:alice@domain.org', - shouldMatch: false, - }, - { - uri: 'https://domain.org/@alice', - shouldMatch: false, - }, -] - -exports.reURI = reURI -exports.processURI = processURI -exports.tests = tests - -},{"../utils":37,"bent":1,"query-string":10}],32:[function(require,module,exports){ -/* -Copyright 2021 Yarmo Mackenbach - -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. -*/ -const bent = require('bent') -const req = bent('GET') - -const reURI = /^https:\/\/(.*)/ - -const processURI = (uri, opts) => { - if (!opts) { - opts = {} - } - const match = uri.match(reURI) - - return { - serviceprovider: { - type: 'web', - name: 'owncast', - }, - profile: { - display: match[1], - uri: uri, - qr: null, - }, - proof: { - uri: `${uri}/api/config`, - fetch: null, - useProxy: false, - format: 'json', - }, - claim: { - fingerprint: null, - format: 'fingerprint', - path: ['socialHandles', 'url'], - relation: 'contains', - }, - customRequestHandler: null, - } -} - -const tests = [ - { - uri: 'https://live.domain.org', - shouldMatch: true, - }, - { - uri: 'https://live.domain.org/', - shouldMatch: true, - }, - { - uri: 'https://domain.org/live', - shouldMatch: true, - }, - { - uri: 'https://domain.org/live/', - shouldMatch: true, - }, -] - -exports.reURI = reURI -exports.processURI = processURI -exports.tests = tests - -},{"bent":1}],33:[function(require,module,exports){ -/* -Copyright 2021 Yarmo Mackenbach - -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. -*/ -const reURI = /^https:\/\/(?:www\.)?reddit\.com\/user\/(.*)\/comments\/(.*)\/(.*)\/?/ - -const processURI = (uri, opts) => { - if (!opts) { - opts = {} - } - const match = uri.match(reURI) - - return { - serviceprovider: { - type: 'web', - name: 'reddit', - }, - profile: { - display: match[1], - uri: `https://www.reddit.com/user/${match[1]}`, - qr: null, - }, - proof: { - uri: uri, - fetch: `https://www.reddit.com/user/${match[1]}/comments/${match[2]}.json`, - useProxy: true, - format: 'json', - }, - claim: { - fingerprint: null, - format: 'message', - path: ['data', 'children', 'data', 'selftext'], - relation: 'contains', - }, - customRequestHandler: null, - } -} - -const tests = [ - { - uri: 'https://www.reddit.com/user/Alice/comments/123456/post', - shouldMatch: true, - }, - { - uri: 'https://www.reddit.com/user/Alice/comments/123456/post/', - shouldMatch: true, - }, - { - uri: 'https://reddit.com/user/Alice/comments/123456/post', - shouldMatch: true, - }, - { - uri: 'https://reddit.com/user/Alice/comments/123456/post/', - shouldMatch: true, - }, - { - uri: 'https://domain.org/user/Alice/comments/123456/post', - shouldMatch: false, - }, -] - -exports.reURI = reURI -exports.processURI = processURI -exports.tests = tests - -},{}],34:[function(require,module,exports){ -/* -Copyright 2021 Yarmo Mackenbach - -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. -*/ -const bent = require('bent') -const req = bent('GET') -const serviceproviders = require('../serviceproviders') -const utils = require('../utils') -const reURI = /^https:\/\/twitter\.com\/(.*)\/status\/([0-9]*)(?:\?.*)?/ - -const customRequestHandler = async (spData, opts) => { - const match = spData.proof.uri.match(reURI) - - // Attempt direct verification if policy allows it - if (opts.proxyPolicy !== 'always') { - if ('twitterBearerToken' in opts && opts.twitterBearerToken) { - const res = await req( - `https://api.twitter.com/1.1/statuses/show.json?id=${match[2]}`, - null, - { - Accept: 'application/json', - Authorization: `Bearer ${opts.twitterBearerToken}`, - } - ) - const json = await res.json() - return json.text - } else if ('nitterInstance' in opts && opts.nitterInstance) { - spData.proof.fetch = `https://${opts.nitterInstance}/${match[1]}/status/${match[2]}` - const res = await serviceproviders.proxyRequestHandler(spData, opts) - return res + const requestData = { + url: proxyUrl, + format: data.proof.request.format, + fetcherTimeout: fetcher[data.proof.request.fetcher].timeout, } - } - - // Attempt proxy verification if policy allows it - if (opts.proxyPolicy !== 'never' && spData.proof.fetch) { - return req(utils.generateProxyURL('twitter', match[2], opts), null, { - Accept: 'application/json', - }) - .then(async (res) => { - return await res.json() - }) + fetcher.http + .fn(requestData, opts) .then((res) => { - return res.data.text + return resolve({ + fetcher: 'http', + data: data, + viaProxy: true, + result: res, + }) }) - .catch((e) => { - reject(e) + .catch((err) => { + return reject(err) }) - } - - // No verification - return null + }) } -const processURI = (uri, opts) => { - if (!opts) { - opts = {} - } - const match = uri.match(reURI) - - return { - serviceprovider: { - type: 'web', - name: 'twitter', - }, - profile: { - display: `@${match[1]}`, - uri: `https://twitter.com/${match[1]}`, - qr: null, - }, - proof: { - uri: uri, - fetch: utils.generateProxyURL('twitter', match[2], opts), - useProxy: false, - format: 'text', - }, - claim: { - fingerprint: null, - format: 'message', - path: [], - relation: 'contains', - }, - customRequestHandler: customRequestHandler, - } +const createFallbackRequestPromise = (data, opts) => { + return new Promise((resolve, reject) => { + createDefaultRequestPromise(data, opts) + .then((res) => { + return resolve(res) + }) + .catch((err1) => { + createProxyRequestPromise(data, opts) + .then((res) => { + return resolve(res) + }) + .catch((err2) => { + return reject([err1, err2]) + }) + }) + }) } -const tests = [ - { - uri: 'https://twitter.com/alice/status/1234567890123456789', - shouldMatch: true, - }, - { - uri: 'https://twitter.com/alice/status/1234567890123456789/', - shouldMatch: true, - }, - { - uri: 'https://domain.org/alice/status/1234567890123456789', - shouldMatch: false, - }, -] +exports.fetch = fetch -exports.reURI = reURI -exports.processURI = processURI -exports.tests = tests - -},{"../serviceproviders":18,"../utils":37,"bent":1}],35:[function(require,module,exports){ -/* -Copyright 2021 Yarmo Mackenbach - -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. -*/ -const utils = require('../utils') -const reURI = /^xmpp:([a-zA-Z0-9\.\-\_]*)@([a-zA-Z0-9\.\-\_]*)(?:\?(.*))?/ - -const processURI = (uri, opts) => { - if (!opts) { - opts = {} - } - const match = uri.match(reURI) - - return { - serviceprovider: { - type: 'communication', - name: 'xmpp', - }, - profile: { - display: `${match[1]}@${match[2]}`, - uri: uri, - qr: uri, - }, - proof: { - uri: utils.generateProxyURL('xmpp', `${match[1]}@${match[2]}`, opts), - fetch: null, - useProxy: false, - format: 'json', - }, - claim: { - fingerprint: null, - format: 'message', - path: [], - relation: 'contains', - }, - customRequestHandler: null, - } -} - -const tests = [ - { - uri: 'xmpp:alice@domain.org', - shouldMatch: true, - }, - { - uri: 'xmpp:alice@domain.org?omemo-sid-123456789=A1B2C3D4E5F6G7H8I9', - shouldMatch: true, - }, - { - uri: 'https://domain.org', - shouldMatch: false, - }, -] - -exports.reURI = reURI -exports.processURI = processURI -exports.tests = tests - -},{"../utils":37}],36:[function(require,module,exports){ +},{"./enums":"/home/yarmo/dev/doip/doipjs/src/enums.js","./fetcher":"/home/yarmo/dev/doip/doipjs/src/fetcher/index.js","./utils":"/home/yarmo/dev/doip/doipjs/src/utils.js","browser-or-node":"/home/yarmo/dev/doip/doipjs/node_modules/browser-or-node/lib/index.js"}],"/home/yarmo/dev/doip/doipjs/src/signatures.js":[function(require,module,exports){ (function (global){(function (){ /* Copyright 2021 Yarmo Mackenbach @@ -3902,20 +10649,42 @@ See the License for the specific language governing permissions and limitations under the License. */ const openpgp = (typeof window !== "undefined" ? window['openpgp'] : typeof global !== "undefined" ? global['openpgp'] : null) -const mergeOptions = require('merge-options') -const claims = require('./claims') +const Claim = require('./claim') const keys = require('./keys') -const verify = (signature, opts) => { +/** + * @module signatures + */ + +/** + * Extract data from a signature and fetch the associated key + * @async + * @param {string} signature - The plaintext signature to process + * @returns {Promise} + */ +const process = (signature) => { return new Promise(async (resolve, reject) => { - let errors = [], - sigData + let sigData, + result = { + fingerprint: null, + users: [ + { + userData: {}, + claims: [], + }, + ], + primaryUserIndex: null, + key: { + data: null, + fetchMethod: null, + uri: null, + }, + } try { sigData = await openpgp.cleartext.readArmored(signature) } catch (error) { - errors.push('invalid_signature') - reject({ errors: errors }) + reject(new Error('invalid_signature')) return } @@ -3926,7 +10695,6 @@ const verify = (signature, opts) => { 'https://keys.openpgp.org/' const text = sigData.getText() let sigKeys = [] - let sigClaims = [] text.split('\n').forEach((line, i) => { const match = line.match(/^([a-zA-Z0-9]*)\=(.*)$/i) @@ -3939,7 +10707,7 @@ const verify = (signature, opts) => { break case 'proof': - sigClaims.push(match[2]) + result.users[0].claims.push(new Claim(match[2])) break default: @@ -3947,71 +10715,75 @@ const verify = (signature, opts) => { } }) - let keyData, keyUri - // Try overruling key if (sigKeys.length > 0) { try { - keyUri = sigKeys[0] - keyData = await keys.fetch.uri(keyUri) + result.key.uri = sigKeys[0] + result.key.data = await keys.fetchURI(result.key.uri) + result.key.fetchMethod = result.key.uri.split(':')[0] } catch (e) {} } // Try WKD - if (!keyData && signersUserId) { + if (!result.key.data && signersUserId) { try { - keyUri = `wkd:${signersUserId}` - keyData = await keys.fetch.uri(keyUri) + result.key.uri = `wkd:${signersUserId}` + result.key.data = await keys.fetchURI(result.key.uri) + result.key.fetchMethod = 'wkd' } catch (e) {} } // Try HKP - if (!keyData) { + if (!result.key.data) { try { const match = preferredKeyServer.match(/^(.*\:\/\/)?([^/]*)(?:\/)?$/i) - keyUri = `hkp:${match[2]}:${issuerKeyId ? issuerKeyId : signersUserId}` - keyData = await keys.fetch.uri(keyUri) + result.key.uri = `hkp:${match[2]}:${ + issuerKeyId ? issuerKeyId : signersUserId + }` + result.key.data = await keys.fetchURI(result.key.uri) + result.key.fetchMethod = 'hkp' } catch (e) { - errors.push('key_not_found') - reject({ errors: errors }) + reject(new Error('key_not_found')) return } } - const fingerprint = keyData.keyPacket.getFingerprint() + result.fingerprint = result.key.data.keyPacket.getFingerprint() - try { - const sigVerification = await sigData.verify([keyData]) - await sigVerification[0].verified - } catch (e) { - errors.push('invalid_signature_verification') - reject({ errors: errors }) - return + result.users[0].claims.forEach((claim) => { + claim.fingerprint = result.fingerprint + }) + + const primaryUserData = await result.key.data.getPrimaryUser() + let userData + + if (signersUserId) { + result.key.data.users.forEach((user) => { + if (user.userId.email == signersUserId) { + userData = user + } + }) + } + if (!userData) { + userData = primaryUserData.user } - const claimVerifications = await claims.verify(sigClaims, fingerprint, opts) + result.users[0].userData = { + id: userData.userId ? userData.userId.userid : null, + name: userData.userId ? userData.userId.name : null, + email: userData.userId ? userData.userId.email : null, + comment: userData.userId ? userData.userId.comment : null, + isPrimary: primaryUserData.user.userId.userid === userData.userId.userid, + } - resolve({ - errors: errors, - signature: { - data: sigData.signature, - issuerKeyId: issuerKeyId, - signersUserId: signersUserId, - preferredKeyServer: preferredKeyServer, - }, - publicKey: { - data: keyData, - uri: keyUri, - fingerprint: fingerprint, - }, - text: text, - claims: claimVerifications, - }) + result.primaryUserIndex = result.users[0].userData.isPrimary ? 0 : null + + resolve(result) }) } -exports.verify = verify +exports.process = process }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./claims":15,"./keys":17,"merge-options":7}],37:[function(require,module,exports){ +},{"./claim":"/home/yarmo/dev/doip/doipjs/src/claim.js","./keys":"/home/yarmo/dev/doip/doipjs/src/keys.js"}],"/home/yarmo/dev/doip/doipjs/src/utils.js":[function(require,module,exports){ /* Copyright 2021 Yarmo Mackenbach @@ -4027,37 +10799,54 @@ 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. */ -const generateProxyURL = (type, urlElements, opts) => { - if (!opts || !opts.doipProxyHostname) { - return null - } - let addParam = '' - if (type == 'xmpp') { - addParam += '/DESC' +const validator = require('validator') +const E = require('./enums') + +/** + * @module utils + */ + +/** + * Generate an URL to request data from a proxy server + * @param {string} type - The name of the fetcher the proxy must use + * @param {object} data - The data the proxy must provide to the fetcher + * @param {object} opts - Options to enable the request + * @param {object} opts.proxy.hostname - The hostname of the proxy server + * @returns {string} + */ +const generateProxyURL = (type, data, opts) => { + try { + validator.isFQDN(opts.proxy.hostname) + } catch (err) { + throw new Error(`Invalid proxy hostname`) } - if (!Array.isArray(urlElements)) { - urlElements = [urlElements] - } + let queryStrings = [] - urlElements = urlElements.map((x) => { - return encodeURIComponent(x) + Object.keys(data).forEach((key) => { + queryStrings.push(`${key}=${encodeURIComponent(data[key])}`) }) - return `https://${ - opts.doipProxyHostname - }/api/1/get/${type}/${urlElements.join('/')}${addParam}` + return `http://${opts.proxy.hostname}/api/2/get/${type}?${queryStrings.join( + '&' + )}` } +/** + * Generate the string that must be found in the proof to verify a claim + * @param {string} fingerprint - The fingerprint of the claim + * @param {number} format - The claim's format (see {@link module:enums~ClaimFormat|enums.ClaimFormat}) + * @returns {string} + */ const generateClaim = (fingerprint, format) => { switch (format) { - case 'uri': + case E.ClaimFormat.URI: return `openpgp4fpr:${fingerprint}` break - case 'message': + case E.ClaimFormat.MESSAGE: return `[Verifying my OpenPGP key: openpgp4fpr:${fingerprint}]` break - case 'fingerprint': + case E.ClaimFormat.FINGERPRINT: return fingerprint break default: @@ -4068,5 +10857,133 @@ const generateClaim = (fingerprint, format) => { exports.generateProxyURL = generateProxyURL exports.generateClaim = generateClaim -},{}]},{},[16])(16) +},{"./enums":"/home/yarmo/dev/doip/doipjs/src/enums.js","validator":"/home/yarmo/dev/doip/doipjs/node_modules/validator/index.js"}],"/home/yarmo/dev/doip/doipjs/src/verifications.js":[function(require,module,exports){ +/* +Copyright 2021 Yarmo Mackenbach + +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. +*/ +const utils = require('./utils') +const E = require('./enums') + +/** + * @module verifications + * @ignore + */ + +const runJSON = (proofData, checkPath, checkClaim, checkRelation) => { + let re + + if (!proofData) { + return false + } + + if (Array.isArray(proofData)) { + let result = false + proofData.forEach((item, i) => { + if (result) { + return + } + result = runJSON(item, checkPath, checkClaim, checkRelation) + }) + return result + } + + if (checkPath.length == 0) { + switch (checkRelation) { + default: + case E.ClaimRelation.CONTAINS: + re = new RegExp(checkClaim, 'gi') + return re.test(proofData.replace(/\r?\n|\r|\\/g, '')) + break + + case E.ClaimRelation.EQUALS: + return ( + proofData.replace(/\r?\n|\r|\\/g, '').toLowerCase() == + checkClaim.toLowerCase() + ) + break + + case E.ClaimRelation.ONEOF: + re = new RegExp(checkClaim, 'gi') + return re.test(proofData.join('|')) + break + } + } + + try { + checkPath[0] in proofData + } catch (e) { + throw new Error('err_json_structure_incorrect') + } + + return runJSON( + proofData[checkPath[0]], + checkPath.slice(1), + checkClaim, + checkRelation + ) +} + +/** + * Run the verification by finding the formatted fingerprint in the proof + * @param {object} proofData - The proof data + * @param {object} claimData - The claim data + * @param {string} fingerprint - The fingerprint + * @returns {object} + */ +const run = (proofData, claimData, fingerprint) => { + let res = { + result: false, + completed: false, + errors: [], + } + + switch (claimData.proof.request.format) { + case E.ProofFormat.JSON: + try { + res.result = runJSON( + proofData, + claimData.claim.path, + utils.generateClaim(fingerprint, claimData.claim.format), + claimData.claim.relation + ) + res.completed = true + } catch (error) { + res.errors.push(error.message ? error.message : error) + } + break + case E.ProofFormat.TEXT: + try { + const re = new RegExp( + utils + .generateClaim(fingerprint, claimData.claim.format) + .replace('[', '\\[') + .replace(']', '\\]'), + 'gi' + ) + res.result = re.test(proofData.replace(/\r?\n|\r/, '')) + res.completed = true + } catch (error) { + res.errors.push('err_unknown_text_verification') + } + break + } + + return res +} + +exports.run = run + +},{"./enums":"/home/yarmo/dev/doip/doipjs/src/enums.js","./utils":"/home/yarmo/dev/doip/doipjs/src/utils.js"}]},{},["/home/yarmo/dev/doip/doipjs/src/index.js"])("/home/yarmo/dev/doip/doipjs/src/index.js") }); diff --git a/dist/doip.min.js b/dist/doip.min.js index df875c4..747da48 100644 --- a/dist/doip.min.js +++ b/dist/doip.min.js @@ -1 +1 @@ -!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 o(s,a){if(!r[s]){if(!t[s]){var c="function"==typeof require&&require;if(!a&&c)return c(s,!0);if(n)return n(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var u=r[s]={exports:{}};t[s][0].call(u.exports,(function(e){return o(t[s][1][e]||e)}),u,u.exports,e,t,r,i)}return r[s].exports}for(var n="function"==typeof require&&require,s=0;s(r||(r=this.arrayBuffer()),r)}),this.headers={};for(const[t,r]of e.headers.entries())this.headers[t.toLowerCase()]=r}}t.exports=i(((e,t,r,i,n)=>async(s,a,c={})=>{s=n+(s||"");let l=new URL(s);if(i||(i={}),l.username&&(i.Authorization="Basic "+btoa(l.username+":"+l.password),l=new URL(l.protocol+"//"+l.host+l.pathname+l.search)),"https:"!==l.protocol&&"http:"!==l.protocol)throw new Error("Unknown protocol, "+l.protocol);if(a)if(a instanceof ArrayBuffer||ArrayBuffer.isView(a)||"string"==typeof a);else{if("object"!=typeof a)throw new Error("Unknown body type.");a=JSON.stringify(a),i["Content-Type"]="application/json"}c=new Headers({...i||{},...c});const u=await fetch(l,{method:t,headers:c,body:a});if(u.statusCode=u.status,!e.has(u.status))throw new o(u);return"json"===r?u.json():"buffer"===r?u.arrayBuffer():"string"===r?u.text():u}))},{"./core":2}],2:[function(e,t,r){"use strict";const i=new Set(["json","buffer","string"]);t.exports=e=>(...t)=>{const r=new Set;let o,n,s,a="";return t.forEach((e=>{if("string"==typeof e)if(e.toUpperCase()===e){if(o){throw new Error(`Can't set method to ${e}, already set to ${o}.`)}o=e}else if(e.startsWith("http:")||e.startsWith("https:"))a=e;else{if(!i.has(e))throw new Error("Unknown encoding, "+e);n=e}else if("number"==typeof e)r.add(e);else{if("object"!=typeof e)throw new Error("Unknown type: "+typeof e);if(Array.isArray(e)||e instanceof Set)e.forEach((e=>r.add(e)));else{if(s)throw new Error("Cannot set headers twice.");s=e}}})),o||(o="GET"),0===r.size&&r.add(200),e(r,o,n,s,a)}},{}],3:[function(e,t,r){},{}],4:[function(e,t,r){"use strict";var i="%[a-f0-9]{2}",o=new RegExp(i,"gi"),n=new RegExp("("+i+")+","gi");function s(e,t){try{return decodeURIComponent(e.join(""))}catch(e){}if(1===e.length)return e;t=t||1;var r=e.slice(0,t),i=e.slice(t);return Array.prototype.concat.call([],s(r),s(i))}function a(e){try{return decodeURIComponent(e)}catch(i){for(var t=e.match(o),r=1;r{if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}},{}],7:[function(e,t,r){"use strict";const i=e("is-plain-obj"),{hasOwnProperty:o}=Object.prototype,{propertyIsEnumerable:n}=Object,s=(e,t,r)=>Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0}),a=this,c={concatArrays:!1,ignoreUndefined:!1},l=e=>{const t=[];for(const r in e)o.call(e,r)&&t.push(r);if(Object.getOwnPropertySymbols){const r=Object.getOwnPropertySymbols(e);for(const i of r)n.call(e,i)&&t.push(i)}return t};function u(e){return Array.isArray(e)?function(e){const t=e.slice(0,0);return l(e).forEach((r=>{s(t,r,u(e[r]))})),t}(e):i(e)?function(e){const t=null===Object.getPrototypeOf(e)?Object.create(null):{};return l(e).forEach((r=>{s(t,r,u(e[r]))})),t}(e):e}const p=(e,t,r,i)=>(r.forEach((r=>{void 0===t[r]&&i.ignoreUndefined||(r in e&&e[r]!==Object.getPrototypeOf(e)?s(e,r,d(e[r],t[r],i)):s(e,r,u(t[r])))})),e);function d(e,t,r){return r.concatArrays&&Array.isArray(e)&&Array.isArray(t)?((e,t,r)=>{let i=e.slice(0,0),n=0;return[e,t].forEach((t=>{const a=[];for(let r=0;r!a.includes(e))),r)})),i})(e,t,r):i(t)&&i(e)?p(e,t,l(t),r):u(t)}t.exports=function(...e){const t=d(u(c),this!==a&&this||{},c);let r={_:{}};for(const o of e)if(void 0!==o){if(!i(o))throw new TypeError("`"+o+"` is not an Option Object");r=d(r,{_:o},t)}return r._}},{"is-plain-obj":6}],8:[function(e,t,r){(function(e){(function(){"use strict";function r(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function i(e,t){for(var r,i="",o=0,n=-1,s=0,a=0;a<=e.length;++a){if(a2){var c=i.lastIndexOf("/");if(c!==i.length-1){-1===c?(i="",o=0):o=(i=i.slice(0,c)).length-1-i.lastIndexOf("/"),n=a,s=0;continue}}else if(2===i.length||1===i.length){i="",o=0,n=a,s=0;continue}t&&(i.length>0?i+="/..":i="..",o=2)}else i.length>0?i+="/"+e.slice(n+1,a):i=e.slice(n+1,a),o=a-n-1;n=a,s=0}else 46===r&&-1!==s?++s:s=-1}return i}var o={resolve:function(){for(var t,o="",n=!1,s=arguments.length-1;s>=-1&&!n;s--){var a;s>=0?a=arguments[s]:(void 0===t&&(t=e.cwd()),a=t),r(a),0!==a.length&&(o=a+"/"+o,n=47===a.charCodeAt(0))}return o=i(o,!n),n?o.length>0?"/"+o:"/":o.length>0?o:"."},normalize:function(e){if(r(e),0===e.length)return".";var t=47===e.charCodeAt(0),o=47===e.charCodeAt(e.length-1);return 0!==(e=i(e,!t)).length||t||(e="."),e.length>0&&o&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return r(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,t=0;t0&&(void 0===e?e=i:e+="/"+i)}return void 0===e?".":o.normalize(e)},relative:function(e,t){if(r(e),r(t),e===t)return"";if((e=o.resolve(e))===(t=o.resolve(t)))return"";for(var i=1;il){if(47===t.charCodeAt(a+p))return t.slice(a+p+1);if(0===p)return t.slice(a+p)}else s>l&&(47===e.charCodeAt(i+p)?u=p:0===p&&(u=0));break}var d=e.charCodeAt(i+p);if(d!==t.charCodeAt(a+p))break;47===d&&(u=p)}var f="";for(p=i+u+1;p<=n;++p)p!==n&&47!==e.charCodeAt(p)||(0===f.length?f+="..":f+="/..");return f.length>0?f+t.slice(a+u):(a+=u,47===t.charCodeAt(a)&&++a,t.slice(a))},_makeLong:function(e){return e},dirname:function(e){if(r(e),0===e.length)return".";for(var t=e.charCodeAt(0),i=47===t,o=-1,n=!0,s=e.length-1;s>=1;--s)if(47===(t=e.charCodeAt(s))){if(!n){o=s;break}}else n=!1;return-1===o?i?"/":".":i&&1===o?"//":e.slice(0,o)},basename:function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');r(e);var i,o=0,n=-1,s=!0;if(void 0!==t&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var a=t.length-1,c=-1;for(i=e.length-1;i>=0;--i){var l=e.charCodeAt(i);if(47===l){if(!s){o=i+1;break}}else-1===c&&(s=!1,c=i+1),a>=0&&(l===t.charCodeAt(a)?-1==--a&&(n=i):(a=-1,n=c))}return o===n?n=c:-1===n&&(n=e.length),e.slice(o,n)}for(i=e.length-1;i>=0;--i)if(47===e.charCodeAt(i)){if(!s){o=i+1;break}}else-1===n&&(s=!1,n=i+1);return-1===n?"":e.slice(o,n)},extname:function(e){r(e);for(var t=-1,i=0,o=-1,n=!0,s=0,a=e.length-1;a>=0;--a){var c=e.charCodeAt(a);if(47!==c)-1===o&&(n=!1,o=a+1),46===c?-1===t?t=a:1!==s&&(s=1):-1!==t&&(s=-1);else if(!n){i=a+1;break}}return-1===t||-1===o||0===s||1===s&&t===o-1&&t===i+1?"":e.slice(t,o)},format:function(e){if(null===e||"object"!=typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function(e,t){var r=t.dir||t.root,i=t.base||(t.name||"")+(t.ext||"");return r?r===t.root?r+i:r+e+i:i}("/",e)},parse:function(e){r(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return t;var i,o=e.charCodeAt(0),n=47===o;n?(t.root="/",i=1):i=0;for(var s=-1,a=0,c=-1,l=!0,u=e.length-1,p=0;u>=i;--u)if(47!==(o=e.charCodeAt(u)))-1===c&&(l=!1,c=u+1),46===o?-1===s?s=u:1!==p&&(p=1):-1!==s&&(p=-1);else if(!l){a=u+1;break}return-1===s||-1===c||0===p||1===p&&s===c-1&&s===a+1?-1!==c&&(t.base=t.name=0===a&&n?e.slice(1,c):e.slice(a,c)):(0===a&&n?(t.name=e.slice(1,s),t.base=e.slice(1,c)):(t.name=e.slice(a,s),t.base=e.slice(a,c)),t.ext=e.slice(s,c)),a>0?t.dir=e.slice(0,a-1):n&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};o.posix=o,t.exports=o}).call(this)}).call(this,e("_process"))},{_process:9}],9:[function(e,t,r){var i,o,n=t.exports={};function s(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function c(e){if(i===setTimeout)return setTimeout(e,0);if((i===s||!i)&&setTimeout)return i=setTimeout,setTimeout(e,0);try{return i(e,0)}catch(t){try{return i.call(null,e,0)}catch(t){return i.call(this,e,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:s}catch(e){i=s}try{o="function"==typeof clearTimeout?clearTimeout:a}catch(e){o=a}}();var l,u=[],p=!1,d=-1;function f(){p&&l&&(p=!1,l.length?u=l.concat(u):d=-1,u.length&&h())}function h(){if(!p){var e=c(f);p=!0;for(var t=u.length;t;){for(l=u,u=[];++d1)for(var r=1;rNumber(e)-Number(t))).map((t=>e[t])):e}function p(e){const t=e.indexOf("#");return-1!==t&&(e=e.slice(0,t)),e}function d(e){const t=(e=p(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function f(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?e=Number(e):!t.parseBooleans||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(e="true"===e.toLowerCase()),e}function h(e,t){a((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const r=function(e){let t;switch(e.arrayFormat){case"index":return(e,r,i)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===i[e]&&(i[e]={}),i[e][t[1]]=r):i[e]=r};case"bracket":return(e,r,i)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==i[e]?i[e]=[].concat(i[e],r):i[e]=[r]:i[e]=r};case"comma":case"separator":return(t,r,i)=>{const o="string"==typeof r&&r.includes(e.arrayFormatSeparator),n="string"==typeof r&&!o&&l(r,e).includes(e.arrayFormatSeparator);r=n?l(r,e):r;const s=o||n?r.split(e.arrayFormatSeparator).map((t=>l(t,e))):null===r?r:l(r,e);i[t]=s};default:return(e,t,r)=>{void 0!==r[e]?r[e]=[].concat(r[e],t):r[e]=t}}}(t),i=Object.create(null);if("string"!=typeof e)return i;if(!(e=e.trim().replace(/^[?#&]/,"")))return i;for(const o of e.split("&")){if(""===o)continue;let[e,s]=n(t.decode?o.replace(/\+/g," "):o,"=");s=void 0===s?null:["comma","separator"].includes(t.arrayFormat)?s:l(s,t),r(l(e,t),s,i)}for(const e of Object.keys(i)){const r=i[e];if("object"==typeof r&&null!==r)for(const e of Object.keys(r))r[e]=f(r[e],t);else i[e]=f(r,t)}return!1===t.sort?i:(!0===t.sort?Object.keys(i).sort():Object.keys(i).sort(t.sort)).reduce(((e,t)=>{const r=i[t];return Boolean(r)&&"object"==typeof r&&!Array.isArray(r)?e[t]=u(r):e[t]=r,e}),Object.create(null))}r.extract=d,r.parse=h,r.stringify=(e,t)=>{if(!e)return"";a((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const r=r=>t.skipNull&&null==e[r]||t.skipEmptyString&&""===e[r],i=function(e){switch(e.arrayFormat){case"index":return t=>(r,i)=>{const o=r.length;return void 0===i||e.skipNull&&null===i||e.skipEmptyString&&""===i?r:null===i?[...r,[c(t,e),"[",o,"]"].join("")]:[...r,[c(t,e),"[",c(o,e),"]=",c(i,e)].join("")]};case"bracket":return t=>(r,i)=>void 0===i||e.skipNull&&null===i||e.skipEmptyString&&""===i?r:null===i?[...r,[c(t,e),"[]"].join("")]:[...r,[c(t,e),"[]=",c(i,e)].join("")];case"comma":case"separator":return t=>(r,i)=>null==i||0===i.length?r:0===r.length?[[c(t,e),"=",c(i,e)].join("")]:[[r,c(i,e)].join(e.arrayFormatSeparator)];default:return t=>(r,i)=>void 0===i||e.skipNull&&null===i||e.skipEmptyString&&""===i?r:null===i?[...r,c(t,e)]:[...r,[c(t,e),"=",c(i,e)].join("")]}}(t),o={};for(const t of Object.keys(e))r(t)||(o[t]=e[t]);const n=Object.keys(o);return!1!==t.sort&&n.sort(t.sort),n.map((r=>{const o=e[r];return void 0===o?"":null===o?c(r,t):Array.isArray(o)?o.reduce(i(r),[]).join("&"):c(r,t)+"="+c(o,t)})).filter((e=>e.length>0)).join("&")},r.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);const[r,i]=n(e,"#");return Object.assign({url:r.split("?")[0]||"",query:h(d(e),t)},t&&t.parseFragmentIdentifier&&i?{fragmentIdentifier:l(i,t)}:{})},r.stringifyUrl=(e,t)=>{t=Object.assign({encode:!0,strict:!0},t);const i=p(e.url).split("?")[0]||"",o=r.extract(e.url),n=r.parse(o,{sort:!1}),s=Object.assign(n,e.query);let a=r.stringify(s,t);a&&(a="?"+a);let l=function(e){let t="";const r=e.indexOf("#");return-1!==r&&(t=e.slice(r)),t}(e.url);return e.fragmentIdentifier&&(l="#"+c(e.fragmentIdentifier,t)),`${i}${a}${l}`},r.pick=(e,t,i)=>{i=Object.assign({parseFragmentIdentifier:!0},i);const{url:o,query:n,fragmentIdentifier:a}=r.parseUrl(e,i);return r.stringifyUrl({url:o,query:s(n,t),fragmentIdentifier:a},i)},r.exclude=(e,t,i)=>{const o=Array.isArray(t)?e=>!t.includes(e):(e,r)=>!t(e,r);return r.pick(e,o,i)}},{"decode-uri-component":4,"filter-obj":5,"split-on-first":11,"strict-uri-encode":12}],11:[function(e,t,r){"use strict";t.exports=(e,t)=>{if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===t)return[e];const r=e.indexOf(t);return-1===r?[e]:[e.slice(0,r),e.slice(r+t.length)]}},{}],12:[function(e,t,r){"use strict";t.exports=e=>encodeURIComponent(e).replace(/[!'()*]/g,(e=>"%"+e.charCodeAt(0).toString(16).toUpperCase()))},{}],13:[function(e,t,r){!function(e){"use strict";e.exports.is_uri=r,e.exports.is_http_uri=i,e.exports.is_https_uri=o,e.exports.is_web_uri=n,e.exports.isUri=r,e.exports.isHttpUri=i,e.exports.isHttpsUri=o,e.exports.isWebUri=n;var t=function(e){return e.match(/(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/)};function r(e){if(e&&!/[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i.test(e)&&!/%[^0-9a-f]/i.test(e)&&!/%[0-9a-f](:?[^0-9a-f]|$)/i.test(e)){var r,i,o,n,s,a="",c="";if(a=(r=t(e))[1],i=r[2],o=r[3],n=r[4],s=r[5],a&&a.length&&o.length>=0){if(i&&i.length){if(0!==o.length&&!/^\//.test(o))return}else if(/^\/\//.test(o))return;if(/^[a-z][a-z0-9\+\-\.]*$/.test(a.toLowerCase()))return c+=a+":",i&&i.length&&(c+="//"+i),c+=o,n&&n.length&&(c+="?"+n),s&&s.length&&(c+="#"+s),c}}}function i(e,i){if(r(e)){var o,n,s,a,c="",l="",u="",p="";if(c=(o=t(e))[1],l=o[2],n=o[3],s=o[4],a=o[5],c){if(i){if("https"!=c.toLowerCase())return}else if("http"!=c.toLowerCase())return;if(l)return/:(\d+)$/.test(l)&&(u=l.match(/:(\d+)$/)[0],l=l.replace(/:\d+$/,"")),p+=c+":",p+="//"+l,u&&(p+=u),p+=n,s&&s.length&&(p+="?"+s),a&&a.length&&(p+="#"+a),p}}}function o(e){return i(e,!0)}function n(e){return i(e)||o(e)}}(t)},{}],14:[function(e,t,r){t.exports={name:"doipjs",version:"0.11.2",description:"Decentralized OpenPGP Identity Proofs library in Node.js",main:"src/index.js",dependencies:{bent:"^7.3.12",browserify:"^17.0.0","merge-options":"^3.0.3",openpgp:"^4.10.9",prettier:"^2.1.2","query-string":"^6.14.1","valid-url":"^1.0.9"},devDependencies:{"browserify-shim":"^3.8.14",chai:"^4.2.0","chai-as-promised":"^7.1.1","chai-match-pattern":"^1.2.0","license-check-and-add":"^3.0.4",minify:"^6.0.1",mocha:"^8.2.0"},scripts:{"release:bundle":"./node_modules/browserify/bin/cmd.js ./src/index.js --standalone doip -x openpgp -o ./dist/doip.js","release:minify":"./node_modules/minify/bin/minify.js ./dist/doip.js > ./dist/doip.min.js","prettier:check":"./node_modules/prettier/bin-prettier.js --check .","prettier:write":"./node_modules/prettier/bin-prettier.js --write .","license:check":"./node_modules/license-check-and-add/dist/src/cli.js check","license:add":"./node_modules/license-check-and-add/dist/src/cli.js add","license:remove":"./node_modules/license-check-and-add/dist/src/cli.js remove",docs:"docsify serve ./docs",test:"./node_modules/mocha/bin/mocha"},repository:{type:"git",url:"https://codeberg.org/keyoxide/doipjs"},homepage:"https://js.doip.rocks",keywords:["pgp","gpg","openpgp","encryption","decentralized","identity"],author:"Yarmo Mackenbach (https://yarmo.eu)",license:"Apache-2.0",browserify:{transform:["browserify-shim"]},"browserify-shim":{openpgp:"global:openpgp"}}},{}],15:[function(e,t,r){(function(t){(function(){e("path");const i=e("merge-options"),o=e("valid-url"),n="undefined"!=typeof window?window.openpgp:void 0!==t?t.openpgp:null,s=e("./serviceproviders"),a=e("./keys"),c=e("./utils");Promise.allSettled=Promise.allSettled||(e=>Promise.all(e.map((e=>e.then((e=>({status:"fulfilled",value:e}))).catch((e=>({status:"rejected",reason:e})))))));const l=(e,t,r,i,o)=>{let n;if(e.isVerified||!t)return e;if(Array.isArray(t))return t.forEach(((t,n)=>{e=l(e,t,r,i,o)})),e;if(0==r.length){switch(o){default:case"contains":n=new RegExp(i,"gi"),e.isVerified=n.test(t.replace(/\r?\n|\r|\\/g,""));break;case"equals":e.isVerified=t.replace(/\r?\n|\r|\\/g,"").toLowerCase()==i.toLowerCase();break;case"oneOf":n=new RegExp(i,"gi"),e.isVerified=n.test(t.join("|"))}return e}try{r[0]}catch(t){return e.errors.push("err_data_structure_incorrect"),e}return e=l(e,t[r[0]],r.slice(1),i,o)},u=(e,t)=>{let r={isVerified:!1,errors:[]};switch(t.proof.format){case"json":r=l(r,e,t.claim.path,c.generateClaim(t.claim.fingerprint,t.claim.format),t.claim.relation);break;case"text":re=new RegExp(c.generateClaim(t.claim.fingerprint,t.claim.format),"gi"),r.isVerified=re.test(e.replace(/\r?\n|\r/,""))}return r},p=async(e,t,r)=>{if(e instanceof n.key.Key){const t=await a.getFingerprint(e),i=(await a.getUserData(e)).map((async(e,i)=>new Promise((async(i,o)=>{try{i(await p(e.notations,t,r))}catch(e){o(e)}}))));return Promise.allSettled(i).then((e=>e.map(((e,t)=>"fulfilled"==e.status?e.value:e.reason))))}if(e instanceof Array){const i=e.map((async(e,i)=>new Promise((async(i,o)=>{try{i(await p(e,t,r))}catch(e){o(e)}}))));return Promise.allSettled(i).then((e=>e.map(((e,t)=>"fulfilled"==e.status?e.value:e.reason))))}const c=new Promise((async(n,a)=>{let c={isVerified:!1,errors:[],serviceproviderData:void 0};const l=e.replace(/^\s+|\s+$/g,"");t||(t=null);if(r=i({returnMatchesOnly:!1,proxyPolicy:"adaptive",doipProxyHostname:"proxy.keyoxide.org",twitterBearerToken:null,nitterInstance:null},r||{}),!o.isUri(l))return c.errors.push("invalid_uri"),void a(c);const p=s.match(l,r);if("returnMatchesOnly"in r&&r.returnMatchesOnly)return void n(p);let d,f,h,m,y=!1,g=0;for(;!y&&g{const t={isVerified:!1,errors:["verification_timed_out"],serviceproviderData:void 0};setTimeout((()=>{e(t)}),1e4)}));return await Promise.race([c,l])};r.verify=p}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./keys":17,"./serviceproviders":18,"./utils":37,"merge-options":7,path:8,"valid-url":13}],16:[function(e,t,r){const i=e("./claims"),o=e("./keys"),n=e("./signatures"),s=e("./serviceproviders"),a=e("./utils");r.claims=i,r.keys=o,r.signatures=n,r.serviceproviders=s,r.utils=a},{"./claims":15,"./keys":17,"./serviceproviders":18,"./signatures":36,"./utils":37}],17:[function(e,t,r){(function(t){(function(){e("path");const i=e("bent")("GET"),o=e("valid-url"),n="undefined"!=typeof window?window.openpgp:void 0!==t?t.openpgp:null,s=(e("merge-options"),(e,t)=>new Promise((async(r,i)=>{t=t?"https://"+t:"https://keys.openpgp.org";const o=new n.HKP(t),s={query:e};let a=await o.lookup(s).catch((e=>{i("Key does not exist or could not be fetched")}));a=await n.key.readArmored(a).then((e=>e.keys[0])).catch((e=>null)),a?r(a):i("Key does not exist or could not be fetched")}))),a=e=>new Promise((async(t,r)=>{const i=new n.WKD,o={email:e},s=await i.lookup(o).then((e=>e.keys[0])).catch((e=>null));s?t(s):r("Key does not exist or could not be fetched")})),c=(e,t)=>new Promise((async(e,t)=>{try{await i(opts.keyLink).then((e=>{if(200===e.status)return e})).then((e=>e.text()))}catch(e){t("Error fetching Keybase key: "+e.message)}const r=await n.key.readArmored(rawKeyContent).then((e=>e.keys[0])).catch((e=>null));r?e(r):t("Key does not exist or could not be fetched")})),l=e=>new Promise((async(t,r)=>{e||r("Invalid public key");const i=await e.primaryKey.getFingerprint(),o=await e.getPrimaryUser(),s=e.users;let a=[];s.forEach(((e,t)=>{if(a[t]={userData:{id:e.userId?e.userId.userid:null,name:e.userId?e.userId.name:null,email:e.userId?e.userId.email:null,comment:e.userId?e.userId.comment:null,isPrimary:o.index===t}},"selfCertifications"in e&&e.selfCertifications.length>0){const r=e.selfCertifications[0].rawNotations;a[t].notations=r.map((({name:e,value:t,humanReadable:r})=>{if(r&&"proof@metacode.biz"===e)return n.util.decode_utf8(t)}))}else a[t].notations=[]})),t({fingerprint:i,users:a,primaryUserIndex:o.index})}));r.fetch={uri:e=>new Promise((async(t,r)=>{o.isUri(e)||r("Invalid URI");const i=e.match(/([a-zA-Z0-9]*):([a-zA-Z0-9@._=+\-]*)(?:\:([a-zA-Z0-9@._=+\-]*))?/);switch(i[1]||r("Invalid URI"),i[1]){case"hkp":t(s(i[3]?i[3]:i[2],i[3]?i[2]:null));break;case"wkd":t(a(i[2]));break;case"kb":t(c(i[2],i.length>=4&&i[3]));break;default:r("Invalid URI protocol")}})),hkp:s,wkd:a,keybase:c,plaintext:e=>new Promise((async(t,r)=>{t((await n.key.readArmored(e)).keys[0])})),signature:(e,t)=>new Promise((async(r,i)=>{let o=await n.signature.readArmored(e);if("compressed"in o.packets[0]){o=o.packets[0];await n.stream.readToEnd(await o.packets[1].getText())}const a=o.packets[0].signersUserId,c=await o.packets[0].issuerKeyId.toHex();r(s(a||c,t))}))},r.process=l,r.getUserData=e=>new Promise((async(t,r)=>{t((await l(e)).users)})),r.getFingerprint=e=>new Promise((async(t,r)=>{t((await l(e)).fingerprint)}))}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{bent:1,"merge-options":7,path:8,"valid-url":13}],18:[function(e,t,r){const i=e("bent")("GET"),o=e("./utils"),n=["dns","irc","xmpp","matrix","twitter","reddit","liberapay","hackernews","lobsters","devto","gitea","gitlab","github","mastodon","fediverse","discourse","owncast"],s={dns:e("./serviceproviders/dns"),irc:e("./serviceproviders/irc"),xmpp:e("./serviceproviders/xmpp"),matrix:e("./serviceproviders/matrix"),twitter:e("./serviceproviders/twitter"),reddit:e("./serviceproviders/reddit"),liberapay:e("./serviceproviders/liberapay"),hackernews:e("./serviceproviders/hackernews"),lobsters:e("./serviceproviders/lobsters"),devto:e("./serviceproviders/devto"),gitea:e("./serviceproviders/gitea"),gitlab:e("./serviceproviders/gitlab"),github:e("./serviceproviders/github"),mastodon:e("./serviceproviders/mastodon"),fediverse:e("./serviceproviders/fediverse"),discourse:e("./serviceproviders/discourse"),owncast:e("./serviceproviders/owncast")};r.list=n,r.data=s,r.match=(e,t)=>{let r,i=[];return n.forEach(((o,n)=>{r=s[o],r.reURI.test(e)&&i.push(r.processURI(e,t))})),i},r.directRequestHandler=(t,r)=>new Promise((async(r,o)=>{const n=t.proof.fetch?t.proof.fetch:t.proof.uri;if(!n)return void o("No valid URI provided");switch(t.proof.format){case"json":i(n,null,{Accept:"application/json","User-Agent":"doipjs/"+e("../package.json").version}).then((async e=>await e.json())).then((e=>{r(e)})).catch((e=>{o(e)}));break;case"text":i(n).then((async e=>await e.text())).then((e=>{r(e)})).catch((e=>{o(e)}));break;default:o("No specified proof data format")}})),r.proxyRequestHandler=(e,t)=>new Promise((async(r,n)=>{const s=e.proof.fetch?e.proof.fetch:e.proof.uri;i(o.generateProxyURL(e.proof.format,s,t),null,{Accept:"application/json"}).then((async e=>await e.json())).then((e=>{r(e.content)})).catch((e=>{n(e)}))}))},{"../package.json":14,"./serviceproviders/devto":19,"./serviceproviders/discourse":20,"./serviceproviders/dns":21,"./serviceproviders/fediverse":22,"./serviceproviders/gitea":23,"./serviceproviders/github":24,"./serviceproviders/gitlab":25,"./serviceproviders/hackernews":26,"./serviceproviders/irc":27,"./serviceproviders/liberapay":28,"./serviceproviders/lobsters":29,"./serviceproviders/mastodon":30,"./serviceproviders/matrix":31,"./serviceproviders/owncast":32,"./serviceproviders/reddit":33,"./serviceproviders/twitter":34,"./serviceproviders/xmpp":35,"./utils":37,bent:1}],19:[function(e,t,r){const i=/^https:\/\/dev\.to\/(.*)\/(.*)\/?/;r.reURI=i,r.processURI=(e,t)=>{t||(t={});const r=e.match(i);return{serviceprovider:{type:"web",name:"devto"},profile:{display:r[1],uri:"https://dev.to/"+r[1],qr:null},proof:{uri:e,fetch:`https://dev.to/api/articles/${r[1]}/${r[2]}`,useProxy:!0,format:"json"},claim:{fingerprint:null,format:"message",path:["body_markdown"],relation:"contains"},customRequestHandler:null}},r.tests=[{uri:"https://dev.to/alice/post",shouldMatch:!0},{uri:"https://dev.to/alice/post/",shouldMatch:!0},{uri:"https://domain.org/alice/post",shouldMatch:!1}]},{}],20:[function(e,t,r){const i=/^https:\/\/(.*)\/u\/(.*)\/?/;r.reURI=i,r.processURI=(e,t)=>{t||(t={});const r=e.match(i);return{serviceprovider:{type:"web",name:"discourse"},profile:{display:`${r[2]}@${r[1]}`,uri:e,qr:null},proof:{uri:e,fetch:`https://${r[1]}/u/${r[2]}.json`,useProxy:!0,format:"json"},claim:{fingerprint:null,format:"message",path:["user","bio_raw"],relation:"contains"},customRequestHandler:null}},r.tests=[{uri:"https://domain.org/u/alice",shouldMatch:!0},{uri:"https://domain.org/u/alice/",shouldMatch:!0},{uri:"https://domain.org/alice",shouldMatch:!1}]},{}],21:[function(e,t,r){const i=e("dns"),o=e("bent")("GET"),n=e("../utils"),s=/^dns:([a-zA-Z0-9\.\-\_]*)(?:\?(.*))?/,a=async(e,t)=>{if("resolveTxt"in i){const t=async()=>new Promise(((t,r)=>{i.resolveTxt(e.profile.display,((e,i)=>{e&&r(e),t(i)}))}));return{hostname:e.profile.display,records:{txt:await t()}}}{const t=await o(e.proof.uri,null,{Accept:"application/json"});return await t.json()}};r.reURI=s,r.processURI=(e,t)=>{t||(t={});const r=e.match(s);return{serviceprovider:{type:"web",name:"dns"},profile:{display:r[1],uri:"https://"+r[1],qr:null},proof:{uri:n.generateProxyURL("dns",r[1],t),fetch:null,useProxy:!1,format:"json"},claim:{fingerprint:null,format:"uri",path:["records","txt"],relation:"contains"},customRequestHandler:a}},r.tests=[{uri:"dns:domain.org",shouldMatch:!0},{uri:"dns:domain.org?type=TXT",shouldMatch:!0},{uri:"https://domain.org",shouldMatch:!1}]},{"../utils":37,bent:1,dns:3}],22:[function(e,t,r){const i=/^https:\/\/(.*)\/users\/(.*)\/?/;r.reURI=i,r.processURI=(e,t)=>{t||(t={});const r=e.match(i);return{serviceprovider:{type:"web",name:"fediverse"},profile:{display:`@${r[2]}@${r[1]}`,uri:e,qr:null},proof:{uri:e,fetch:null,useProxy:!1,format:"json"},claim:{fingerprint:null,format:"fingerprint",path:["summary"],relation:"contains"},customRequestHandler:null}},r.tests=[{uri:"https://domain.org/users/alice",shouldMatch:!0},{uri:"https://domain.org/users/alice/",shouldMatch:!0},{uri:"https://domain.org/alice",shouldMatch:!1}]},{}],23:[function(e,t,r){const i=/^https:\/\/(.*)\/(.*)\/gitea_proof\/?/;r.reURI=i,r.processURI=(e,t)=>{t||(t={});const r=e.match(i);return{serviceprovider:{type:"web",name:"gitea"},profile:{display:`${r[2]}@${r[1]}`,uri:`https://${r[1]}/${r[2]}`,qr:null},proof:{uri:e,fetch:`https://${r[1]}/api/v1/repos/${r[2]}/gitea_proof`,useProxy:!0,format:"json"},claim:{fingerprint:null,format:"message",path:["description"],relation:"equals"},customRequestHandler:null}},r.tests=[{uri:"https://domain.org/alice/gitea_proof",shouldMatch:!0},{uri:"https://domain.org/alice/gitea_proof/",shouldMatch:!0},{uri:"https://domain.org/alice/other_proof",shouldMatch:!1}]},{}],24:[function(e,t,r){const i=/^https:\/\/gist\.github\.com\/(.*)\/(.*)\/?/;r.reURI=i,r.processURI=(e,t)=>{t||(t={});const r=e.match(i);return{serviceprovider:{type:"web",name:"github"},profile:{display:r[1],uri:"https://github.com/"+r[1],qr:null},proof:{uri:e,fetch:"https://api.github.com/gists/"+r[2],useProxy:!1,format:"json"},claim:{fingerprint:null,format:"message",path:["files","openpgp.md","content"],relation:"contains"},customRequestHandler:null}},r.tests=[{uri:"https://gist.github.com/Alice/123456789",shouldMatch:!0},{uri:"https://gist.github.com/Alice/123456789/",shouldMatch:!0},{uri:"https://domain.org/Alice/123456789",shouldMatch:!1}]},{}],25:[function(e,t,r){const i=e("bent")("GET"),o=/^https:\/\/(.*)\/(.*)\/gitlab_proof\/?/,n=async(e,t)=>{const r=e.proof.uri.match(o),n=`https://${r[1]}/api/v4/users?username=${r[2]}`;let s;try{s=await i(n,null,{Accept:"application/json"})}catch(e){s=await i(utils.generateProxyURL("web",n,t),null,{Accept:"application/json"})}const a=(await s.json()).find((e=>e.username===r[2]));if(!a)throw new Error("No user with username "+r[2]);const c=`https://${r[1]}/api/v4/users/${a.id}/projects`;let l;try{l=await i(c,null,{Accept:"application/json"})}catch(e){l=await i(utils.generateProxyURL("web",c,t),null,{Accept:"application/json"})}const u=(await l.json()).find((e=>"gitlab_proof"===e.path));if(!u)throw new Error("No project at "+e.proof.uri);return u};r.reURI=o,r.processURI=(e,t)=>{t||(t={});const r=e.match(o);return{serviceprovider:{type:"web",name:"gitlab"},profile:{display:`${r[2]}@${r[1]}`,uri:`https://${r[1]}/${r[2]}`,qr:null},proof:{uri:e,fetch:null,useProxy:!1,format:"json"},claim:{fingerprint:null,format:"message",path:["description"],relation:"equals"},customRequestHandler:n}},r.tests=[{uri:"https://gitlab.domain.org/alice/gitlab_proof",shouldMatch:!0},{uri:"https://gitlab.domain.org/alice/gitlab_proof/",shouldMatch:!0},{uri:"https://domain.org/alice/other_proof",shouldMatch:!1}]},{bent:1}],26:[function(e,t,r){const i=/^https:\/\/news\.ycombinator\.com\/user\?id=(.*)\/?/;r.reURI=i,r.processURI=(e,t)=>{t||(t={});const r=e.match(i);return{serviceprovider:{type:"web",name:"hackernews"},profile:{display:r[1],uri:e,qr:null},proof:{uri:`https://hacker-news.firebaseio.com/v0/user/${r[1]}.json`,fetch:null,useProxy:!0,format:"json"},claim:{fingerprint:null,format:"uri",path:["about"],relation:"contains"},customRequestHandler:null}},r.tests=[{uri:"https://news.ycombinator.com/user?id=Alice",shouldMatch:!0},{uri:"https://news.ycombinator.com/user?id=Alice/",shouldMatch:!0},{uri:"https://domain.org/user?id=Alice",shouldMatch:!1}]},{}],27:[function(e,t,r){const i=e("../utils"),o=/^irc\:\/\/(.*)\/([a-zA-Z0-9]*)/;r.reURI=o,r.processURI=(e,t)=>{t||(t={});const r=e.match(o);return{serviceprovider:{type:"communication",name:"irc"},profile:{display:`irc://${r[1]}/${r[2]}`,uri:e,qr:null},proof:{uri:i.generateProxyURL("irc",[r[1],r[2]],t),fetch:null,useProxy:!1,format:"json"},claim:{fingerprint:null,format:"uri",path:["data"],relation:"contains"},customRequestHandler:null}},r.tests=[{uri:"irc://chat.ircserver.org/Alice1",shouldMatch:!0},{uri:"irc://chat.ircserver.org/alice?param=123",shouldMatch:!0},{uri:"https://chat.ircserver.org/alice",shouldMatch:!1}]},{"../utils":37}],28:[function(e,t,r){const i=/^https:\/\/liberapay\.com\/(.*)\/?/;r.reURI=i,r.processURI=(e,t)=>{t||(t={});const r=e.match(i);return{serviceprovider:{type:"web",name:"liberapay"},profile:{display:r[1],uri:e,qr:null},proof:{uri:e,fetch:`https://liberapay.com/${r[1]}/public.json`,useProxy:!1,format:"json"},claim:{fingerprint:null,format:"message",path:["statements","content"],relation:"contains"},customRequestHandler:null}},r.tests=[{uri:"https://liberapay.com/alice",shouldMatch:!0},{uri:"https://liberapay.com/alice/",shouldMatch:!0},{uri:"https://domain.org/alice",shouldMatch:!1}]},{}],29:[function(e,t,r){const i=/^https:\/\/lobste\.rs\/u\/(.*)\/?/;r.reURI=i,r.processURI=(e,t)=>{t||(t={});const r=e.match(i);return{serviceprovider:{type:"web",name:"lobsters"},profile:{display:r[1],uri:e,qr:null},proof:{uri:`https://lobste.rs/u/${r[1]}.json`,fetch:null,useProxy:!0,format:"json"},claim:{fingerprint:null,format:"message",path:["about"],relation:"contains"},customRequestHandler:null}},r.tests=[{uri:"https://lobste.rs/u/Alice",shouldMatch:!0},{uri:"https://lobste.rs/u/Alice/",shouldMatch:!0},{uri:"https://domain.org/u/Alice",shouldMatch:!1}]},{}],30:[function(e,t,r){const i=/^https:\/\/(.*)\/@(.*)\/?/;r.reURI=i,r.processURI=(e,t)=>{t||(t={});const r=e.match(i);return{serviceprovider:{type:"web",name:"mastodon"},profile:{display:`@${r[2]}@${r[1]}`,uri:e,qr:null},proof:{uri:e,fetch:null,useProxy:!1,format:"json"},claim:{fingerprint:null,format:"fingerprint",path:["attachment","value"],relation:"contains"},customRequestHandler:null}},r.tests=[{uri:"https://domain.org/@alice",shouldMatch:!0},{uri:"https://domain.org/@alice/",shouldMatch:!0},{uri:"https://domain.org/alice",shouldMatch:!1}]},{}],31:[function(e,t,r){e("bent")("GET");const i=e("query-string"),o=e("../utils"),n=/^matrix\:u\/(\@[^:]*\:[^?]*)(\?.*)?/;r.reURI=n,r.processURI=(e,t)=>{t||(t={});const r=e.match(n);let s=null,a=null,c=null;if(r[2]){const e=i.parse(r[2]);"org.keyoxide.e"in e&&"org.keyoxide.r"in e&&(s="https://matrix.to/#/"+r[1],a=`https://matrix.to/#/${e["org.keyoxide.r"]}/${e["org.keyoxide.e"]}`,c=o.generateProxyURL("matrix",[e["org.keyoxide.r"],e["org.keyoxide.e"]],t))}return{serviceprovider:{type:"communication",name:"matrix"},profile:{display:r[1],uri:s,qr:null},proof:{uri:a,fetch:c,useProxy:!1,format:"json"},claim:{fingerprint:null,format:"message",path:["data","content","body"],relation:"contains"},customRequestHandler:null}},r.tests=[{uri:"matrix:u/@alice:matrix.domain.org",shouldMatch:!0},{uri:"matrix:u/@alice:matrix.domain.org?org.keyoxide.r=!123:domain.org&org.keyoxide.e=$123",shouldMatch:!0},{uri:"xmpp:alice@domain.org",shouldMatch:!1},{uri:"https://domain.org/@alice",shouldMatch:!1}]},{"../utils":37,bent:1,"query-string":10}],32:[function(e,t,r){e("bent")("GET");const i=/^https:\/\/(.*)/;r.reURI=i,r.processURI=(e,t)=>{t||(t={});return{serviceprovider:{type:"web",name:"owncast"},profile:{display:e.match(i)[1],uri:e,qr:null},proof:{uri:e+"/api/config",fetch:null,useProxy:!1,format:"json"},claim:{fingerprint:null,format:"fingerprint",path:["socialHandles","url"],relation:"contains"},customRequestHandler:null}},r.tests=[{uri:"https://live.domain.org",shouldMatch:!0},{uri:"https://live.domain.org/",shouldMatch:!0},{uri:"https://domain.org/live",shouldMatch:!0},{uri:"https://domain.org/live/",shouldMatch:!0}]},{bent:1}],33:[function(e,t,r){const i=/^https:\/\/(?:www\.)?reddit\.com\/user\/(.*)\/comments\/(.*)\/(.*)\/?/;r.reURI=i,r.processURI=(e,t)=>{t||(t={});const r=e.match(i);return{serviceprovider:{type:"web",name:"reddit"},profile:{display:r[1],uri:"https://www.reddit.com/user/"+r[1],qr:null},proof:{uri:e,fetch:`https://www.reddit.com/user/${r[1]}/comments/${r[2]}.json`,useProxy:!0,format:"json"},claim:{fingerprint:null,format:"message",path:["data","children","data","selftext"],relation:"contains"},customRequestHandler:null}},r.tests=[{uri:"https://www.reddit.com/user/Alice/comments/123456/post",shouldMatch:!0},{uri:"https://www.reddit.com/user/Alice/comments/123456/post/",shouldMatch:!0},{uri:"https://reddit.com/user/Alice/comments/123456/post",shouldMatch:!0},{uri:"https://reddit.com/user/Alice/comments/123456/post/",shouldMatch:!0},{uri:"https://domain.org/user/Alice/comments/123456/post",shouldMatch:!1}]},{}],34:[function(e,t,r){const i=e("bent")("GET"),o=e("../serviceproviders"),n=e("../utils"),s=/^https:\/\/twitter\.com\/(.*)\/status\/([0-9]*)(?:\?.*)?/,a=async(e,t)=>{const r=e.proof.uri.match(s);if("always"!==t.proxyPolicy){if("twitterBearerToken"in t&&t.twitterBearerToken){const e=await i("https://api.twitter.com/1.1/statuses/show.json?id="+r[2],null,{Accept:"application/json",Authorization:"Bearer "+t.twitterBearerToken});return(await e.json()).text}if("nitterInstance"in t&&t.nitterInstance){e.proof.fetch=`https://${t.nitterInstance}/${r[1]}/status/${r[2]}`;return await o.proxyRequestHandler(e,t)}}return"never"!==t.proxyPolicy&&e.proof.fetch?i(n.generateProxyURL("twitter",r[2],t),null,{Accept:"application/json"}).then((async e=>await e.json())).then((e=>e.data.text)).catch((e=>{reject(e)})):null};r.reURI=s,r.processURI=(e,t)=>{t||(t={});const r=e.match(s);return{serviceprovider:{type:"web",name:"twitter"},profile:{display:"@"+r[1],uri:"https://twitter.com/"+r[1],qr:null},proof:{uri:e,fetch:n.generateProxyURL("twitter",r[2],t),useProxy:!1,format:"text"},claim:{fingerprint:null,format:"message",path:[],relation:"contains"},customRequestHandler:a}},r.tests=[{uri:"https://twitter.com/alice/status/1234567890123456789",shouldMatch:!0},{uri:"https://twitter.com/alice/status/1234567890123456789/",shouldMatch:!0},{uri:"https://domain.org/alice/status/1234567890123456789",shouldMatch:!1}]},{"../serviceproviders":18,"../utils":37,bent:1}],35:[function(e,t,r){const i=e("../utils"),o=/^xmpp:([a-zA-Z0-9\.\-\_]*)@([a-zA-Z0-9\.\-\_]*)(?:\?(.*))?/;r.reURI=o,r.processURI=(e,t)=>{t||(t={});const r=e.match(o);return{serviceprovider:{type:"communication",name:"xmpp"},profile:{display:`${r[1]}@${r[2]}`,uri:e,qr:e},proof:{uri:i.generateProxyURL("xmpp",`${r[1]}@${r[2]}`,t),fetch:null,useProxy:!1,format:"json"},claim:{fingerprint:null,format:"message",path:[],relation:"contains"},customRequestHandler:null}},r.tests=[{uri:"xmpp:alice@domain.org",shouldMatch:!0},{uri:"xmpp:alice@domain.org?omemo-sid-123456789=A1B2C3D4E5F6G7H8I9",shouldMatch:!0},{uri:"https://domain.org",shouldMatch:!1}]},{"../utils":37}],36:[function(e,t,r){(function(t){(function(){const i="undefined"!=typeof window?window.openpgp:void 0!==t?t.openpgp:null,o=(e("merge-options"),e("./claims")),n=e("./keys");r.verify=(e,t)=>new Promise((async(r,s)=>{let a,c=[];try{a=await i.cleartext.readArmored(e)}catch(e){return c.push("invalid_signature"),void s({errors:c})}const l=a.signature.packets[0].issuerKeyId.toHex(),u=a.signature.packets[0].signersUserId,p=a.signature.packets[0].preferredKeyServer||"https://keys.openpgp.org/",d=a.getText();let f,h,m=[],y=[];if(d.split("\n").forEach(((e,t)=>{const r=e.match(/^([a-zA-Z0-9]*)\=(.*)$/i);if(r)switch(r[1].toLowerCase()){case"key":m.push(r[2]);break;case"proof":y.push(r[2])}})),m.length>0)try{h=m[0],f=await n.fetch.uri(h)}catch(e){}if(!f&&u)try{h="wkd:"+u,f=await n.fetch.uri(h)}catch(e){}if(!f)try{h=`hkp:${p.match(/^(.*\:\/\/)?([^/]*)(?:\/)?$/i)[2]}:${l||u}`,f=await n.fetch.uri(h)}catch(e){return c.push("key_not_found"),void s({errors:c})}const g=f.keyPacket.getFingerprint();try{const e=await a.verify([f]);await e[0].verified}catch(e){return c.push("invalid_signature_verification"),void s({errors:c})}const v=await o.verify(y,g,t);r({errors:c,signature:{data:a.signature,issuerKeyId:l,signersUserId:u,preferredKeyServer:p},publicKey:{data:f,uri:h,fingerprint:g},text:d,claims:v})}))}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./claims":15,"./keys":17,"merge-options":7}],37:[function(e,t,r){r.generateProxyURL=(e,t,r)=>{if(!r||!r.doipProxyHostname)return null;let i="";return"xmpp"==e&&(i+="/DESC"),Array.isArray(t)||(t=[t]),t=t.map((e=>encodeURIComponent(e))),`https://${r.doipProxyHostname}/api/1/get/${e}/${t.join("/")}${i}`},r.generateClaim=(e,t)=>{switch(t){case"uri":return"openpgp4fpr:"+e;case"message":return`[Verifying my OpenPGP key: openpgp4fpr:${e}]`;case"fingerprint":return e;default:throw new Error("No valid claim format")}}},{}]},{},[16])(16)})); +!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,o,r){function i(a,d){if(!o[a]){if(!t[a]){var n="function"==typeof require&&require;if(!d&&n)return n(a,!0);if(s)return s(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var u=o[a]={exports:{}};t[a][0].call(u.exports,(function(e){return i(t[a][1][e]||e)}),u,u.exports,e,t,o,r)}return o[a].exports}for(var s="function"==typeof require&&require,a=0;a(o||(o=this.arrayBuffer()),o)}),this.headers={};for(const[t,o]of e.headers.entries())this.headers[t.toLowerCase()]=o}}t.exports=r(((e,t,o,r,s)=>async(a,d,n={})=>{a=s+(a||"");let l=new URL(a);if(r||(r={}),l.username&&(r.Authorization="Basic "+btoa(l.username+":"+l.password),l=new URL(l.protocol+"//"+l.host+l.pathname+l.search)),"https:"!==l.protocol&&"http:"!==l.protocol)throw new Error("Unknown protocol, "+l.protocol);if(d)if(d instanceof ArrayBuffer||ArrayBuffer.isView(d)||"string"==typeof d);else{if("object"!=typeof d)throw new Error("Unknown body type.");d=JSON.stringify(d),r["Content-Type"]="application/json"}n=new Headers({...r||{},...n});const u=await fetch(l,{method:t,headers:n,body:d});if(u.statusCode=u.status,!e.has(u.status))throw new i(u);return"json"===o?u.json():"buffer"===o?u.arrayBuffer():"string"===o?u.text():u}))},{"./core":"/home/yarmo/dev/doip/doipjs/node_modules/bent/src/core.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/bent/src/core.js":[function(e,t,o){"use strict";const r=new Set(["json","buffer","string"]);t.exports=e=>(...t)=>{const o=new Set;let i,s,a,d="";return t.forEach((e=>{if("string"==typeof e)if(e.toUpperCase()===e){if(i){throw new Error(`Can't set method to ${e}, already set to ${i}.`)}i=e}else if(e.startsWith("http:")||e.startsWith("https:"))d=e;else{if(!r.has(e))throw new Error("Unknown encoding, "+e);s=e}else if("number"==typeof e)o.add(e);else{if("object"!=typeof e)throw new Error("Unknown type: "+typeof e);if(Array.isArray(e)||e instanceof Set)e.forEach((e=>o.add(e)));else{if(a)throw new Error("Cannot set headers twice.");a=e}}})),i||(i="GET"),0===o.size&&o.add(200),e(o,i,s,a,d)}},{}],"/home/yarmo/dev/doip/doipjs/node_modules/browser-or-node/lib/index.js":[function(e,t,o){(function(e){(function(){"use strict";Object.defineProperty(o,"__esModule",{value:!0});var t="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},r="undefined"!=typeof window&&void 0!==window.document,i="object"===("undefined"==typeof self?"undefined":t(self))&&self.constructor&&"DedicatedWorkerGlobalScope"===self.constructor.name,s=void 0!==e&&null!=e.versions&&null!=e.versions.node;o.isBrowser=r,o.isWebWorker=i,o.isNode=s,o.isJsDom=function(){return"undefined"!=typeof window&&"nodejs"===window.name||navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")}}).call(this)}).call(this,e("_process"))},{_process:"/home/yarmo/dev/doip/doipjs/node_modules/process/browser.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/browserify/lib/_empty.js":[function(e,t,o){},{}],"/home/yarmo/dev/doip/doipjs/node_modules/decode-uri-component/index.js":[function(e,t,o){"use strict";var r="%[a-f0-9]{2}",i=new RegExp(r,"gi"),s=new RegExp("("+r+")+","gi");function a(e,t){try{return decodeURIComponent(e.join(""))}catch(e){}if(1===e.length)return e;t=t||1;var o=e.slice(0,t),r=e.slice(t);return Array.prototype.concat.call([],a(o),a(r))}function d(e){try{return decodeURIComponent(e)}catch(r){for(var t=e.match(i),o=1;o{if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}},{}],"/home/yarmo/dev/doip/doipjs/node_modules/merge-options/index.js":[function(e,t,o){"use strict";const r=e("is-plain-obj"),{hasOwnProperty:i}=Object.prototype,{propertyIsEnumerable:s}=Object,a=(e,t,o)=>Object.defineProperty(e,t,{value:o,writable:!0,enumerable:!0,configurable:!0}),d=this,n={concatArrays:!1,ignoreUndefined:!1},l=e=>{const t=[];for(const o in e)i.call(e,o)&&t.push(o);if(Object.getOwnPropertySymbols){const o=Object.getOwnPropertySymbols(e);for(const r of o)s.call(e,r)&&t.push(r)}return t};function u(e){return Array.isArray(e)?function(e){const t=e.slice(0,0);return l(e).forEach((o=>{a(t,o,u(e[o]))})),t}(e):r(e)?function(e){const t=null===Object.getPrototypeOf(e)?Object.create(null):{};return l(e).forEach((o=>{a(t,o,u(e[o]))})),t}(e):e}const c=(e,t,o,r)=>(o.forEach((o=>{void 0===t[o]&&r.ignoreUndefined||(o in e&&e[o]!==Object.getPrototypeOf(e)?a(e,o,m(e[o],t[o],r)):a(e,o,u(t[o])))})),e);function m(e,t,o){return o.concatArrays&&Array.isArray(e)&&Array.isArray(t)?((e,t,o)=>{let r=e.slice(0,0),s=0;return[e,t].forEach((t=>{const d=[];for(let o=0;o!d.includes(e))),o)})),r})(e,t,o):r(t)&&r(e)?c(e,t,l(t),o):u(t)}t.exports=function(...e){const t=m(u(n),this!==d&&this||{},n);let o={_:{}};for(const i of e)if(void 0!==i){if(!r(i))throw new TypeError("`"+i+"` is not an Option Object");o=m(o,{_:i},t)}return o._}},{"is-plain-obj":"/home/yarmo/dev/doip/doipjs/node_modules/is-plain-obj/index.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/process/browser.js":[function(e,t,o){var r,i,s=t.exports={};function a(){throw new Error("setTimeout has not been defined")}function d(){throw new Error("clearTimeout has not been defined")}function n(e){if(r===setTimeout)return setTimeout(e,0);if((r===a||!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:a}catch(e){r=a}try{i="function"==typeof clearTimeout?clearTimeout:d}catch(e){i=d}}();var l,u=[],c=!1,m=-1;function p(){c&&l&&(c=!1,l.length?u=l.concat(u):m=-1,u.length&&f())}function f(){if(!c){var e=n(p);c=!0;for(var t=u.length;t;){for(l=u,u=[];++m1)for(var o=1;oNumber(e)-Number(t))).map((t=>e[t])):e}function c(e){const t=e.indexOf("#");return-1!==t&&(e=e.slice(0,t)),e}function m(e){const t=(e=c(e)).indexOf("?");return-1===t?"":e.slice(t+1)}function p(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&"string"==typeof e&&""!==e.trim()?e=Number(e):!t.parseBooleans||null===e||"true"!==e.toLowerCase()&&"false"!==e.toLowerCase()||(e="true"===e.toLowerCase()),e}function f(e,t){d((t=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},t)).arrayFormatSeparator);const o=function(e){let t;switch(e.arrayFormat){case"index":return(e,o,r)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===r[e]&&(r[e]={}),r[e][t[1]]=o):r[e]=o};case"bracket":return(e,o,r)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==r[e]?r[e]=[].concat(r[e],o):r[e]=[o]:r[e]=o};case"comma":case"separator":return(t,o,r)=>{const i="string"==typeof o&&o.includes(e.arrayFormatSeparator),s="string"==typeof o&&!i&&l(o,e).includes(e.arrayFormatSeparator);o=s?l(o,e):o;const a=i||s?o.split(e.arrayFormatSeparator).map((t=>l(t,e))):null===o?o:l(o,e);r[t]=a};default:return(e,t,o)=>{void 0!==o[e]?o[e]=[].concat(o[e],t):o[e]=t}}}(t),r=Object.create(null);if("string"!=typeof e)return r;if(!(e=e.trim().replace(/^[?#&]/,"")))return r;for(const i of e.split("&")){if(""===i)continue;let[e,a]=s(t.decode?i.replace(/\+/g," "):i,"=");a=void 0===a?null:["comma","separator"].includes(t.arrayFormat)?a:l(a,t),o(l(e,t),a,r)}for(const e of Object.keys(r)){const o=r[e];if("object"==typeof o&&null!==o)for(const e of Object.keys(o))o[e]=p(o[e],t);else r[e]=p(o,t)}return!1===t.sort?r:(!0===t.sort?Object.keys(r).sort():Object.keys(r).sort(t.sort)).reduce(((e,t)=>{const o=r[t];return Boolean(o)&&"object"==typeof o&&!Array.isArray(o)?e[t]=u(o):e[t]=o,e}),Object.create(null))}o.extract=m,o.parse=f,o.stringify=(e,t)=>{if(!e)return"";d((t=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},t)).arrayFormatSeparator);const o=o=>t.skipNull&&null==e[o]||t.skipEmptyString&&""===e[o],r=function(e){switch(e.arrayFormat){case"index":return t=>(o,r)=>{const i=o.length;return void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?o:null===r?[...o,[n(t,e),"[",i,"]"].join("")]:[...o,[n(t,e),"[",n(i,e),"]=",n(r,e)].join("")]};case"bracket":return t=>(o,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?o:null===r?[...o,[n(t,e),"[]"].join("")]:[...o,[n(t,e),"[]=",n(r,e)].join("")];case"comma":case"separator":return t=>(o,r)=>null==r||0===r.length?o:0===o.length?[[n(t,e),"=",n(r,e)].join("")]:[[o,n(r,e)].join(e.arrayFormatSeparator)];default:return t=>(o,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?o:null===r?[...o,n(t,e)]:[...o,[n(t,e),"=",n(r,e)].join("")]}}(t),i={};for(const t of Object.keys(e))o(t)||(i[t]=e[t]);const s=Object.keys(i);return!1!==t.sort&&s.sort(t.sort),s.map((o=>{const i=e[o];return void 0===i?"":null===i?n(o,t):Array.isArray(i)?i.reduce(r(o),[]).join("&"):n(o,t)+"="+n(i,t)})).filter((e=>e.length>0)).join("&")},o.parseUrl=(e,t)=>{t=Object.assign({decode:!0},t);const[o,r]=s(e,"#");return Object.assign({url:o.split("?")[0]||"",query:f(m(e),t)},t&&t.parseFragmentIdentifier&&r?{fragmentIdentifier:l(r,t)}:{})},o.stringifyUrl=(e,t)=>{t=Object.assign({encode:!0,strict:!0},t);const r=c(e.url).split("?")[0]||"",i=o.extract(e.url),s=o.parse(i,{sort:!1}),a=Object.assign(s,e.query);let d=o.stringify(a,t);d&&(d="?"+d);let l=function(e){let t="";const o=e.indexOf("#");return-1!==o&&(t=e.slice(o)),t}(e.url);return e.fragmentIdentifier&&(l="#"+n(e.fragmentIdentifier,t)),`${r}${d}${l}`},o.pick=(e,t,r)=>{r=Object.assign({parseFragmentIdentifier:!0},r);const{url:i,query:s,fragmentIdentifier:d}=o.parseUrl(e,r);return o.stringifyUrl({url:i,query:a(s,t),fragmentIdentifier:d},r)},o.exclude=(e,t,r)=>{const i=Array.isArray(t)?e=>!t.includes(e):(e,o)=>!t(e,o);return o.pick(e,i,r)}},{"decode-uri-component":"/home/yarmo/dev/doip/doipjs/node_modules/decode-uri-component/index.js","filter-obj":"/home/yarmo/dev/doip/doipjs/node_modules/filter-obj/index.js","split-on-first":"/home/yarmo/dev/doip/doipjs/node_modules/split-on-first/index.js","strict-uri-encode":"/home/yarmo/dev/doip/doipjs/node_modules/strict-uri-encode/index.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/split-on-first/index.js":[function(e,t,o){"use strict";t.exports=(e,t)=>{if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Expected the arguments to be of type `string`");if(""===t)return[e];const o=e.indexOf(t);return-1===o?[e]:[e.slice(0,o),e.slice(o+t.length)]}},{}],"/home/yarmo/dev/doip/doipjs/node_modules/strict-uri-encode/index.js":[function(e,t,o){"use strict";t.exports=e=>encodeURIComponent(e).replace(/[!'()*]/g,(e=>"%"+e.charCodeAt(0).toString(16).toUpperCase()))},{}],"/home/yarmo/dev/doip/doipjs/node_modules/valid-url/index.js":[function(e,t,o){!function(e){"use strict";e.exports.is_uri=o,e.exports.is_http_uri=r,e.exports.is_https_uri=i,e.exports.is_web_uri=s,e.exports.isUri=o,e.exports.isHttpUri=r,e.exports.isHttpsUri=i,e.exports.isWebUri=s;var t=function(e){return e.match(/(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/)};function o(e){if(e&&!/[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i.test(e)&&!/%[^0-9a-f]/i.test(e)&&!/%[0-9a-f](:?[^0-9a-f]|$)/i.test(e)){var o,r,i,s,a,d="",n="";if(d=(o=t(e))[1],r=o[2],i=o[3],s=o[4],a=o[5],d&&d.length&&i.length>=0){if(r&&r.length){if(0!==i.length&&!/^\//.test(i))return}else if(/^\/\//.test(i))return;if(/^[a-z][a-z0-9\+\-\.]*$/.test(d.toLowerCase()))return n+=d+":",r&&r.length&&(n+="//"+r),n+=i,s&&s.length&&(n+="?"+s),a&&a.length&&(n+="#"+a),n}}}function r(e,r){if(o(e)){var i,s,a,d,n="",l="",u="",c="";if(n=(i=t(e))[1],l=i[2],s=i[3],a=i[4],d=i[5],n){if(r){if("https"!=n.toLowerCase())return}else if("http"!=n.toLowerCase())return;if(l)return/:(\d+)$/.test(l)&&(u=l.match(/:(\d+)$/)[0],l=l.replace(/:\d+$/,"")),c+=n+":",c+="//"+l,u&&(c+=u),c+=s,a&&a.length&&(c+="?"+a),d&&d.length&&(c+="#"+d),c}}}function i(e){return r(e,!0)}function s(e){return r(e)||i(e)}}(t)},{}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/index.js":[function(e,t,o){"use strict";function r(e){return(r="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)}Object.defineProperty(o,"__esModule",{value:!0}),o.default=void 0;var i=Ge(e("./lib/toDate")),s=Ge(e("./lib/toFloat")),a=Ge(e("./lib/toInt")),d=Ge(e("./lib/toBoolean")),n=Ge(e("./lib/equals")),l=Ge(e("./lib/contains")),u=Ge(e("./lib/matches")),c=Ge(e("./lib/isEmail")),m=Ge(e("./lib/isURL")),p=Ge(e("./lib/isMACAddress")),f=Ge(e("./lib/isIP")),h=Ge(e("./lib/isIPRange")),v=Ge(e("./lib/isFQDN")),y=Ge(e("./lib/isDate")),b=Ge(e("./lib/isBoolean")),j=Ge(e("./lib/isLocale")),g=Be(e("./lib/isAlpha")),_=Be(e("./lib/isAlphanumeric")),S=Ge(e("./lib/isNumeric")),A=Ge(e("./lib/isPassportNumber")),x=Ge(e("./lib/isPort")),w=Ge(e("./lib/isLowercase")),M=Ge(e("./lib/isUppercase")),I=Ge(e("./lib/isIMEI")),$=Ge(e("./lib/isAscii")),E=Ge(e("./lib/isFullWidth")),P=Ge(e("./lib/isHalfWidth")),C=Ge(e("./lib/isVariableWidth")),O=Ge(e("./lib/isMultibyte")),R=Ge(e("./lib/isSemVer")),N=Ge(e("./lib/isSurrogatePair")),F=Ge(e("./lib/isInt")),T=Be(e("./lib/isFloat")),D=Ge(e("./lib/isDecimal")),U=Ge(e("./lib/isHexadecimal")),L=Ge(e("./lib/isOctal")),k=Ge(e("./lib/isDivisibleBy")),Z=Ge(e("./lib/isHexColor")),B=Ge(e("./lib/isRgbColor")),G=Ge(e("./lib/isHSL")),H=Ge(e("./lib/isISRC")),Y=Ge(e("./lib/isIBAN")),W=Ge(e("./lib/isBIC")),q=Ge(e("./lib/isMD5")),K=Ge(e("./lib/isHash")),V=Ge(e("./lib/isJWT")),z=Ge(e("./lib/isJSON")),J=Ge(e("./lib/isEmpty")),X=Ge(e("./lib/isLength")),Q=Ge(e("./lib/isByteLength")),ee=Ge(e("./lib/isUUID")),te=Ge(e("./lib/isMongoId")),oe=Ge(e("./lib/isAfter")),re=Ge(e("./lib/isBefore")),ie=Ge(e("./lib/isIn")),se=Ge(e("./lib/isCreditCard")),ae=Ge(e("./lib/isIdentityCard")),de=Ge(e("./lib/isEAN")),ne=Ge(e("./lib/isISIN")),le=Ge(e("./lib/isISBN")),ue=Ge(e("./lib/isISSN")),ce=Ge(e("./lib/isTaxID")),me=Be(e("./lib/isMobilePhone")),pe=Ge(e("./lib/isEthereumAddress")),fe=Ge(e("./lib/isCurrency")),he=Ge(e("./lib/isBtcAddress")),ve=Ge(e("./lib/isISO8601")),ye=Ge(e("./lib/isRFC3339")),be=Ge(e("./lib/isISO31661Alpha2")),je=Ge(e("./lib/isISO31661Alpha3")),ge=Ge(e("./lib/isBase32")),_e=Ge(e("./lib/isBase58")),Se=Ge(e("./lib/isBase64")),Ae=Ge(e("./lib/isDataURI")),xe=Ge(e("./lib/isMagnetURI")),we=Ge(e("./lib/isMimeType")),Me=Ge(e("./lib/isLatLong")),Ie=Be(e("./lib/isPostalCode")),$e=Ge(e("./lib/ltrim")),Ee=Ge(e("./lib/rtrim")),Pe=Ge(e("./lib/trim")),Ce=Ge(e("./lib/escape")),Oe=Ge(e("./lib/unescape")),Re=Ge(e("./lib/stripLow")),Ne=Ge(e("./lib/whitelist")),Fe=Ge(e("./lib/blacklist")),Te=Ge(e("./lib/isWhitelisted")),De=Ge(e("./lib/normalizeEmail")),Ue=Ge(e("./lib/isSlug")),Le=Ge(e("./lib/isStrongPassword")),ke=Ge(e("./lib/isVAT"));function Ze(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return Ze=function(){return e},e}function Be(e){if(e&&e.__esModule)return e;if(null===e||"object"!==r(e)&&"function"!=typeof e)return{default:e};var t=Ze();if(t&&t.has(e))return t.get(e);var o={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){var a=i?Object.getOwnPropertyDescriptor(e,s):null;a&&(a.get||a.set)?Object.defineProperty(o,s,a):o[s]=e[s]}return o.default=e,t&&t.set(e,o),o}function Ge(e){return e&&e.__esModule?e:{default:e}}var He={version:"13.5.2",toDate:i.default,toFloat:s.default,toInt:a.default,toBoolean:d.default,equals:n.default,contains:l.default,matches:u.default,isEmail:c.default,isURL:m.default,isMACAddress:p.default,isIP:f.default,isIPRange:h.default,isFQDN:v.default,isBoolean:b.default,isIBAN:Y.default,isBIC:W.default,isAlpha:g.default,isAlphaLocales:g.locales,isAlphanumeric:_.default,isAlphanumericLocales:_.locales,isNumeric:S.default,isPassportNumber:A.default,isPort:x.default,isLowercase:w.default,isUppercase:M.default,isAscii:$.default,isFullWidth:E.default,isHalfWidth:P.default,isVariableWidth:C.default,isMultibyte:O.default,isSemVer:R.default,isSurrogatePair:N.default,isInt:F.default,isIMEI:I.default,isFloat:T.default,isFloatLocales:T.locales,isDecimal:D.default,isHexadecimal:U.default,isOctal:L.default,isDivisibleBy:k.default,isHexColor:Z.default,isRgbColor:B.default,isHSL:G.default,isISRC:H.default,isMD5:q.default,isHash:K.default,isJWT:V.default,isJSON:z.default,isEmpty:J.default,isLength:X.default,isLocale:j.default,isByteLength:Q.default,isUUID:ee.default,isMongoId:te.default,isAfter:oe.default,isBefore:re.default,isIn:ie.default,isCreditCard:se.default,isIdentityCard:ae.default,isEAN:de.default,isISIN:ne.default,isISBN:le.default,isISSN:ue.default,isMobilePhone:me.default,isMobilePhoneLocales:me.locales,isPostalCode:Ie.default,isPostalCodeLocales:Ie.locales,isEthereumAddress:pe.default,isCurrency:fe.default,isBtcAddress:he.default,isISO8601:ve.default,isRFC3339:ye.default,isISO31661Alpha2:be.default,isISO31661Alpha3:je.default,isBase32:ge.default,isBase58:_e.default,isBase64:Se.default,isDataURI:Ae.default,isMagnetURI:xe.default,isMimeType:we.default,isLatLong:Me.default,ltrim:$e.default,rtrim:Ee.default,trim:Pe.default,escape:Ce.default,unescape:Oe.default,stripLow:Re.default,whitelist:Ne.default,blacklist:Fe.default,isWhitelisted:Te.default,normalizeEmail:De.default,toString:toString,isSlug:Ue.default,isStrongPassword:Le.default,isTaxID:ce.default,isDate:y.default,isVAT:ke.default};o.default=He,t.exports=o.default,t.exports.default=o.default},{"./lib/blacklist":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/blacklist.js","./lib/contains":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/contains.js","./lib/equals":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/equals.js","./lib/escape":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/escape.js","./lib/isAfter":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isAfter.js","./lib/isAlpha":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isAlpha.js","./lib/isAlphanumeric":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isAlphanumeric.js","./lib/isAscii":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isAscii.js","./lib/isBIC":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isBIC.js","./lib/isBase32":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isBase32.js","./lib/isBase58":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isBase58.js","./lib/isBase64":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isBase64.js","./lib/isBefore":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isBefore.js","./lib/isBoolean":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isBoolean.js","./lib/isBtcAddress":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isBtcAddress.js","./lib/isByteLength":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isByteLength.js","./lib/isCreditCard":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isCreditCard.js","./lib/isCurrency":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isCurrency.js","./lib/isDataURI":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isDataURI.js","./lib/isDate":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isDate.js","./lib/isDecimal":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isDecimal.js","./lib/isDivisibleBy":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isDivisibleBy.js","./lib/isEAN":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isEAN.js","./lib/isEmail":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isEmail.js","./lib/isEmpty":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isEmpty.js","./lib/isEthereumAddress":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isEthereumAddress.js","./lib/isFQDN":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isFQDN.js","./lib/isFloat":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isFloat.js","./lib/isFullWidth":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isFullWidth.js","./lib/isHSL":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isHSL.js","./lib/isHalfWidth":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isHalfWidth.js","./lib/isHash":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isHash.js","./lib/isHexColor":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isHexColor.js","./lib/isHexadecimal":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isHexadecimal.js","./lib/isIBAN":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isIBAN.js","./lib/isIMEI":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isIMEI.js","./lib/isIP":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isIP.js","./lib/isIPRange":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isIPRange.js","./lib/isISBN":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isISBN.js","./lib/isISIN":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isISIN.js","./lib/isISO31661Alpha2":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isISO31661Alpha2.js","./lib/isISO31661Alpha3":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isISO31661Alpha3.js","./lib/isISO8601":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isISO8601.js","./lib/isISRC":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isISRC.js","./lib/isISSN":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isISSN.js","./lib/isIdentityCard":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isIdentityCard.js","./lib/isIn":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isIn.js","./lib/isInt":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isInt.js","./lib/isJSON":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isJSON.js","./lib/isJWT":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isJWT.js","./lib/isLatLong":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isLatLong.js","./lib/isLength":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isLength.js","./lib/isLocale":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isLocale.js","./lib/isLowercase":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isLowercase.js","./lib/isMACAddress":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isMACAddress.js","./lib/isMD5":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isMD5.js","./lib/isMagnetURI":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isMagnetURI.js","./lib/isMimeType":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isMimeType.js","./lib/isMobilePhone":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isMobilePhone.js","./lib/isMongoId":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isMongoId.js","./lib/isMultibyte":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isMultibyte.js","./lib/isNumeric":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isNumeric.js","./lib/isOctal":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isOctal.js","./lib/isPassportNumber":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isPassportNumber.js","./lib/isPort":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isPort.js","./lib/isPostalCode":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isPostalCode.js","./lib/isRFC3339":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isRFC3339.js","./lib/isRgbColor":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isRgbColor.js","./lib/isSemVer":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isSemVer.js","./lib/isSlug":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isSlug.js","./lib/isStrongPassword":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isStrongPassword.js","./lib/isSurrogatePair":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isSurrogatePair.js","./lib/isTaxID":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isTaxID.js","./lib/isURL":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isURL.js","./lib/isUUID":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isUUID.js","./lib/isUppercase":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isUppercase.js","./lib/isVAT":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isVAT.js","./lib/isVariableWidth":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isVariableWidth.js","./lib/isWhitelisted":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isWhitelisted.js","./lib/ltrim":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/ltrim.js","./lib/matches":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/matches.js","./lib/normalizeEmail":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/normalizeEmail.js","./lib/rtrim":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/rtrim.js","./lib/stripLow":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/stripLow.js","./lib/toBoolean":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/toBoolean.js","./lib/toDate":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/toDate.js","./lib/toFloat":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/toFloat.js","./lib/toInt":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/toInt.js","./lib/trim":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/trim.js","./lib/unescape":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/unescape.js","./lib/whitelist":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/whitelist.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/alpha.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.commaDecimal=o.dotDecimal=o.farsiLocales=o.arabicLocales=o.englishLocales=o.decimal=o.alphanumeric=o.alpha=void 0;var r={"en-US":/^[A-Z]+$/i,"az-AZ":/^[A-VXYZÇƏĞİıÖŞÜ]+$/i,"bg-BG":/^[А-Я]+$/i,"cs-CZ":/^[A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i,"da-DK":/^[A-ZÆØÅ]+$/i,"de-DE":/^[A-ZÄÖÜß]+$/i,"el-GR":/^[Α-ώ]+$/i,"es-ES":/^[A-ZÁÉÍÑÓÚÜ]+$/i,"fa-IR":/^[ابپتثجچحخدذرزژسشصضطظعغفقکگلمنوهی]+$/i,"fr-FR":/^[A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i,"it-IT":/^[A-ZÀÉÈÌÎÓÒÙ]+$/i,"nb-NO":/^[A-ZÆØÅ]+$/i,"nl-NL":/^[A-ZÁÉËÏÓÖÜÚ]+$/i,"nn-NO":/^[A-ZÆØÅ]+$/i,"hu-HU":/^[A-ZÁÉÍÓÖŐÚÜŰ]+$/i,"pl-PL":/^[A-ZĄĆĘŚŁŃÓŻŹ]+$/i,"pt-PT":/^[A-ZÃÁÀÂÄÇÉÊËÍÏÕÓÔÖÚÜ]+$/i,"ru-RU":/^[А-ЯЁ]+$/i,"sl-SI":/^[A-ZČĆĐŠŽ]+$/i,"sk-SK":/^[A-ZÁČĎÉÍŇÓŠŤÚÝŽĹŔĽÄÔ]+$/i,"sr-RS@latin":/^[A-ZČĆŽŠĐ]+$/i,"sr-RS":/^[А-ЯЂЈЉЊЋЏ]+$/i,"sv-SE":/^[A-ZÅÄÖ]+$/i,"th-TH":/^[ก-๐\s]+$/i,"tr-TR":/^[A-ZÇĞİıÖŞÜ]+$/i,"uk-UA":/^[А-ЩЬЮЯЄIЇҐі]+$/i,"vi-VN":/^[A-ZÀÁẠẢÃÂẦẤẬẨẪĂẰẮẶẲẴĐÈÉẸẺẼÊỀẾỆỂỄÌÍỊỈĨÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠÙÚỤỦŨƯỪỨỰỬỮỲÝỴỶỸ]+$/i,"ku-IQ":/^[ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i,ar:/^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/,he:/^[א-ת]+$/,fa:/^['آاءأؤئبپتثجچحخدذرزژسشصضطظعغفقکگلمنوهةی']+$/i};o.alpha=r;var i={"en-US":/^[0-9A-Z]+$/i,"az-AZ":/^[0-9A-VXYZÇƏĞİıÖŞÜ]+$/i,"bg-BG":/^[0-9А-Я]+$/i,"cs-CZ":/^[0-9A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i,"da-DK":/^[0-9A-ZÆØÅ]+$/i,"de-DE":/^[0-9A-ZÄÖÜß]+$/i,"el-GR":/^[0-9Α-ω]+$/i,"es-ES":/^[0-9A-ZÁÉÍÑÓÚÜ]+$/i,"fr-FR":/^[0-9A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i,"it-IT":/^[0-9A-ZÀÉÈÌÎÓÒÙ]+$/i,"hu-HU":/^[0-9A-ZÁÉÍÓÖŐÚÜŰ]+$/i,"nb-NO":/^[0-9A-ZÆØÅ]+$/i,"nl-NL":/^[0-9A-ZÁÉËÏÓÖÜÚ]+$/i,"nn-NO":/^[0-9A-ZÆØÅ]+$/i,"pl-PL":/^[0-9A-ZĄĆĘŚŁŃÓŻŹ]+$/i,"pt-PT":/^[0-9A-ZÃÁÀÂÄÇÉÊËÍÏÕÓÔÖÚÜ]+$/i,"ru-RU":/^[0-9А-ЯЁ]+$/i,"sl-SI":/^[0-9A-ZČĆĐŠŽ]+$/i,"sk-SK":/^[0-9A-ZÁČĎÉÍŇÓŠŤÚÝŽĹŔĽÄÔ]+$/i,"sr-RS@latin":/^[0-9A-ZČĆŽŠĐ]+$/i,"sr-RS":/^[0-9А-ЯЂЈЉЊЋЏ]+$/i,"sv-SE":/^[0-9A-ZÅÄÖ]+$/i,"th-TH":/^[ก-๙\s]+$/i,"tr-TR":/^[0-9A-ZÇĞİıÖŞÜ]+$/i,"uk-UA":/^[0-9А-ЩЬЮЯЄIЇҐі]+$/i,"ku-IQ":/^[٠١٢٣٤٥٦٧٨٩0-9ئابپتجچحخدرڕزژسشعغفڤقکگلڵمنوۆھەیێيطؤثآإأكضصةظذ]+$/i,"vi-VN":/^[0-9A-ZÀÁẠẢÃÂẦẤẬẨẪĂẰẮẶẲẴĐÈÉẸẺẼÊỀẾỆỂỄÌÍỊỈĨÒÓỌỎÕÔỒỐỘỔỖƠỜỚỢỞỠÙÚỤỦŨƯỪỨỰỬỮỲÝỴỶỸ]+$/i,ar:/^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/,he:/^[0-9א-ת]+$/,fa:/^['0-9آاءأؤئبپتثجچحخدذرزژسشصضطظعغفقکگلمنوهةی۱۲۳۴۵۶۷۸۹۰']+$/i};o.alphanumeric=i;var s={"en-US":".",ar:"٫"};o.decimal=s;var a=["AU","GB","HK","IN","NZ","ZA","ZM"];o.englishLocales=a;for(var d,n=0;n=0:e.indexOf((0,i.default)(t))>=0};var r=a(e("./util/assertString")),i=a(e("./util/toString")),s=a(e("./util/merge"));function a(e){return e&&e.__esModule?e:{default:e}}var d={ignoreCase:!1};t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js","./util/merge":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/merge.js","./util/toString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/toString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/equals.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t){return(0,i.default)(e),e===t};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/escape.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){return(0,i.default)(e),e.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(//g,">").replace(/\//g,"/").replace(/\\/g,"\").replace(/`/g,"`")};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isAfter.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:String(new Date);(0,r.default)(e);var o=(0,i.default)(t),s=(0,i.default)(e);return!!(s&&o&&s>o)};var r=s(e("./util/assertString")),i=s(e("./toDate"));function s(e){return e&&e.__esModule?e:{default:e}}t.exports=o.default,t.exports.default=o.default},{"./toDate":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/toDate.js","./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isAlpha.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en-US",o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};(0,i.default)(e);var r=e,a=o.ignore;if(a)if(a instanceof RegExp)r=r.replace(a,"");else{if("string"!=typeof a)throw new Error("ignore should be instance of a String or RegExp");r=r.replace(new RegExp("[".concat(a.replace(/[-[\]{}()*+?.,\\^$|#\\s]/g,"\\$&"),"]"),"g"),"")}if(t in s.alpha)return s.alpha[t].test(r);throw new Error("Invalid locale '".concat(t,"'"))},o.locales=void 0;var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r},s=e("./alpha");var a=Object.keys(s.alpha);o.locales=a},{"./alpha":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/alpha.js","./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isAlphanumeric.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en-US";if((0,i.default)(e),t in s.alphanumeric)return s.alphanumeric[t].test(e);throw new Error("Invalid locale '".concat(t,"'"))},o.locales=void 0;var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r},s=e("./alpha");var a=Object.keys(s.alphanumeric);o.locales=a},{"./alpha":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/alpha.js","./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isAscii.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){return(0,i.default)(e),s.test(e)};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};var s=/^[\x00-\x7F]+$/;t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isBIC.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){return(0,i.default)(e),s.test(e)};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};var s=/^[A-z]{4}[A-z]{2}\w{2}(\w{3})?$/;t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isBase32.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){if((0,i.default)(e),e.length%8==0&&s.test(e))return!0;return!1};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};var s=/^[A-Z2-7]+=*$/;t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isBase58.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){if((0,i.default)(e),s.test(e))return!0;return!1};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};var s=/^[A-HJ-NP-Za-km-z1-9]*$/;t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isBase64.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t){(0,r.default)(e),t=(0,i.default)(t,n);var o=e.length;if(t.urlSafe)return d.test(e);if(o%4!=0||a.test(e))return!1;var s=e.indexOf("=");return-1===s||s===o-1||s===o-2&&"="===e[o-1]};var r=s(e("./util/assertString")),i=s(e("./util/merge"));function s(e){return e&&e.__esModule?e:{default:e}}var a=/[^A-Z0-9+\/=]/i,d=/^[A-Z0-9_\-]*$/i,n={urlSafe:!1};t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js","./util/merge":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/merge.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isBefore.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:String(new Date);(0,r.default)(e);var o=(0,i.default)(t),s=(0,i.default)(e);return!!(s&&o&&s=0};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isBtcAddress.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){return(0,i.default)(e),s.test(e)};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};var s=/^(bc1|[13])[a-zA-HJ-NP-Z0-9]{25,39}$/;t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isByteLength.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t){var o,r;(0,i.default)(e),"object"===s(t)?(o=t.min||0,r=t.max):(o=arguments[1],r=arguments[2]);var a=encodeURI(e).split(/%..|./).length-1;return a>=o&&(void 0===r||a<=r)};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};function s(e){return(s="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)}t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isCreditCard.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){(0,i.default)(e);var t=e.replace(/[- ]+/g,"");if(!s.test(t))return!1;for(var o,r,a,d=0,n=t.length-1;n>=0;n--)o=t.substring(n,n+1),r=parseInt(o,10),d+=a&&(r*=2)>=10?r%10+1:r,a=!a;return!(d%10!=0||!t)};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};var s=/^(?:4[0-9]{12}(?:[0-9]{3,6})?|5[1-5][0-9]{14}|(222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}|6(?:011|5[0-9][0-9])[0-9]{12,15}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11}|6[27][0-9]{14})$/;t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isCurrency.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t){return(0,i.default)(e),function(e){var t="\\d{".concat(e.digits_after_decimal[0],"}");e.digits_after_decimal.forEach((function(e,o){0!==o&&(t="".concat(t,"|\\d{").concat(e,"}"))}));var o="(".concat(e.symbol.replace(/\W/,(function(e){return"\\".concat(e)})),")").concat(e.require_symbol?"":"?"),r="-?",i="[1-9]\\d{0,2}(\\".concat(e.thousands_separator,"\\d{3})*"),s="(".concat(["0","[1-9]\\d*",i].join("|"),")?"),a="(\\".concat(e.decimal_separator,"(").concat(t,"))").concat(e.require_decimal?"":"?"),d=s+(e.allow_decimal||e.require_decimal?a:"");e.allow_negatives&&!e.parens_for_negatives&&(e.negative_sign_after_digits?d+=r:e.negative_sign_before_digits&&(d=r+d));e.allow_negative_sign_placeholder?d="( (?!\\-))?".concat(d):e.allow_space_after_symbol?d=" ?".concat(d):e.allow_space_after_digits&&(d+="( (?!$))?");e.symbol_after_digits?d+=o:d=o+d;e.allow_negatives&&(e.parens_for_negatives?d="(\\(".concat(d,"\\)|").concat(d,")"):e.negative_sign_before_digits||e.negative_sign_after_digits||(d=r+d));return new RegExp("^(?!-? )(?=.*\\d)".concat(d,"$"))}(t=(0,r.default)(t,a)).test(e)};var r=s(e("./util/merge")),i=s(e("./util/assertString"));function s(e){return e&&e.__esModule?e:{default:e}}var a={symbol:"$",require_symbol:!1,allow_space_after_symbol:!1,symbol_after_digits:!1,allow_negatives:!0,parens_for_negatives:!1,negative_sign_before_digits:!1,negative_sign_after_digits:!1,allow_negative_sign_placeholder:!1,thousands_separator:",",decimal_separator:".",allow_decimal:!0,require_decimal:!1,digits_after_decimal:[2],allow_space_after_digits:!1};t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js","./util/merge":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/merge.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isDataURI.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){(0,i.default)(e);var t=e.split(",");if(t.length<2)return!1;var o=t.shift().trim().split(";"),r=o.shift();if("data:"!==r.substr(0,5))return!1;var n=r.substr(5);if(""!==n&&!s.test(n))return!1;for(var l=0;l=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,d=!0,n=!1;return{s:function(){o=e[Symbol.iterator]()},n:function(){var e=o.next();return d=e.done,e},e:function(e){n=!0,a=e},f:function(){try{d||null==o.return||o.return()}finally{if(n)throw a}}}}(n);try{for(u.s();!(o=u.n()).done;){var c=(f=o.value,h=2,function(e){if(Array.isArray(e))return e}(f)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var o=[],r=!0,i=!1,s=void 0;try{for(var a,d=e[Symbol.iterator]();!(r=(a=d.next()).done)&&(o.push(a.value),!t||o.length!==t);r=!0);}catch(e){i=!0,s=e}finally{try{r||null==d.return||d.return()}finally{if(i)throw s}}return o}(f,h)||s(f,h)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),m=c[0],p=c[1];if(m.length!==p.length)return!1;l[p.charAt(0)]=m}}catch(e){u.e(e)}finally{u.f()}return new Date("".concat(l.m,"/").concat(l.d,"/").concat(l.y)).getDate()===+l.d}var f,h;var v;if(!t.strictMode)return"[object Date]"===Object.prototype.toString.call(e)&&isFinite(e);return!1};var r,i=(r=e("./util/merge"))&&r.__esModule?r:{default:r};function s(e,t){if(e){if("string"==typeof e)return a(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);return"Object"===o&&e.constructor&&(o=e.constructor.name),"Map"===o||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?a(e,t):void 0}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,r=new Array(t);o]/.test(o)){if(!t)return!1;if(!(o.split('"').length===o.split('\\"').length))return!1}return!0}(n))return!1}else if(t.require_display_name)return!1}if(!t.ignore_max_length&&e.length>254)return!1;var b=e.split("@"),j=b.pop(),g=b.join("@"),_=j.toLowerCase();if(t.domain_specific_validation&&("gmail.com"===_||"googlemail.com"===_)){var S=(g=g.toLowerCase()).split("+")[0];if(!(0,s.default)(S.replace(".",""),{min:6,max:30}))return!1;for(var A=S.split("."),x=0;xe.length)&&(t=e.length);for(var o=0,r=new Array(t);o$/i,m=/^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~]+$/i,p=/^[a-z\d]+$/,f=/^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f]))*$/i,h=/^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+$/i,v=/^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*$/i;t.exports=o.default,t.exports.default=o.default},{"./isByteLength":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isByteLength.js","./isFQDN":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isFQDN.js","./isIP":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isIP.js","./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js","./util/merge":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/merge.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isEmpty.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t){return(0,r.default)(e),0===((t=(0,i.default)(t,a)).ignore_whitespace?e.trim().length:e.length)};var r=s(e("./util/assertString")),i=s(e("./util/merge"));function s(e){return e&&e.__esModule?e:{default:e}}var a={ignore_whitespace:!1};t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js","./util/merge":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/merge.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isEthereumAddress.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){return(0,i.default)(e),s.test(e)};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};var s=/^(0x)[0-9a-f]{40}$/i;t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isFQDN.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t){(0,r.default)(e),(t=(0,i.default)(t,a)).allow_trailing_dot&&"."===e[e.length-1]&&(e=e.substring(0,e.length-1));var o=e.split("."),s=o[o.length-1];if(t.require_tld){if(o.length<2)return!1;if(!/^([a-z\u00a1-\uffff]{2,}|xn[a-z0-9-]{2,})$/i.test(s))return!1;if(/[\s\u2002-\u200B\u202F\u205F\u3000\uFEFF\uDB40\uDC20\u00A9\uFFFD]/.test(s))return!1}if(!t.allow_numeric_tld&&/^\d+$/.test(s))return!1;return o.every((function(e){return!(e.length>63)&&(!!/^[a-z_\u00a1-\uffff0-9-]+$/i.test(e)&&(!/[\uff01-\uff5e]/.test(e)&&(!/^-|-$/.test(e)&&!(!t.allow_underscores&&/_/.test(e)))))}))};var r=s(e("./util/assertString")),i=s(e("./util/merge"));function s(e){return e&&e.__esModule?e:{default:e}}var a={require_tld:!0,allow_underscores:!1,allow_trailing_dot:!1,allow_numeric_tld:!1};t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js","./util/merge":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/merge.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isFloat.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t){(0,i.default)(e),t=t||{};var o=new RegExp("^(?:[-+])?(?:[0-9]+)?(?:\\".concat(t.locale?s.decimal[t.locale]:".","[0-9]*)?(?:[eE][\\+\\-]?(?:[0-9]+))?$"));if(""===e||"."===e||"-"===e||"+"===e)return!1;var r=parseFloat(e.replace(",","."));return o.test(e)&&(!t.hasOwnProperty("min")||r>=t.min)&&(!t.hasOwnProperty("max")||r<=t.max)&&(!t.hasOwnProperty("lt")||rt.gt)},o.locales=void 0;var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r},s=e("./alpha");var a=Object.keys(s.decimal);o.locales=a},{"./alpha":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/alpha.js","./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isFullWidth.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){return(0,i.default)(e),s.test(e)},o.fullWidth=void 0;var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};var s=/[^\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]/;o.fullWidth=s},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isHSL.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){return(0,i.default)(e),s.test(e)||a.test(e)};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};var s=/^(hsl)a?\(\s*((\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?))(deg|grad|rad|turn|\s*)(\s*,\s*(\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?)%){2}\s*(,\s*((\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?)%?)\s*)?\)$/i,a=/^(hsl)a?\(\s*((\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?))(deg|grad|rad|turn|\s)(\s*(\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?)%){2}\s*(\/\s*((\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?)%?)\s*)?\)$/i;t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isHalfWidth.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){return(0,i.default)(e),s.test(e)},o.halfWidth=void 0;var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};var s=/[\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]/;o.halfWidth=s},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isHash.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t){return(0,i.default)(e),new RegExp("^[a-fA-F0-9]{".concat(s[t],"}$")).test(e)};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};var s={md5:32,md4:32,sha1:40,sha256:64,sha384:96,sha512:128,ripemd128:32,ripemd160:40,tiger128:32,tiger160:40,tiger192:48,crc32:8,crc32b:8};t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isHexColor.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){return(0,i.default)(e),s.test(e)};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};var s=/^#?([0-9A-F]{3}|[0-9A-F]{4}|[0-9A-F]{6}|[0-9A-F]{8})$/i;t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isHexadecimal.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){return(0,i.default)(e),s.test(e)};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};var s=/^(0x|0h)?[0-9A-F]+$/i;t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isIBAN.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){return(0,i.default)(e),function(e){var t=e.replace(/[\s\-]+/gi,"").toUpperCase(),o=t.slice(0,2).toUpperCase();return o in s&&s[o].test(t)}(e)&&function(e){var t=e.replace(/[^A-Z0-9]+/gi,"").toUpperCase();return 1===(t.slice(4)+t.slice(0,4)).replace(/[A-Z]/g,(function(e){return e.charCodeAt(0)-55})).match(/\d{1,7}/g).reduce((function(e,t){return Number(e+t)%97}),"")}(e)};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};var s={AD:/^(AD[0-9]{2})\d{8}[A-Z0-9]{12}$/,AE:/^(AE[0-9]{2})\d{3}\d{16}$/,AL:/^(AL[0-9]{2})\d{8}[A-Z0-9]{16}$/,AT:/^(AT[0-9]{2})\d{16}$/,AZ:/^(AZ[0-9]{2})[A-Z0-9]{4}\d{20}$/,BA:/^(BA[0-9]{2})\d{16}$/,BE:/^(BE[0-9]{2})\d{12}$/,BG:/^(BG[0-9]{2})[A-Z]{4}\d{6}[A-Z0-9]{8}$/,BH:/^(BH[0-9]{2})[A-Z]{4}[A-Z0-9]{14}$/,BR:/^(BR[0-9]{2})\d{23}[A-Z]{1}[A-Z0-9]{1}$/,BY:/^(BY[0-9]{2})[A-Z0-9]{4}\d{20}$/,CH:/^(CH[0-9]{2})\d{5}[A-Z0-9]{12}$/,CR:/^(CR[0-9]{2})\d{18}$/,CY:/^(CY[0-9]{2})\d{8}[A-Z0-9]{16}$/,CZ:/^(CZ[0-9]{2})\d{20}$/,DE:/^(DE[0-9]{2})\d{18}$/,DK:/^(DK[0-9]{2})\d{14}$/,DO:/^(DO[0-9]{2})[A-Z]{4}\d{20}$/,EE:/^(EE[0-9]{2})\d{16}$/,EG:/^(EG[0-9]{2})\d{25}$/,ES:/^(ES[0-9]{2})\d{20}$/,FI:/^(FI[0-9]{2})\d{14}$/,FO:/^(FO[0-9]{2})\d{14}$/,FR:/^(FR[0-9]{2})\d{10}[A-Z0-9]{11}\d{2}$/,GB:/^(GB[0-9]{2})[A-Z]{4}\d{14}$/,GE:/^(GE[0-9]{2})[A-Z0-9]{2}\d{16}$/,GI:/^(GI[0-9]{2})[A-Z]{4}[A-Z0-9]{15}$/,GL:/^(GL[0-9]{2})\d{14}$/,GR:/^(GR[0-9]{2})\d{7}[A-Z0-9]{16}$/,GT:/^(GT[0-9]{2})[A-Z0-9]{4}[A-Z0-9]{20}$/,HR:/^(HR[0-9]{2})\d{17}$/,HU:/^(HU[0-9]{2})\d{24}$/,IE:/^(IE[0-9]{2})[A-Z0-9]{4}\d{14}$/,IL:/^(IL[0-9]{2})\d{19}$/,IQ:/^(IQ[0-9]{2})[A-Z]{4}\d{15}$/,IR:/^(IR[0-9]{2})0\d{2}0\d{18}$/,IS:/^(IS[0-9]{2})\d{22}$/,IT:/^(IT[0-9]{2})[A-Z]{1}\d{10}[A-Z0-9]{12}$/,JO:/^(JO[0-9]{2})[A-Z]{4}\d{22}$/,KW:/^(KW[0-9]{2})[A-Z]{4}[A-Z0-9]{22}$/,KZ:/^(KZ[0-9]{2})\d{3}[A-Z0-9]{13}$/,LB:/^(LB[0-9]{2})\d{4}[A-Z0-9]{20}$/,LC:/^(LC[0-9]{2})[A-Z]{4}[A-Z0-9]{24}$/,LI:/^(LI[0-9]{2})\d{5}[A-Z0-9]{12}$/,LT:/^(LT[0-9]{2})\d{16}$/,LU:/^(LU[0-9]{2})\d{3}[A-Z0-9]{13}$/,LV:/^(LV[0-9]{2})[A-Z]{4}[A-Z0-9]{13}$/,MC:/^(MC[0-9]{2})\d{10}[A-Z0-9]{11}\d{2}$/,MD:/^(MD[0-9]{2})[A-Z0-9]{20}$/,ME:/^(ME[0-9]{2})\d{18}$/,MK:/^(MK[0-9]{2})\d{3}[A-Z0-9]{10}\d{2}$/,MR:/^(MR[0-9]{2})\d{23}$/,MT:/^(MT[0-9]{2})[A-Z]{4}\d{5}[A-Z0-9]{18}$/,MU:/^(MU[0-9]{2})[A-Z]{4}\d{19}[A-Z]{3}$/,NL:/^(NL[0-9]{2})[A-Z]{4}\d{10}$/,NO:/^(NO[0-9]{2})\d{11}$/,PK:/^(PK[0-9]{2})[A-Z0-9]{4}\d{16}$/,PL:/^(PL[0-9]{2})\d{24}$/,PS:/^(PS[0-9]{2})[A-Z0-9]{4}\d{21}$/,PT:/^(PT[0-9]{2})\d{21}$/,QA:/^(QA[0-9]{2})[A-Z]{4}[A-Z0-9]{21}$/,RO:/^(RO[0-9]{2})[A-Z]{4}[A-Z0-9]{16}$/,RS:/^(RS[0-9]{2})\d{18}$/,SA:/^(SA[0-9]{2})\d{2}[A-Z0-9]{18}$/,SC:/^(SC[0-9]{2})[A-Z]{4}\d{20}[A-Z]{3}$/,SE:/^(SE[0-9]{2})\d{20}$/,SI:/^(SI[0-9]{2})\d{15}$/,SK:/^(SK[0-9]{2})\d{20}$/,SM:/^(SM[0-9]{2})[A-Z]{1}\d{10}[A-Z0-9]{12}$/,SV:/^(SV[0-9]{2})[A-Z0-9]{4}\d{20}$/,TL:/^(TL[0-9]{2})\d{19}$/,TN:/^(TN[0-9]{2})\d{20}$/,TR:/^(TR[0-9]{2})\d{5}[A-Z0-9]{17}$/,UA:/^(UA[0-9]{2})\d{6}[A-Z0-9]{19}$/,VA:/^(VA[0-9]{2})\d{18}$/,VG:/^(VG[0-9]{2})[A-Z0-9]{4}\d{16}$/,XK:/^(XK[0-9]{2})\d{16}$/};t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isIMEI.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t){(0,i.default)(e);var o=s;(t=t||{}).allow_hyphens&&(o=a);if(!o.test(e))return!1;e=e.replace(/-/g,"");for(var r=0,d=2,n=0;n<14;n++){var l=e.substring(14-n-1,14-n),u=parseInt(l,10)*d;r+=u>=10?u%10+1:u,1===d?d+=1:d-=1}if((10-r%10)%10!==parseInt(e.substring(14,15),10))return!1;return!0};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};var s=/^[0-9]{15}$/,a=/^\d{2}-\d{6}-\d{6}-\d{1}$/;t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isIP.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function e(t){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if((0,i.default)(t),!(o=String(o)))return e(t,4)||e(t,6);if("4"===o){if(!s.test(t))return!1;var r=t.split(".").sort((function(e,t){return e-t}));return r[3]<=255}if("6"===o){var d=[t];if(t.includes("%")){if(2!==(d=t.split("%")).length)return!1;if(!d[0].includes(":"))return!1;if(""===d[1])return!1}var n=d[0].split(":"),l=!1,u=e(n[n.length-1],4),c=u?7:8;if(n.length>c)return!1;if("::"===t)return!0;"::"===t.substr(0,2)?(n.shift(),n.shift(),l=!0):"::"===t.substr(t.length-2)&&(n.pop(),n.pop(),l=!0);for(var m=0;m0&&m=1:n.length===c}return!1};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};var s=/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/,a=/^[0-9A-F]{1,4}$/i;t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isIPRange.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){(0,r.default)(e);var t=e.split("/");if(2!==t.length)return!1;if(!a.test(t[1]))return!1;if(t[1].length>1&&t[1].startsWith("0"))return!1;return(0,i.default)(t[0],4)&&t[1]<=32&&t[1]>=0};var r=s(e("./util/assertString")),i=s(e("./isIP"));function s(e){return e&&e.__esModule?e:{default:e}}var a=/^\d{1,2}$/;t.exports=o.default,t.exports.default=o.default},{"./isIP":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isIP.js","./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isISBN.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function e(t){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if((0,i.default)(t),!(o=String(o)))return e(t,10)||e(t,13);var r,n=t.replace(/[\s-]+/g,""),l=0;if("10"===o){if(!s.test(n))return!1;for(r=0;r<9;r++)l+=(r+1)*n.charAt(r);if("X"===n.charAt(9)?l+=100:l+=10*n.charAt(9),l%11==0)return!!n}else if("13"===o){if(!a.test(n))return!1;for(r=0;r<12;r++)l+=d[r%2]*n.charAt(r);if(n.charAt(12)-(10-l%10)%10==0)return!!n}return!1};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};var s=/^(?:[0-9]{9}X|[0-9]{10})$/,a=/^(?:[0-9]{13})$/,d=[1,3];t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isISIN.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){if((0,i.default)(e),!s.test(e))return!1;for(var t,o,r=e.replace(/[A-Z]/g,(function(e){return parseInt(e,36)})),a=0,d=!0,n=r.length-2;n>=0;n--)t=r.substring(n,n+1),o=parseInt(t,10),a+=d&&(o*=2)>=10?o+1:o,d=!d;return parseInt(e.substr(e.length-1),10)===(1e4-a)%10};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};var s=/^[A-Z]{2}[0-9A-Z]{9}[0-9]$/;t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isISO31661Alpha2.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){return(0,r.default)(e),(0,i.default)(a,e.toUpperCase())};var r=s(e("./util/assertString")),i=s(e("./util/includes"));function s(e){return e&&e.__esModule?e:{default:e}}var a=["AD","AE","AF","AG","AI","AL","AM","AO","AQ","AR","AS","AT","AU","AW","AX","AZ","BA","BB","BD","BE","BF","BG","BH","BI","BJ","BL","BM","BN","BO","BQ","BR","BS","BT","BV","BW","BY","BZ","CA","CC","CD","CF","CG","CH","CI","CK","CL","CM","CN","CO","CR","CU","CV","CW","CX","CY","CZ","DE","DJ","DK","DM","DO","DZ","EC","EE","EG","EH","ER","ES","ET","FI","FJ","FK","FM","FO","FR","GA","GB","GD","GE","GF","GG","GH","GI","GL","GM","GN","GP","GQ","GR","GS","GT","GU","GW","GY","HK","HM","HN","HR","HT","HU","ID","IE","IL","IM","IN","IO","IQ","IR","IS","IT","JE","JM","JO","JP","KE","KG","KH","KI","KM","KN","KP","KR","KW","KY","KZ","LA","LB","LC","LI","LK","LR","LS","LT","LU","LV","LY","MA","MC","MD","ME","MF","MG","MH","MK","ML","MM","MN","MO","MP","MQ","MR","MS","MT","MU","MV","MW","MX","MY","MZ","NA","NC","NE","NF","NG","NI","NL","NO","NP","NR","NU","NZ","OM","PA","PE","PF","PG","PH","PK","PL","PM","PN","PR","PS","PT","PW","PY","QA","RE","RO","RS","RU","RW","SA","SB","SC","SD","SE","SG","SH","SI","SJ","SK","SL","SM","SN","SO","SR","SS","ST","SV","SX","SY","SZ","TC","TD","TF","TG","TH","TJ","TK","TL","TM","TN","TO","TR","TT","TV","TW","TZ","UA","UG","UM","US","UY","UZ","VA","VC","VE","VG","VI","VN","VU","WF","WS","YE","YT","ZA","ZM","ZW"];t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js","./util/includes":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/includes.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isISO31661Alpha3.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){return(0,r.default)(e),(0,i.default)(a,e.toUpperCase())};var r=s(e("./util/assertString")),i=s(e("./util/includes"));function s(e){return e&&e.__esModule?e:{default:e}}var a=["AFG","ALA","ALB","DZA","ASM","AND","AGO","AIA","ATA","ATG","ARG","ARM","ABW","AUS","AUT","AZE","BHS","BHR","BGD","BRB","BLR","BEL","BLZ","BEN","BMU","BTN","BOL","BES","BIH","BWA","BVT","BRA","IOT","BRN","BGR","BFA","BDI","KHM","CMR","CAN","CPV","CYM","CAF","TCD","CHL","CHN","CXR","CCK","COL","COM","COG","COD","COK","CRI","CIV","HRV","CUB","CUW","CYP","CZE","DNK","DJI","DMA","DOM","ECU","EGY","SLV","GNQ","ERI","EST","ETH","FLK","FRO","FJI","FIN","FRA","GUF","PYF","ATF","GAB","GMB","GEO","DEU","GHA","GIB","GRC","GRL","GRD","GLP","GUM","GTM","GGY","GIN","GNB","GUY","HTI","HMD","VAT","HND","HKG","HUN","ISL","IND","IDN","IRN","IRQ","IRL","IMN","ISR","ITA","JAM","JPN","JEY","JOR","KAZ","KEN","KIR","PRK","KOR","KWT","KGZ","LAO","LVA","LBN","LSO","LBR","LBY","LIE","LTU","LUX","MAC","MKD","MDG","MWI","MYS","MDV","MLI","MLT","MHL","MTQ","MRT","MUS","MYT","MEX","FSM","MDA","MCO","MNG","MNE","MSR","MAR","MOZ","MMR","NAM","NRU","NPL","NLD","NCL","NZL","NIC","NER","NGA","NIU","NFK","MNP","NOR","OMN","PAK","PLW","PSE","PAN","PNG","PRY","PER","PHL","PCN","POL","PRT","PRI","QAT","REU","ROU","RUS","RWA","BLM","SHN","KNA","LCA","MAF","SPM","VCT","WSM","SMR","STP","SAU","SEN","SRB","SYC","SLE","SGP","SXM","SVK","SVN","SLB","SOM","ZAF","SGS","SSD","ESP","LKA","SDN","SUR","SJM","SWZ","SWE","CHE","SYR","TWN","TJK","TZA","THA","TLS","TGO","TKL","TON","TTO","TUN","TUR","TKM","TCA","TUV","UGA","UKR","ARE","GBR","USA","UMI","URY","UZB","VUT","VEN","VNM","VGB","VIR","WLF","ESH","YEM","ZMB","ZWE"];t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js","./util/includes":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/includes.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isISO8601.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(0,i.default)(e);var o=t.strictSeparator?a.test(e):s.test(e);return o&&t.strict?d(e):o};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};var s=/^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/,a=/^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/,d=function(e){var t=e.match(/^(\d{4})-?(\d{3})([ T]{1}\.*|$)/);if(t){var o=Number(t[1]),r=Number(t[2]);return o%4==0&&o%100!=0||o%400==0?r<=366:r<=365}var i=e.match(/(\d{4})-?(\d{0,2})-?(\d*)/).map(Number),s=i[1],a=i[2],d=i[3],n=a?"0".concat(a).slice(-2):a,l=d?"0".concat(d).slice(-2):d,u=new Date("".concat(s,"-").concat(n||"01","-").concat(l||"01"));return!a||!d||u.getUTCFullYear()===s&&u.getUTCMonth()+1===a&&u.getUTCDate()===d};t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isISRC.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){return(0,i.default)(e),s.test(e)};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};var s=/^[A-Z]{2}[0-9A-Z]{3}\d{2}\d{5}$/;t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isISSN.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(0,i.default)(e);var o=s;if(o=t.require_hyphen?o.replace("?",""):o,!(o=t.case_sensitive?new RegExp(o):new RegExp(o,"i")).test(e))return!1;for(var r=e.replace("-","").toUpperCase(),a=0,d=0;d-1)},NO:function(e){var t=e.trim();if(isNaN(Number(t)))return!1;if(11!==t.length)return!1;if("00000000000"===t)return!1;var o=t.split("").map(Number),r=(11-(3*o[0]+7*o[1]+6*o[2]+1*o[3]+8*o[4]+9*o[5]+4*o[6]+5*o[7]+2*o[8])%11)%11,i=(11-(5*o[0]+4*o[1]+3*o[2]+2*o[3]+7*o[4]+6*o[5]+5*o[6]+4*o[7]+3*o[8]+2*r)%11)%11;return r===o[9]&&i===o[10]},"he-IL":function(e){var t=e.trim();if(!/^\d{9}$/.test(t))return!1;for(var o,r=t,i=0,s=0;s9?o-9:o;return i%10==0},"ar-TN":function(e){var t=e.trim();return!!/^\d{8}$/.test(t)},"zh-CN":function(e){var t,o=["11","12","13","14","15","21","22","23","31","32","33","34","35","36","37","41","42","43","44","45","46","50","51","52","53","54","61","62","63","64","65","71","81","82","91"],r=["7","9","10","5","8","4","2","1","6","3","7","9","10","5","8","4","2"],i=["1","0","X","9","8","7","6","5","4","3","2"],s=function(e){return o.includes(e)},a=function(e){var t=parseInt(e.substring(0,4),10),o=parseInt(e.substring(4,6),10),r=parseInt(e.substring(6),10),i=new Date(t,o-1,r);return!(i>new Date)&&(i.getFullYear()===t&&i.getMonth()===o-1&&i.getDate()===r)},d=function(e){return function(e){for(var t=e.substring(0,17),o=0,s=0;s<17;s++)o+=parseInt(t.charAt(s),10)*parseInt(r[s],10);return i[o%11]}(e)===e.charAt(17).toUpperCase()};return!!/^\d{15}|(\d{17}(\d|x|X))$/.test(t=e)&&(15===t.length?function(e){var t=/^[1-9]\d{7}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\d{3}$/.test(e);if(!t)return!1;var o=e.substring(0,2);if(!(t=s(o)))return!1;var r="19".concat(e.substring(6,12));return!!(t=a(r))}(t):function(e){var t=/^[1-9]\d{5}[1-9]\d{3}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\d{3}(\d|x|X)$/.test(e);if(!t)return!1;var o=e.substring(0,2);if(!(t=s(o)))return!1;var r=e.substring(6,14);return!!(t=a(r))&&d(e)}(t))},"zh-TW":function(e){var t={A:10,B:11,C:12,D:13,E:14,F:15,G:16,H:17,I:34,J:18,K:19,L:20,M:21,N:22,O:35,P:23,Q:24,R:25,S:26,T:27,U:28,V:29,W:32,X:30,Y:31,Z:33},o=e.trim().toUpperCase();return!!/^[A-Z][0-9]{9}$/.test(o)&&Array.from(o).reduce((function(e,o,r){if(0===r){var i=t[o];return i%10*9+Math.floor(i/10)}return 9===r?(10-e%10-Number(o))%10==0:e+Number(o)*(9-r)}),0)}};t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isIn.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t){var o;if((0,r.default)(e),"[object Array]"===Object.prototype.toString.call(t)){var s=[];for(o in t)({}).hasOwnProperty.call(t,o)&&(s[o]=(0,i.default)(t[o]));return s.indexOf(e)>=0}if("object"===a(t))return t.hasOwnProperty(e);if(t&&"function"==typeof t.indexOf)return t.indexOf(e)>=0;return!1};var r=s(e("./util/assertString")),i=s(e("./util/toString"));function s(e){return e&&e.__esModule?e:{default:e}}function a(e){return(a="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)}t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js","./util/toString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/toString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isInt.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t){(0,i.default)(e);var o=(t=t||{}).hasOwnProperty("allow_leading_zeroes")&&!t.allow_leading_zeroes?s:a,r=!t.hasOwnProperty("min")||e>=t.min,d=!t.hasOwnProperty("max")||e<=t.max,n=!t.hasOwnProperty("lt")||et.gt;return o.test(e)&&r&&d&&n&&l};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};var s=/^(?:[-+]?(?:0|[1-9][0-9]*))$/,a=/^[-+]?[0-9]+$/;t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isJSON.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t){(0,r.default)(e);try{t=(0,i.default)(t,d);var o=[];t.allow_primitives&&(o=[null,!1,!0]);var s=JSON.parse(e);return o.includes(s)||!!s&&"object"===a(s)}catch(e){}return!1};var r=s(e("./util/assertString")),i=s(e("./util/merge"));function s(e){return e&&e.__esModule?e:{default:e}}function a(e){return(a="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)}var d={allow_primitives:!1};t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js","./util/merge":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/merge.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isJWT.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){(0,r.default)(e);var t=e.split("."),o=t.length;if(o>3||o<2)return!1;return t.reduce((function(e,t){return e&&(0,i.default)(t,{urlSafe:!0})}),!0)};var r=s(e("./util/assertString")),i=s(e("./isBase64"));function s(e){return e&&e.__esModule?e:{default:e}}t.exports=o.default,t.exports.default=o.default},{"./isBase64":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isBase64.js","./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isLatLong.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t){if((0,r.default)(e),t=(0,i.default)(t,u),!e.includes(","))return!1;var o=e.split(",");if(o[0].startsWith("(")&&!o[1].endsWith(")")||o[1].endsWith(")")&&!o[0].startsWith("("))return!1;if(t.checkDMS)return n.test(o[0])&&l.test(o[1]);return a.test(o[0])&&d.test(o[1])};var r=s(e("./util/assertString")),i=s(e("./util/merge"));function s(e){return e&&e.__esModule?e:{default:e}}var a=/^\(?[+-]?(90(\.0+)?|[1-8]?\d(\.\d+)?)$/,d=/^\s?[+-]?(180(\.0+)?|1[0-7]\d(\.\d+)?|\d{1,2}(\.\d+)?)\)?$/,n=/^(([1-8]?\d)\D+([1-5]?\d|60)\D+([1-5]?\d|60)(\.\d+)?|90\D+0\D+0)\D+[NSns]?$/i,l=/^\s*([1-7]?\d{1,2}\D+([1-5]?\d|60)\D+([1-5]?\d|60)(\.\d+)?|180\D+0\D+0)\D+[EWew]?$/i,u={checkDMS:!1};t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js","./util/merge":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/merge.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isLength.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t){var o,r;(0,i.default)(e),"object"===s(t)?(o=t.min||0,r=t.max):(o=arguments[1]||0,r=arguments[2]);var a=e.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g)||[],d=e.length-a.length;return d>=o&&(void 0===r||d<=r)};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};function s(e){return(s="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)}t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isLocale.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){if((0,i.default)(e),"en_US_POSIX"===e||"ca_ES_VALENCIA"===e)return!0;return s.test(e)};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};var s=/^[A-z]{2,4}([_-]([A-z]{4}|[\d]{3}))?([_-]([A-z]{2}|[\d]{3}))?$/;t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isLowercase.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){return(0,i.default)(e),e===e.toLowerCase()};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isMACAddress.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t){if((0,i.default)(e),t&&t.no_colons)return a.test(e);return s.test(e)||d.test(e)||n.test(e)||l.test(e)};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};var s=/^([0-9a-fA-F][0-9a-fA-F]:){5}([0-9a-fA-F][0-9a-fA-F])$/,a=/^([0-9a-fA-F]){12}$/,d=/^([0-9a-fA-F][0-9a-fA-F]-){5}([0-9a-fA-F][0-9a-fA-F])$/,n=/^([0-9a-fA-F][0-9a-fA-F]\s){5}([0-9a-fA-F][0-9a-fA-F])$/,l=/^([0-9a-fA-F]{4}).([0-9a-fA-F]{4}).([0-9a-fA-F]{4})$/;t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isMD5.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){return(0,i.default)(e),s.test(e)};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};var s=/^[a-f0-9]{32}$/;t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isMagnetURI.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){return(0,i.default)(e),s.test(e.trim())};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};var s=/^magnet:\?xt=urn:[a-z0-9]+:[a-z0-9]{32,40}&dn=.+&tr=.+$/i;t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isMimeType.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){return(0,i.default)(e),s.test(e)||a.test(e)||d.test(e)};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};var s=/^(application|audio|font|image|message|model|multipart|text|video)\/[a-zA-Z0-9\.\-\+]{1,100}$/i,a=/^text\/[a-zA-Z0-9\.\-\+]{1,100};\s?charset=("[a-zA-Z0-9\.\-\+\s]{0,70}"|[a-zA-Z0-9\.\-\+]{0,70})(\s?\([a-zA-Z0-9\.\-\+\s]{1,20}\))?$/i,d=/^multipart\/[a-zA-Z0-9\.\-\+]{1,100}(;\s?(boundary|charset)=("[a-zA-Z0-9\.\-\+\s]{0,70}"|[a-zA-Z0-9\.\-\+]{0,70})(\s?\([a-zA-Z0-9\.\-\+\s]{1,20}\))?){0,2}$/i;t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isMobilePhone.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t,o){if((0,i.default)(e),o&&o.strictMode&&!e.startsWith("+"))return!1;if(Array.isArray(t))return t.some((function(t){if(s.hasOwnProperty(t)&&s[t].test(e))return!0;return!1}));if(t in s)return s[t].test(e);if(!t||"any"===t){for(var r in s){if(s.hasOwnProperty(r))if(s[r].test(e))return!0}return!1}throw new Error("Invalid locale '".concat(t,"'"))},o.locales=void 0;var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};var s={"am-AM":/^(\+?374|0)((10|[9|7][0-9])\d{6}$|[2-4]\d{7}$)/,"ar-AE":/^((\+?971)|0)?5[024568]\d{7}$/,"ar-BH":/^(\+?973)?(3|6)\d{7}$/,"ar-DZ":/^(\+?213|0)(5|6|7)\d{8}$/,"ar-LB":/^(\+?961)?((3|81)\d{6}|7\d{7})$/,"ar-EG":/^((\+?20)|0)?1[0125]\d{8}$/,"ar-IQ":/^(\+?964|0)?7[0-9]\d{8}$/,"ar-JO":/^(\+?962|0)?7[789]\d{7}$/,"ar-KW":/^(\+?965)[569]\d{7}$/,"ar-LY":/^((\+?218)|0)?(9[1-6]\d{7}|[1-8]\d{7,9})$/,"ar-MA":/^(?:(?:\+|00)212|0)[5-7]\d{8}$/,"ar-SA":/^(!?(\+?966)|0)?5\d{8}$/,"ar-SY":/^(!?(\+?963)|0)?9\d{8}$/,"ar-TN":/^(\+?216)?[2459]\d{7}$/,"az-AZ":/^(\+994|0)(5[015]|7[07]|99)\d{7}$/,"bs-BA":/^((((\+|00)3876)|06))((([0-3]|[5-6])\d{6})|(4\d{7}))$/,"be-BY":/^(\+?375)?(24|25|29|33|44)\d{7}$/,"bg-BG":/^(\+?359|0)?8[789]\d{7}$/,"bn-BD":/^(\+?880|0)1[13456789][0-9]{8}$/,"ca-AD":/^(\+376)?[346]\d{5}$/,"cs-CZ":/^(\+?420)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/,"da-DK":/^(\+?45)?\s?\d{2}\s?\d{2}\s?\d{2}\s?\d{2}$/,"de-DE":/^(\+49)?0?[1|3]([0|5][0-45-9]\d|6([23]|0\d?)|7([0-57-9]|6\d))\d{7}$/,"de-AT":/^(\+43|0)\d{1,4}\d{3,12}$/,"de-CH":/^(\+41|0)(7[5-9])\d{1,7}$/,"de-LU":/^(\+352)?((6\d1)\d{6})$/,"el-GR":/^(\+?30|0)?(69\d{8})$/,"en-AU":/^(\+?61|0)4\d{8}$/,"en-GB":/^(\+?44|0)7\d{9}$/,"en-GG":/^(\+?44|0)1481\d{6}$/,"en-GH":/^(\+233|0)(20|50|24|54|27|57|26|56|23|28)\d{7}$/,"en-HK":/^(\+?852[-\s]?)?[456789]\d{3}[-\s]?\d{4}$/,"en-MO":/^(\+?853[-\s]?)?[6]\d{3}[-\s]?\d{4}$/,"en-IE":/^(\+?353|0)8[356789]\d{7}$/,"en-IN":/^(\+?91|0)?[6789]\d{9}$/,"en-KE":/^(\+?254|0)(7|1)\d{8}$/,"en-MT":/^(\+?356|0)?(99|79|77|21|27|22|25)[0-9]{6}$/,"en-MU":/^(\+?230|0)?\d{8}$/,"en-NG":/^(\+?234|0)?[789]\d{9}$/,"en-NZ":/^(\+?64|0)[28]\d{7,9}$/,"en-PK":/^((\+92)|(0092))-{0,1}\d{3}-{0,1}\d{7}$|^\d{11}$|^\d{4}-\d{7}$/,"en-PH":/^(09|\+639)\d{9}$/,"en-RW":/^(\+?250|0)?[7]\d{8}$/,"en-SG":/^(\+65)?[689]\d{7}$/,"en-SL":/^(?:0|94|\+94)?(7(0|1|2|5|6|7|8)( |-)?\d)\d{6}$/,"en-TZ":/^(\+?255|0)?[67]\d{8}$/,"en-UG":/^(\+?256|0)?[7]\d{8}$/,"en-US":/^((\+1|1)?( |-)?)?(\([2-9][0-9]{2}\)|[2-9][0-9]{2})( |-)?([2-9][0-9]{2}( |-)?[0-9]{4})$/,"en-ZA":/^(\+?27|0)\d{9}$/,"en-ZM":/^(\+?26)?09[567]\d{7}$/,"en-ZW":/^(\+263)[0-9]{9}$/,"es-AR":/^\+?549(11|[2368]\d)\d{8}$/,"es-BO":/^(\+?591)?(6|7)\d{7}$/,"es-CO":/^(\+?57)?([1-8]{1}|3[0-9]{2})?[2-9]{1}\d{6}$/,"es-CL":/^(\+?56|0)[2-9]\d{1}\d{7}$/,"es-CR":/^(\+506)?[2-8]\d{7}$/,"es-DO":/^(\+?1)?8[024]9\d{7}$/,"es-HN":/^(\+?504)?[9|8]\d{7}$/,"es-EC":/^(\+?593|0)([2-7]|9[2-9])\d{7}$/,"es-ES":/^(\+?34)?[6|7]\d{8}$/,"es-PE":/^(\+?51)?9\d{8}$/,"es-MX":/^(\+?52)?(1|01)?\d{10,11}$/,"es-PA":/^(\+?507)\d{7,8}$/,"es-PY":/^(\+?595|0)9[9876]\d{7}$/,"es-UY":/^(\+598|0)9[1-9][\d]{6}$/,"et-EE":/^(\+?372)?\s?(5|8[1-4])\s?([0-9]\s?){6,7}$/,"fa-IR":/^(\+?98[\-\s]?|0)9[0-39]\d[\-\s]?\d{3}[\-\s]?\d{4}$/,"fi-FI":/^(\+?358|0)\s?(4(0|1|2|4|5|6)?|50)\s?(\d\s?){4,8}\d$/,"fj-FJ":/^(\+?679)?\s?\d{3}\s?\d{4}$/,"fo-FO":/^(\+?298)?\s?\d{2}\s?\d{2}\s?\d{2}$/,"fr-FR":/^(\+?33|0)[67]\d{8}$/,"fr-GF":/^(\+?594|0|00594)[67]\d{8}$/,"fr-GP":/^(\+?590|0|00590)[67]\d{8}$/,"fr-MQ":/^(\+?596|0|00596)[67]\d{8}$/,"fr-RE":/^(\+?262|0|00262)[67]\d{8}$/,"he-IL":/^(\+972|0)([23489]|5[012345689]|77)[1-9]\d{6}$/,"hu-HU":/^(\+?36)(20|30|70)\d{7}$/,"id-ID":/^(\+?62|0)8(1[123456789]|2[1238]|3[1238]|5[12356789]|7[78]|9[56789]|8[123456789])([\s?|\d]{5,11})$/,"it-IT":/^(\+?39)?\s?3\d{2} ?\d{6,7}$/,"it-SM":/^((\+378)|(0549)|(\+390549)|(\+3780549))?6\d{5,9}$/,"ja-JP":/^(\+81[ \-]?(\(0\))?|0)[6789]0[ \-]?\d{4}[ \-]?\d{4}$/,"ka-GE":/^(\+?995)?(5|79)\d{7}$/,"kk-KZ":/^(\+?7|8)?7\d{9}$/,"kl-GL":/^(\+?299)?\s?\d{2}\s?\d{2}\s?\d{2}$/,"ko-KR":/^((\+?82)[ \-]?)?0?1([0|1|6|7|8|9]{1})[ \-]?\d{3,4}[ \-]?\d{4}$/,"lt-LT":/^(\+370|8)\d{8}$/,"ms-MY":/^(\+?6?01){1}(([0145]{1}(\-|\s)?\d{7,8})|([236789]{1}(\s|\-)?\d{7}))$/,"nb-NO":/^(\+?47)?[49]\d{7}$/,"ne-NP":/^(\+?977)?9[78]\d{8}$/,"nl-BE":/^(\+?32|0)4?\d{8}$/,"nl-NL":/^(((\+|00)?31\(0\))|((\+|00)?31)|0)6{1}\d{8}$/,"nn-NO":/^(\+?47)?[49]\d{7}$/,"pl-PL":/^(\+?48)? ?[5-8]\d ?\d{3} ?\d{2} ?\d{2}$/,"pt-BR":/^((\+?55\ ?[1-9]{2}\ ?)|(\+?55\ ?\([1-9]{2}\)\ ?)|(0[1-9]{2}\ ?)|(\([1-9]{2}\)\ ?)|([1-9]{2}\ ?))((\d{4}\-?\d{4})|(9[2-9]{1}\d{3}\-?\d{4}))$/,"pt-PT":/^(\+?351)?9[1236]\d{7}$/,"ro-RO":/^(\+?4?0)\s?7\d{2}(\/|\s|\.|\-)?\d{3}(\s|\.|\-)?\d{3}$/,"ru-RU":/^(\+?7|8)?9\d{9}$/,"sl-SI":/^(\+386\s?|0)(\d{1}\s?\d{3}\s?\d{2}\s?\d{2}|\d{2}\s?\d{3}\s?\d{3})$/,"sk-SK":/^(\+?421)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/,"sq-AL":/^(\+355|0)6[789]\d{6}$/,"sr-RS":/^(\+3816|06)[- \d]{5,9}$/,"sv-SE":/^(\+?46|0)[\s\-]?7[\s\-]?[02369]([\s\-]?\d){7}$/,"th-TH":/^(\+66|66|0)\d{9}$/,"tr-TR":/^(\+?90|0)?5\d{9}$/,"uk-UA":/^(\+?38|8)?0\d{9}$/,"uz-UZ":/^(\+?998)?(6[125-79]|7[1-69]|88|9\d)\d{7}$/,"vi-VN":/^(\+?84|0)((3([2-9]))|(5([2689]))|(7([0|6-9]))|(8([1-6|89]))|(9([0-9])))([0-9]{7})$/,"zh-CN":/^((\+|00)86)?1([3568][0-9]|4[579]|6[67]|7[01235678]|9[012356789])[0-9]{8}$/,"zh-TW":/^(\+?886\-?|0)?9\d{8}$/};s["en-CA"]=s["en-US"],s["fr-CA"]=s["en-CA"],s["fr-BE"]=s["nl-BE"],s["zh-HK"]=s["en-HK"],s["zh-MO"]=s["en-MO"],s["ga-IE"]=s["en-IE"];var a=Object.keys(s);o.locales=a},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isMongoId.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){return(0,r.default)(e),(0,i.default)(e)&&24===e.length};var r=s(e("./util/assertString")),i=s(e("./isHexadecimal"));function s(e){return e&&e.__esModule?e:{default:e}}t.exports=o.default,t.exports.default=o.default},{"./isHexadecimal":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isHexadecimal.js","./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isMultibyte.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){return(0,i.default)(e),s.test(e)};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};var s=/[^\x00-\x7F]/;t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isNumeric.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t){if((0,i.default)(e),t&&t.no_symbols)return a.test(e);return new RegExp("^[+-]?([0-9]*[".concat((t||{}).locale?s.decimal[t.locale]:".","])?[0-9]+$")).test(e)};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r},s=e("./alpha");var a=/^[0-9]+$/;t.exports=o.default,t.exports.default=o.default},{"./alpha":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/alpha.js","./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isOctal.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){return(0,i.default)(e),s.test(e)};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};var s=/^(0o)?[0-7]+$/i;t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isPassportNumber.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t){(0,i.default)(e);var o=e.replace(/\s/g,"").toUpperCase();return t.toUpperCase()in s&&s[t].test(o)};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};var s={AM:/^[A-Z]{2}\d{7}$/,AR:/^[A-Z]{3}\d{6}$/,AT:/^[A-Z]\d{7}$/,AU:/^[A-Z]\d{7}$/,BE:/^[A-Z]{2}\d{6}$/,BG:/^\d{9}$/,BY:/^[A-Z]{2}\d{7}$/,CA:/^[A-Z]{2}\d{6}$/,CH:/^[A-Z]\d{7}$/,CN:/^[GE]\d{8}$/,CY:/^[A-Z](\d{6}|\d{8})$/,CZ:/^\d{8}$/,DE:/^[CFGHJKLMNPRTVWXYZ0-9]{9}$/,DK:/^\d{9}$/,DZ:/^\d{9}$/,EE:/^([A-Z]\d{7}|[A-Z]{2}\d{7})$/,ES:/^[A-Z0-9]{2}([A-Z0-9]?)\d{6}$/,FI:/^[A-Z]{2}\d{7}$/,FR:/^\d{2}[A-Z]{2}\d{5}$/,GB:/^\d{9}$/,GR:/^[A-Z]{2}\d{7}$/,HR:/^\d{9}$/,HU:/^[A-Z]{2}(\d{6}|\d{7})$/,IE:/^[A-Z0-9]{2}\d{7}$/,IN:/^[A-Z]{1}-?\d{7}$/,IS:/^(A)\d{7}$/,IT:/^[A-Z0-9]{2}\d{7}$/,JP:/^[A-Z]{2}\d{7}$/,KR:/^[MS]\d{8}$/,LT:/^[A-Z0-9]{8}$/,LU:/^[A-Z0-9]{8}$/,LV:/^[A-Z0-9]{2}\d{7}$/,MT:/^\d{7}$/,NL:/^[A-Z]{2}[A-Z0-9]{6}\d$/,PO:/^[A-Z]{2}\d{7}$/,PT:/^[A-Z]\d{6}$/,RO:/^\d{8,9}$/,RU:/^\d{2}\d{2}\d{6}$/,SE:/^\d{8}$/,SL:/^(P)[A-Z]\d{7}$/,SK:/^[0-9A-Z]\d{7}$/,TR:/^[A-Z]\d{8}$/,UA:/^[A-Z]{2}\d{6}$/,US:/^\d{9}$/};t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isPort.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){return(0,i.default)(e,{min:0,max:65535})};var r,i=(r=e("./isInt"))&&r.__esModule?r:{default:r};t.exports=o.default,t.exports.default=o.default},{"./isInt":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isInt.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isPostalCode.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t){if((0,i.default)(e),t in n)return n[t].test(e);if("any"===t){for(var o in n){if(n.hasOwnProperty(o))if(n[o].test(e))return!0}return!1}throw new Error("Invalid locale '".concat(t,"'"))},o.locales=void 0;var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};var s=/^\d{4}$/,a=/^\d{5}$/,d=/^\d{6}$/,n={AD:/^AD\d{3}$/,AT:s,AU:s,AZ:/^AZ\d{4}$/,BE:s,BG:s,BR:/^\d{5}-\d{3}$/,BY:/2[1-4]{1}\d{4}$/,CA:/^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJ-NPRSTV-Z][\s\-]?\d[ABCEGHJ-NPRSTV-Z]\d$/i,CH:s,CN:/^(0[1-7]|1[012356]|2[0-7]|3[0-6]|4[0-7]|5[1-7]|6[1-7]|7[1-5]|8[1345]|9[09])\d{4}$/,CZ:/^\d{3}\s?\d{2}$/,DE:a,DK:s,DO:a,DZ:a,EE:a,ES:/^(5[0-2]{1}|[0-4]{1}\d{1})\d{3}$/,FI:a,FR:/^\d{2}\s?\d{3}$/,GB:/^(gir\s?0aa|[a-z]{1,2}\d[\da-z]?\s?(\d[a-z]{2})?)$/i,GR:/^\d{3}\s?\d{2}$/,HR:/^([1-5]\d{4}$)/,HT:/^HT\d{4}$/,HU:s,ID:a,IE:/^(?!.*(?:o))[A-z]\d[\dw]\s\w{4}$/i,IL:/^(\d{5}|\d{7})$/,IN:/^((?!10|29|35|54|55|65|66|86|87|88|89)[1-9][0-9]{5})$/,IR:/\b(?!(\d)\1{3})[13-9]{4}[1346-9][013-9]{5}\b/,IS:/^\d{3}$/,IT:a,JP:/^\d{3}\-\d{4}$/,KE:a,LI:/^(948[5-9]|949[0-7])$/,LT:/^LT\-\d{5}$/,LU:s,LV:/^LV\-\d{4}$/,MX:a,MT:/^[A-Za-z]{3}\s{0,1}\d{4}$/,MY:a,NL:/^\d{4}\s?[a-z]{2}$/i,NO:s,NP:/^(10|21|22|32|33|34|44|45|56|57)\d{3}$|^(977)$/i,NZ:s,PL:/^\d{2}\-\d{3}$/,PR:/^00[679]\d{2}([ -]\d{4})?$/,PT:/^\d{4}\-\d{3}?$/,RO:d,RU:d,SA:a,SE:/^[1-9]\d{2}\s?\d{2}$/,SG:d,SI:s,SK:/^\d{3}\s?\d{2}$/,TH:a,TN:s,TW:/^\d{3}(\d{2})?$/,UA:a,US:/^\d{5}(-\d{4})?$/,ZA:s,ZM:a},l=Object.keys(n);o.locales=l},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isRFC3339.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){return(0,i.default)(e),m.test(e)};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};var s=/([01][0-9]|2[0-3])/,a=/[0-5][0-9]/,d=new RegExp("[-+]".concat(s.source,":").concat(a.source)),n=new RegExp("([zZ]|".concat(d.source,")")),l=new RegExp("".concat(s.source,":").concat(a.source,":").concat(/([0-5][0-9]|60)/.source).concat(/(\.[0-9]+)?/.source)),u=new RegExp("".concat(/[0-9]{4}/.source,"-").concat(/(0[1-9]|1[0-2])/.source,"-").concat(/([12]\d|0[1-9]|3[01])/.source)),c=new RegExp("".concat(l.source).concat(n.source)),m=new RegExp("".concat(u.source,"[ tT]").concat(c.source));t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isRgbColor.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if((0,i.default)(e),!t)return s.test(e)||a.test(e);return s.test(e)||a.test(e)||d.test(e)||n.test(e)};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};var s=/^rgb\((([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]),){2}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\)$/,a=/^rgba\((([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]),){3}(0?\.\d|1(\.0)?|0(\.0)?)\)$/,d=/^rgb\((([0-9]%|[1-9][0-9]%|100%),){2}([0-9]%|[1-9][0-9]%|100%)\)/,n=/^rgba\((([0-9]%|[1-9][0-9]%|100%),){3}(0?\.\d|1(\.0)?|0(\.0)?)\)/;t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isSemVer.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){return(0,r.default)(e),s.test(e)};var r=i(e("./util/assertString"));function i(e){return e&&e.__esModule?e:{default:e}}var s=(0,i(e("./util/multilineRegex")).default)(["^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)","(?:-((?:0|[1-9]\\d*|\\d*[a-z-][0-9a-z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-z-][0-9a-z-]*))*))","?(?:\\+([0-9a-z-]+(?:\\.[0-9a-z-]+)*))?$"],"i");t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js","./util/multilineRegex":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/multilineRegex.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isSlug.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){return(0,i.default)(e),s.test(e)};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};var s=/^[^\s-_](?!.*?[-_]{2,})([a-z0-9-\\]{1,})[^\s]*[^-_\s]$/;t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isStrongPassword.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;(0,i.default)(e);var o=c(e);if((t=(0,r.default)(t||{},u)).returnScore)return m(o,t);return o.length>=t.minLength&&o.lowercaseCount>=t.minLowercase&&o.uppercaseCount>=t.minUppercase&&o.numberCount>=t.minNumbers&&o.symbolCount>=t.minSymbols};var r=s(e("./util/merge")),i=s(e("./util/assertString"));function s(e){return e&&e.__esModule?e:{default:e}}var a=/^[A-Z]$/,d=/^[a-z]$/,n=/^[0-9]$/,l=/^[-#!$%^&*()_+|~=`{}\[\]:";'<>?,.\/ ]$/,u={minLength:8,minLowercase:1,minUppercase:1,minNumbers:1,minSymbols:1,returnScore:!1,pointsPerUnique:1,pointsPerRepeat:.5,pointsForContainingLower:10,pointsForContainingUpper:10,pointsForContainingNumber:10,pointsForContainingSymbol:10};function c(e){var t,o,r=(t=e,o={},Array.from(t).forEach((function(e){o[e]?o[e]+=1:o[e]=1})),o),i={length:e.length,uniqueChars:Object.keys(r).length,uppercaseCount:0,lowercaseCount:0,numberCount:0,symbolCount:0};return Object.keys(r).forEach((function(e){a.test(e)?i.uppercaseCount+=r[e]:d.test(e)?i.lowercaseCount+=r[e]:n.test(e)?i.numberCount+=r[e]:l.test(e)&&(i.symbolCount+=r[e])})),i}function m(e,t){var o=0;return o+=e.uniqueChars*t.pointsPerUnique,o+=(e.length-e.uniqueChars)*t.pointsPerRepeat,e.lowercaseCount>0&&(o+=t.pointsForContainingLower),e.uppercaseCount>0&&(o+=t.pointsForContainingUpper),e.numberCount>0&&(o+=t.pointsForContainingNumber),e.symbolCount>0&&(o+=t.pointsForContainingSymbol),o}t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js","./util/merge":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/merge.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isSurrogatePair.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){return(0,i.default)(e),s.test(e)};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};var s=/[\uD800-\uDBFF][\uDC00-\uDFFF]/;t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isTaxID.js":[function(e,t,o){"use strict";function r(e){return(r="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)}Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en-US";(0,i.default)(e);var o=e.slice(0);if(t in p)return t in v&&(o=o.replace(v[t],"")),!!p[t].test(o)&&(!(t in f)||f[t](o));throw new Error("Invalid locale '".concat(t,"'"))};var i=n(e("./util/assertString")),s=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!==r(e)&&"function"!=typeof e)return{default:e};var t=d();if(t&&t.has(e))return t.get(e);var o={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){var a=i?Object.getOwnPropertyDescriptor(e,s):null;a&&(a.get||a.set)?Object.defineProperty(o,s,a):o[s]=e[s]}o.default=e,t&&t.set(e,o);return o}(e("./util/algorithms")),a=n(e("./isDate"));function d(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return d=function(){return e},e}function n(e){return e&&e.__esModule?e:{default:e}}function l(e){return function(e){if(Array.isArray(e))return u(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return u(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);"Object"===o&&e.constructor&&(o=e.constructor.name);if("Map"===o||"Set"===o)return Array.from(e);if("Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return u(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,r=new Array(t);o0){if(t&&!o&&!/[AEIOU]/.test(e[r]))return!1;if(o&&!/X/.test(e[r]))return!1}return!0}var p={"bg-BG":/^\d{10}$/,"cs-CZ":/^\d{6}\/{0,1}\d{3,4}$/,"de-AT":/^\d{9}$/,"de-DE":/^[1-9]\d{10}$/,"dk-DK":/^\d{6}-{0,1}\d{4}$/,"el-CY":/^[09]\d{7}[A-Z]$/,"el-GR":/^([0-4]|[7-9])\d{8}$/,"en-GB":/^\d{10}$|^(?!GB|NK|TN|ZZ)(?![DFIQUV])[A-Z](?![DFIQUVO])[A-Z]\d{6}[ABCD ]$/i,"en-IE":/^\d{7}[A-W][A-IW]{0,1}$/i,"en-US":/^\d{2}[- ]{0,1}\d{7}$/,"es-ES":/^(\d{0,8}|[XYZKLM]\d{7})[A-HJ-NP-TV-Z]$/i,"et-EE":/^[1-6]\d{6}(00[1-9]|0[1-9][0-9]|[1-6][0-9]{2}|70[0-9]|710)\d$/,"fi-FI":/^\d{6}[-+A]\d{3}[0-9A-FHJ-NPR-Y]$/i,"fr-BE":/^\d{11}$/,"fr-FR":/^[0-3]\d{12}$|^[0-3]\d\s\d{2}(\s\d{3}){3}$/,"fr-LU":/^\d{13}$/,"hr-HR":/^\d{11}$/,"hu-HU":/^8\d{9}$/,"it-IT":/^[A-Z]{6}[L-NP-V0-9]{2}[A-EHLMPRST][L-NP-V0-9]{2}[A-ILMZ][L-NP-V0-9]{3}[A-Z]$/i,"lv-LV":/^\d{6}-{0,1}\d{5}$/,"mt-MT":/^\d{3,7}[APMGLHBZ]$|^([1-8])\1\d{7}$/i,"nl-NL":/^\d{9}$/,"pl-PL":/^\d{10,11}$/,"pt-PT":/^\d{9}$/,"ro-RO":/^\d{13}$/,"sk-SK":/^\d{6}\/{0,1}\d{3,4}$/,"sl-SI":/^[1-9]\d{7}$/,"sv-SE":/^(\d{6}[-+]{0,1}\d{4}|(18|19|20)\d{6}[-+]{0,1}\d{4})$/};p["lb-LU"]=p["fr-LU"],p["lt-LT"]=p["et-EE"],p["nl-BE"]=p["fr-BE"];var f={"bg-BG":function(e){var t=e.slice(0,2),o=parseInt(e.slice(2,4),10);o>40?(o-=40,t="20".concat(t)):o>20?(o-=20,t="18".concat(t)):t="19".concat(t),o<10&&(o="0".concat(o));var r="".concat(t,"/").concat(o,"/").concat(e.slice(4,6));if(!(0,a.default)(r,"YYYY/MM/DD"))return!1;for(var i=e.split("").map((function(e){return parseInt(e,10)})),s=[2,4,8,5,10,9,7,3,6],d=0,n=0;n50&&(o-=50),o>20){if(parseInt(t,10)<2004)return!1;o-=20}o<10&&(o="0".concat(o));var r="".concat(t,"/").concat(o,"/").concat(e.slice(4,6));if(!(0,a.default)(r,"YYYY/MM/DD"))return!1;if(10===e.length&&parseInt(e,10)%11!=0){var i=parseInt(e.slice(0,9),10)%11;if(!(parseInt(t,10)<1986&&10===i))return!1;if(0!==parseInt(e.slice(9),10))return!1}return!0},"de-AT":function(e){return s.luhnCheck(e)},"de-DE":function(e){for(var t=e.split("").map((function(e){return parseInt(e,10)})),o=[],r=0;r1}))).length&&3!==o.length)return!1;if(3===o[0].length){for(var a=o[0].split("").map((function(e){return parseInt(e,10)})),d=0,n=0;n58))return!1;t="18".concat(t)}}3===t.length&&(t=[t.slice(0,2),"0",t.slice(2)].join(""));var o="".concat(t,"/").concat(e.slice(2,4),"/").concat(e.slice(0,2));if(!(0,a.default)(o,"YYYY/MM/DD"))return!1;for(var r=e.split("").map((function(e){return parseInt(e,10)})),i=0,s=4,d=0;d<9;d++)i+=r[d]*s,1===(s-=1)&&(s=7);return 1!==(i%=11)&&(0===i?0===r[9]:r[9]===11-i)},"el-CY":function(e){for(var t=e.slice(0,8).split("").map((function(e){return parseInt(e,10)})),o=0,r=1;r4&&(o+=2));return String.fromCharCode(o%26+65)===e.charAt(8)},"el-GR":function(e){for(var t=e.split("").map((function(e){return parseInt(e,10)})),o=0,r=0;r<8;r++)o+=t[r]*Math.pow(2,8-r);return o%11===t[8]},"en-IE":function(e){var t=s.reverseMultiplyAndSum(e.split("").slice(0,7).map((function(e){return parseInt(e,10)})),8);return 9===e.length&&"W"!==e[8]&&(t+=9*(e[8].charCodeAt(0)-64)),0===(t%=23)?"W"===e[7].toUpperCase():e[7].toUpperCase()===String.fromCharCode(64+t)},"en-US":function(e){return-1!==function(){var e=[];for(var t in c)c.hasOwnProperty(t)&&e.push.apply(e,l(c[t]));return e}().indexOf(e.substr(0,2))},"es-ES":function(e){var t=e.toUpperCase().split("");if(isNaN(parseInt(t[0],10))&&t.length>1){var o=0;switch(t[0]){case"Y":o=1;break;case"Z":o=2}t.splice(0,1,o)}else for(;t.length<9;)t.unshift(0);t=t.join("");var r=parseInt(t.slice(0,8),10)%23;return t[8]===["T","R","W","A","G","M","Y","F","P","D","X","B","N","J","Z","S","Q","V","H","L","C","K","E"][r]},"et-EE":function(e){var t=e.slice(1,3);switch(e.slice(0,1)){case"1":case"2":t="18".concat(t);break;case"3":case"4":t="19".concat(t);break;default:t="20".concat(t)}var o="".concat(t,"/").concat(e.slice(3,5),"/").concat(e.slice(5,7));if(!(0,a.default)(o,"YYYY/MM/DD"))return!1;for(var r=e.split("").map((function(e){return parseInt(e,10)})),i=0,s=1,d=0;d<10;d++)i+=r[d]*s,10===(s+=1)&&(s=1);if(i%11==10){i=0,s=3;for(var n=0;n<10;n++)i+=r[n]*s,10===(s+=1)&&(s=1);if(i%11==10)return 0===r[10]}return i%11===r[10]},"fi-FI":function(e){var t=e.slice(4,6);switch(e.slice(6,7)){case"+":t="18".concat(t);break;case"-":t="19".concat(t);break;default:t="20".concat(t)}var o="".concat(t,"/").concat(e.slice(2,4),"/").concat(e.slice(0,2));if(!(0,a.default)(o,"YYYY/MM/DD"))return!1;var r=parseInt(e.slice(0,6)+e.slice(7,10),10)%31;return r<10?r===parseInt(e.slice(10),10):["A","B","C","D","E","F","H","J","K","L","M","N","P","R","S","T","U","V","W","X","Y"][r-=10]===e.slice(10)},"fr-BE":function(e){if("00"!==e.slice(2,4)||"00"!==e.slice(4,6)){var t="".concat(e.slice(0,2),"/").concat(e.slice(2,4),"/").concat(e.slice(4,6));if(!(0,a.default)(t,"YY/MM/DD"))return!1}var o=97-parseInt(e.slice(0,9),10)%97,r=parseInt(e.slice(9,11),10);return o===r||(o=97-parseInt("2".concat(e.slice(0,9)),10)%97)===r},"fr-FR":function(e){return e=e.replace(/\s/g,""),parseInt(e.slice(0,10),10)%511===parseInt(e.slice(10,13),10)},"fr-LU":function(e){var t="".concat(e.slice(0,4),"/").concat(e.slice(4,6),"/").concat(e.slice(6,8));return!!(0,a.default)(t,"YYYY/MM/DD")&&(!!s.luhnCheck(e.slice(0,12))&&s.verhoeffCheck("".concat(e.slice(0,11)).concat(e[12])))},"hr-HR":function(e){return s.iso7064Check(e)},"hu-HU":function(e){for(var t=e.split("").map((function(e){return parseInt(e,10)})),o=8,r=1;r<9;r++)o+=t[r]*(r+1);return o%11===t[9]},"it-IT":function(e){var t=e.toUpperCase().split("");if(!m(t.slice(0,3)))return!1;if(!m(t.slice(3,6)))return!1;for(var o={L:"0",M:"1",N:"2",P:"3",Q:"4",R:"5",S:"6",T:"7",U:"8",V:"9"},r=0,i=[6,7,9,10,12,13,14];r40&&(n-=40),n<10&&(n="0".concat(n));var l="".concat(t[6]).concat(t[7],"/").concat(d,"/").concat(n);if(!(0,a.default)(l,"YY/MM/DD"))return!1;for(var u=0,c=1;c4&&(v+=2)}u+=v}return String.fromCharCode(65+u%26)===t[15]},"lv-LV":function(e){var t=(e=e.replace(/\W/,"")).slice(0,2);if("32"!==t){if("00"!==e.slice(2,4)){var o=e.slice(4,6);switch(e[6]){case"0":o="18".concat(o);break;case"1":o="19".concat(o);break;default:o="20".concat(o)}var r="".concat(o,"/").concat(e.slice(2,4),"/").concat(t);if(!(0,a.default)(r,"YYYY/MM/DD"))return!1}for(var i=1101,s=[1,6,3,7,9,10,5,8,4,2],d=0;d32e3)return!1;if(o===parseInt(t.join("").slice(5,7),10))return!1}}return!0},"nl-NL":function(e){return s.reverseMultiplyAndSum(e.split("").slice(0,8).map((function(e){return parseInt(e,10)})),9)%11===parseInt(e[8],10)},"pl-PL":function(e){if(10===e.length){for(var t=[6,5,7,2,3,4,5,6,7],o=0,r=0;r80?(i="18".concat(i),s-=80):s>60?(i="22".concat(i),s-=60):s>40?(i="21".concat(i),s-=40):s>20?(i="20".concat(i),s-=20):i="19".concat(i),s<10&&(s="0".concat(s));var d="".concat(i,"/").concat(s,"/").concat(e.slice(4,6));if(!(0,a.default)(d,"YYYY/MM/DD"))return!1;for(var n=0,l=1,u=0;u10?l=1:5===l&&(l+=2);return(n=10-n%10)===parseInt(e[10],10)},"pt-PT":function(e){var t=11-s.reverseMultiplyAndSum(e.split("").slice(0,8).map((function(e){return parseInt(e,10)})),9)%11;return t>9?0===parseInt(e[8],10):t===parseInt(e[8],10)},"ro-RO":function(e){if("9000"!==e.slice(0,4)){var t=e.slice(1,3);switch(e[0]){case"1":case"2":t="19".concat(t);break;case"3":case"4":t="18".concat(t);break;case"5":case"6":t="20".concat(t)}var o="".concat(t,"/").concat(e.slice(3,5),"/").concat(e.slice(5,7));if(8===o.length){if(!(0,a.default)(o,"YY/MM/DD"))return!1}else if(!(0,a.default)(o,"YYYY/MM/DD"))return!1;for(var r=e.split("").map((function(e){return parseInt(e,10)})),i=[2,7,9,1,4,6,3,5,8,2,7,9],s=0,d=0;d53)return!1;t=t<10?"190".concat(t):"19".concat(t);var o=parseInt(e.slice(2,4),10);o>50&&(o-=50),o<10&&(o="0".concat(o));var r="".concat(t,"/").concat(o,"/").concat(e.slice(4,6));if(!(0,a.default)(r,"YYYY/MM/DD"))return!1}return!0},"sl-SI":function(e){var t=11-s.reverseMultiplyAndSum(e.split("").slice(0,7).map((function(e){return parseInt(e,10)})),8)%11;return 10===t?0===parseInt(e[7],10):t===parseInt(e[7],10)},"sv-SE":function(e){var t=e.slice(0);e.length>11&&(t=t.slice(2));var o="",r=t.slice(2,4),i=parseInt(t.slice(4,6),10);if(e.length>11)o=e.slice(0,4);else if(o=e.slice(0,2),11===e.length&&i<60){var d=(new Date).getFullYear().toString(),n=parseInt(d.slice(0,2),10);if(d=parseInt(d,10),"-"===e[6])o=parseInt("".concat(n).concat(o),10)>d?"".concat(n-1).concat(o):"".concat(n).concat(o);else if(o="".concat(n-1).concat(o),d-parseInt(o,10)<100)return!1}i>60&&(i-=60),i<10&&(i="0".concat(i));var l="".concat(o,"/").concat(r,"/").concat(i);if(8===l.length){if(!(0,a.default)(l,"YY/MM/DD"))return!1}else if(!(0,a.default)(l,"YYYY/MM/DD"))return!1;return s.luhnCheck(e.replace(/\W/,""))}};f["lb-LU"]=f["fr-LU"],f["lt-LT"]=f["et-EE"],f["nl-BE"]=f["fr-BE"];var h=/[-\\\/!@#$%\^&\*\(\)\+\=\[\]]+/g,v={"de-AT":h,"de-DE":/[\/\\]/g,"fr-BE":h};v["nl-BE"]=v["fr-BE"],t.exports=o.default,t.exports.default=o.default},{"./isDate":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isDate.js","./util/algorithms":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/algorithms.js","./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isURL.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t){if((0,r.default)(e),!e||/[\s<>]/.test(e))return!1;if(0===e.indexOf("mailto:"))return!1;if((t=(0,a.default)(t,n)).validate_length&&e.length>=2083)return!1;var o,d,c,m,p,f,h,v;if(h=e.split("#"),e=h.shift(),h=e.split("?"),e=h.shift(),(h=e.split("://")).length>1){if(o=h.shift().toLowerCase(),t.require_valid_protocol&&-1===t.protocols.indexOf(o))return!1}else{if(t.require_protocol)return!1;if("//"===e.substr(0,2)){if(!t.allow_protocol_relative_urls)return!1;h[0]=e.substr(2)}}if(""===(e=h.join("://")))return!1;if(h=e.split("/"),""===(e=h.shift())&&!t.require_host)return!0;if((h=e.split("@")).length>1){if(t.disallow_auth)return!1;if(-1===(d=h.shift()).indexOf(":")||d.indexOf(":")>=0&&d.split(":").length>2)return!1}m=h.join("@"),f=null,v=null;var y=m.match(l);y?(c="",v=y[1],f=y[2]||null):(h=m.split(":"),c=h.shift(),h.length&&(f=h.join(":")));if(null!==f){if(p=parseInt(f,10),!/^[0-9]+$/.test(f)||p<=0||p>65535)return!1}else if(t.require_port)return!1;if(!((0,s.default)(c)||(0,i.default)(c,t)||v&&(0,s.default)(v,6)))return!1;if(c=c||v,t.host_whitelist&&!u(c,t.host_whitelist))return!1;if(t.host_blacklist&&u(c,t.host_blacklist))return!1;return!0};var r=d(e("./util/assertString")),i=d(e("./isFQDN")),s=d(e("./isIP")),a=d(e("./util/merge"));function d(e){return e&&e.__esModule?e:{default:e}}var n={protocols:["http","https","ftp"],require_tld:!0,require_protocol:!1,require_host:!0,require_port:!1,require_valid_protocol:!0,allow_underscores:!1,allow_trailing_dot:!1,allow_protocol_relative_urls:!1,validate_length:!0},l=/^\[([^\]]+)\](?::([0-9]+))?$/;function u(e,t){for(var o=0;o1&&void 0!==arguments[1]?arguments[1]:"all";(0,i.default)(e);var o=s[t];return o&&o.test(e)};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};var s={3:/^[0-9A-F]{8}-[0-9A-F]{4}-3[0-9A-F]{3}-[0-9A-F]{4}-[0-9A-F]{12}$/i,4:/^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,5:/^[0-9A-F]{8}-[0-9A-F]{4}-5[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,all:/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i};t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isUppercase.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){return(0,i.default)(e),e===e.toUpperCase()};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isVAT.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t){if((0,i.default)(e),(0,i.default)(t),t in s)return s[t].test(e);throw new Error("Invalid country code: '".concat(t,"'"))},o.vatMatchers=void 0;var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};var s={GB:/^GB((\d{3} \d{4} ([0-8][0-9]|9[0-6]))|(\d{9} \d{3})|(((GD[0-4])|(HA[5-9]))[0-9]{2}))$/};o.vatMatchers=s},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isVariableWidth.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){return(0,i.default)(e),s.fullWidth.test(e)&&a.halfWidth.test(e)};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r},s=e("./isFullWidth"),a=e("./isHalfWidth");t.exports=o.default,t.exports.default=o.default},{"./isFullWidth":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isFullWidth.js","./isHalfWidth":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isHalfWidth.js","./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isWhitelisted.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t){(0,i.default)(e);for(var o=e.length-1;o>=0;o--)if(-1===t.indexOf(e[o]))return!1;return!0};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/ltrim.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t){(0,i.default)(e);var o=t?new RegExp("^[".concat(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"]+"),"g"):/^\s+/g;return e.replace(o,"")};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/matches.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t,o){(0,i.default)(e),"[object RegExp]"!==Object.prototype.toString.call(t)&&(t=new RegExp(t,o));return t.test(e)};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/normalizeEmail.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t){t=(0,i.default)(t,s);var o=e.split("@"),r=o.pop(),c=[o.join("@"),r];if(c[1]=c[1].toLowerCase(),"gmail.com"===c[1]||"googlemail.com"===c[1]){if(t.gmail_remove_subaddress&&(c[0]=c[0].split("+")[0]),t.gmail_remove_dots&&(c[0]=c[0].replace(/\.+/g,u)),!c[0].length)return!1;(t.all_lowercase||t.gmail_lowercase)&&(c[0]=c[0].toLowerCase()),c[1]=t.gmail_convert_googlemaildotcom?"gmail.com":c[1]}else if(a.indexOf(c[1])>=0){if(t.icloud_remove_subaddress&&(c[0]=c[0].split("+")[0]),!c[0].length)return!1;(t.all_lowercase||t.icloud_lowercase)&&(c[0]=c[0].toLowerCase())}else if(d.indexOf(c[1])>=0){if(t.outlookdotcom_remove_subaddress&&(c[0]=c[0].split("+")[0]),!c[0].length)return!1;(t.all_lowercase||t.outlookdotcom_lowercase)&&(c[0]=c[0].toLowerCase())}else if(n.indexOf(c[1])>=0){if(t.yahoo_remove_subaddress){var m=c[0].split("-");c[0]=m.length>1?m.slice(0,-1).join("-"):m[0]}if(!c[0].length)return!1;(t.all_lowercase||t.yahoo_lowercase)&&(c[0]=c[0].toLowerCase())}else l.indexOf(c[1])>=0?((t.all_lowercase||t.yandex_lowercase)&&(c[0]=c[0].toLowerCase()),c[1]="yandex.ru"):t.all_lowercase&&(c[0]=c[0].toLowerCase());return c.join("@")};var r,i=(r=e("./util/merge"))&&r.__esModule?r:{default:r};var s={all_lowercase:!0,gmail_lowercase:!0,gmail_remove_dots:!0,gmail_remove_subaddress:!0,gmail_convert_googlemaildotcom:!0,outlookdotcom_lowercase:!0,outlookdotcom_remove_subaddress:!0,yahoo_lowercase:!0,yahoo_remove_subaddress:!0,yandex_lowercase:!0,icloud_lowercase:!0,icloud_remove_subaddress:!0},a=["icloud.com","me.com"],d=["hotmail.at","hotmail.be","hotmail.ca","hotmail.cl","hotmail.co.il","hotmail.co.nz","hotmail.co.th","hotmail.co.uk","hotmail.com","hotmail.com.ar","hotmail.com.au","hotmail.com.br","hotmail.com.gr","hotmail.com.mx","hotmail.com.pe","hotmail.com.tr","hotmail.com.vn","hotmail.cz","hotmail.de","hotmail.dk","hotmail.es","hotmail.fr","hotmail.hu","hotmail.id","hotmail.ie","hotmail.in","hotmail.it","hotmail.jp","hotmail.kr","hotmail.lv","hotmail.my","hotmail.ph","hotmail.pt","hotmail.sa","hotmail.sg","hotmail.sk","live.be","live.co.uk","live.com","live.com.ar","live.com.mx","live.de","live.es","live.eu","live.fr","live.it","live.nl","msn.com","outlook.at","outlook.be","outlook.cl","outlook.co.il","outlook.co.nz","outlook.co.th","outlook.com","outlook.com.ar","outlook.com.au","outlook.com.br","outlook.com.gr","outlook.com.pe","outlook.com.tr","outlook.com.vn","outlook.cz","outlook.de","outlook.dk","outlook.es","outlook.fr","outlook.hu","outlook.id","outlook.ie","outlook.in","outlook.it","outlook.jp","outlook.kr","outlook.lv","outlook.my","outlook.ph","outlook.pt","outlook.sa","outlook.sg","outlook.sk","passport.com"],n=["rocketmail.com","yahoo.ca","yahoo.co.uk","yahoo.com","yahoo.de","yahoo.fr","yahoo.in","yahoo.it","ymail.com"],l=["yandex.ru","yandex.ua","yandex.kz","yandex.com","yandex.by","ya.ru"];function u(e){return e.length>1?e:""}t.exports=o.default,t.exports.default=o.default},{"./util/merge":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/merge.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/rtrim.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t){(0,i.default)(e);var o=t?new RegExp("[".concat(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"]+$"),"g"):/\s+$/g;return e.replace(o,"")};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/stripLow.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t){(0,r.default)(e);var o=t?"\\x00-\\x09\\x0B\\x0C\\x0E-\\x1F\\x7F":"\\x00-\\x1F\\x7F";return(0,i.default)(e,o)};var r=s(e("./util/assertString")),i=s(e("./blacklist"));function s(e){return e&&e.__esModule?e:{default:e}}t.exports=o.default,t.exports.default=o.default},{"./blacklist":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/blacklist.js","./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/toBoolean.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t){if((0,i.default)(e),t)return"1"===e||/^true$/i.test(e);return"0"!==e&&!/^false$/i.test(e)&&""!==e};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/toDate.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){return(0,i.default)(e),e=Date.parse(e),isNaN(e)?null:new Date(e)};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/toFloat.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){return(0,i.default)(e)?parseFloat(e):NaN};var r,i=(r=e("./isFloat"))&&r.__esModule?r:{default:r};t.exports=o.default,t.exports.default=o.default},{"./isFloat":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/isFloat.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/toInt.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t){return(0,i.default)(e),parseInt(e,t||10)};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/trim.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t){return(0,r.default)((0,i.default)(e,t),t)};var r=s(e("./rtrim")),i=s(e("./ltrim"));function s(e){return e&&e.__esModule?e:{default:e}}t.exports=o.default,t.exports.default=o.default},{"./ltrim":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/ltrim.js","./rtrim":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/rtrim.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/unescape.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){return(0,i.default)(e),e.replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">").replace(///g,"/").replace(/\/g,"\\").replace(/`/g,"`")};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/algorithms.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.iso7064Check=function(e){for(var t=10,o=0;o=0;r--){if(o){var i=2*parseInt(e[r],10);t+=i>9?i.toString().split("").map((function(e){return parseInt(e,10)})).reduce((function(e,t){return e+t}),0):i}else t+=parseInt(e[r],10);o=!o}return t%10==0},o.reverseMultiplyAndSum=function(e,t){for(var o=0,r=0;r0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;for(var o in t)void 0===e[o]&&(e[o]=t[o]);return e},t.exports=o.default,t.exports.default=o.default},{}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/multilineRegex.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t){var o=e.join("");return new RegExp(o,t)},t.exports=o.default,t.exports.default=o.default},{}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/toString.js":[function(e,t,o){"use strict";function r(e){return(r="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)}Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e){"object"===r(e)&&null!==e?e="function"==typeof e.toString?e.toString():"[object Object]":(null==e||isNaN(e)&&!e.length)&&(e="");return String(e)},t.exports=o.default,t.exports.default=o.default},{}],"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/whitelist.js":[function(e,t,o){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.default=function(e,t){return(0,i.default)(e),e.replace(new RegExp("[^".concat(t,"]+"),"g"),"")};var r,i=(r=e("./util/assertString"))&&r.__esModule?r:{default:r};t.exports=o.default,t.exports.default=o.default},{"./util/assertString":"/home/yarmo/dev/doip/doipjs/node_modules/validator/lib/util/assertString.js"}],"/home/yarmo/dev/doip/doipjs/package.json":[function(e,t,o){t.exports={name:"doipjs",version:"0.11.2",description:"Decentralized OpenPGP Identity Proofs library in Node.js",main:"src/index.js",dependencies:{"@xmpp/client":"^0.12.0","@xmpp/debug":"^0.12.0",bent:"^7.3.12","browser-or-node":"^1.3.0",cors:"^2.8.5",dotenv:"^8.2.0",express:"^4.17.1","express-validator":"^6.10.0","irc-upd":"^0.11.0",jsdom:"^16.5.1","merge-options":"^3.0.3",openpgp:"^4.10.9","query-string":"^6.14.1","valid-url":"^1.0.9",validator:"^13.5.2"},devDependencies:{browserify:"^17.0.0","browserify-shim":"^3.8.14",chai:"^4.2.0","chai-as-promised":"^7.1.1","chai-match-pattern":"^1.2.0",docdash:"^1.2.0",jsdoc:"^3.6.6","license-check-and-add":"^3.0.4",minify:"^6.0.1",mocha:"^8.2.0",nodemon:"^2.0.7",prettier:"^2.1.2"},scripts:{"release:bundle":"./node_modules/.bin/browserify ./src/index.js --full-paths --standalone doip -x openpgp -x jsdom -x @xmpp/client -x @xmpp/debug -x irc-upd -o ./dist/doip.js","release:minify":"./node_modules/.bin/minify ./dist/doip.js > ./dist/doip.min.js","prettier:check":"./node_modules/.bin/prettier --check .","prettier:write":"./node_modules/.bin/prettier --write .","license:check":"./node_modules/.bin/license-check-and-add check","license:add":"./node_modules/.bin/license-check-and-add add","license:remove":"./node_modules/.bin/license-check-and-add remove","docs:lib":"./node_modules/.bin/jsdoc -c jsdoc-lib.json -r -d ./docs",test:"./node_modules/.bin/mocha",proxy:"NODE_ENV=production node ./src/proxy/","proxy:dev":"NODE_ENV=development ./node_modules/.bin/nodemon ./src/proxy/"},repository:{type:"git",url:"https://codeberg.org/keyoxide/doipjs"},homepage:"https://js.doip.rocks",keywords:["pgp","gpg","openpgp","encryption","decentralized","identity"],author:"Yarmo Mackenbach (https://yarmo.eu)",license:"Apache-2.0",browserify:{transform:["browserify-shim"]},"browserify-shim":{openpgp:"global:openpgp"}}},{}],"/home/yarmo/dev/doip/doipjs/src/claim.js":[function(e,t,o){const r=e("validator"),i=e("valid-url"),s=e("merge-options"),a=e("./proofs"),d=e("./verifications"),n=e("./claimDefinitions"),l=e("./defaults"),u=e("./enums");t.exports=class{constructor(e,t){if("object"==typeof e&&"claimVersion"in e)switch(data.claimVersion){case 1:this._uri=data.uri,this._fingerprint=data.fingerprint,this._status=data.status,this._dataMatches=data.dataMatches,this._verification=data.verification;break;default:throw new Error("Invalid claim version")}else{if(e&&!i.isUri(e))throw new Error("Invalid URI");if(t)try{r.isAlphanumeric(t)}catch(e){throw new Error("Invalid fingerprint")}this._uri=e||null,this._fingerprint=t||null,this._status=u.ClaimStatus.INIT,this._dataMatches=null,this._verification=null}}get uri(){return this._uri}get fingerprint(){return this._fingerprint}get status(){return this._status}get matches(){if(this._status===u.ClaimStatus.INIT)throw new Error("This claim has not yet been matched");return this._dataMatches}get result(){if(this._status!==u.ClaimStatus.VERIFIED)throw new Error("This claim has not yet been verified");return this._verification}set uri(e){if(this._status!==u.ClaimStatus.INIT)throw new Error("Cannot change the URI, this claim has already been matched");if(e&&!i.isUri(e))throw new Error("The URI was invalid");e=e.replace(/^\s+|\s+$/g,""),this._uri=e}set fingerprint(e){if(this._status===u.ClaimStatus.VERIFIED)throw new Error("Cannot change the fingerprint, this claim has already been verified");this._fingerprint=e}set status(e){throw new Error("Cannot change a claim's status")}set dataMatches(e){throw new Error("Cannot change a claim's dataMatches")}set verification(e){throw new Error("Cannot change a claim's verification data")}match(){if(this._status!==u.ClaimStatus.INIT)throw new Error("This claim was already matched");if(null===this._uri)throw new Error("This claim has no URI");this._dataMatches=[],n.list.every(((e,t)=>{const o=n.data[e];if(!o.reURI.test(this._uri))return!0;const r=o.processURI(this._uri);return r.match.isAmbiguous?(this._dataMatches.push(r),!0):(this._dataMatches=[r],!1)})),this._status=u.ClaimStatus.MATCHED}async verify(e){if(this._status===u.ClaimStatus.INIT)throw new Error("This claim has not yet been matched");if(this._status===u.ClaimStatus.VERIFIED)throw new Error("This claim has already been verified");if(null===this._fingerprint)throw new Error("This claim has no fingerprint");e=s(l.opts,e||{});for(let t=0;t1||this._dataMatches[0].match.isAmbiguous}toJSON(){return{claimVersion:1,uri:this._uri,fingerprint:this._fingerprint,status:this._status,dataMatches:this._dataMatches,verification:this._verification}}}},{"./claimDefinitions":"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/index.js","./defaults":"/home/yarmo/dev/doip/doipjs/src/defaults.js","./enums":"/home/yarmo/dev/doip/doipjs/src/enums.js","./proofs":"/home/yarmo/dev/doip/doipjs/src/proofs.js","./verifications":"/home/yarmo/dev/doip/doipjs/src/verifications.js","merge-options":"/home/yarmo/dev/doip/doipjs/node_modules/merge-options/index.js","valid-url":"/home/yarmo/dev/doip/doipjs/node_modules/valid-url/index.js",validator:"/home/yarmo/dev/doip/doipjs/node_modules/validator/index.js"}],"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/devto.js":[function(e,t,o){const r=e("../enums"),i=/^https:\/\/dev\.to\/(.*)\/(.*)\/?/;o.reURI=i,o.processURI=e=>{const t=e.match(i);return{serviceprovider:{type:"web",name:"devto"},match:{regularExpression:i,isAmbiguous:!1},profile:{display:t[1],uri:"https://dev.to/"+t[1],qr:null},proof:{uri:e,request:{fetcher:r.Fetcher.HTTP,access:r.ProofAccess.NOCORS,format:r.ProofFormat.JSON,data:{url:`https://dev.to/api/articles/${t[1]}/${t[2]}`,format:r.ProofFormat.JSON}}},claim:{format:r.ClaimFormat.MESSAGE,relation:r.ClaimRelation.CONTAINS,path:["body_markdown"]}}},o.tests=[{uri:"https://dev.to/alice/post",shouldMatch:!0},{uri:"https://dev.to/alice/post/",shouldMatch:!0},{uri:"https://domain.org/alice/post",shouldMatch:!1}]},{"../enums":"/home/yarmo/dev/doip/doipjs/src/enums.js"}],"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/discourse.js":[function(e,t,o){const r=e("../enums"),i=/^https:\/\/(.*)\/u\/(.*)\/?/;o.reURI=i,o.processURI=e=>{const t=e.match(i);return{serviceprovider:{type:"web",name:"discourse"},match:{regularExpression:i,isAmbiguous:!0},profile:{display:`${t[2]}@${t[1]}`,uri:e,qr:null},proof:{uri:e,request:{fetcher:r.Fetcher.HTTP,access:r.ProofAccess.NOCORS,format:r.ProofFormat.JSON,data:{url:`https://${t[1]}/u/${t[2]}.json`,format:r.ProofFormat.JSON}}},claim:{format:r.ClaimFormat.MESSAGE,relation:r.ClaimRelation.CONTAINS,path:["user","bio_raw"]}}},o.tests=[{uri:"https://domain.org/u/alice",shouldMatch:!0},{uri:"https://domain.org/u/alice/",shouldMatch:!0},{uri:"https://domain.org/alice",shouldMatch:!1}]},{"../enums":"/home/yarmo/dev/doip/doipjs/src/enums.js"}],"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/dns.js":[function(e,t,o){const r=e("../enums"),i=/^dns:([a-zA-Z0-9\.\-\_]*)(?:\?(.*))?/;o.reURI=i,o.processURI=e=>{const t=e.match(i);return{serviceprovider:{type:"web",name:"dns"},match:{regularExpression:i,isAmbiguous:!1},profile:{display:t[1],uri:"https://"+t[1],qr:null},proof:{uri:null,request:{fetcher:r.Fetcher.DNS,access:r.ProofAccess.SERVER,format:r.ProofFormat.JSON,data:{domain:t[1]}}},claim:{format:r.ClaimFormat.URI,relation:r.ClaimRelation.CONTAINS,path:["records","txt"]}}},o.tests=[{uri:"dns:domain.org",shouldMatch:!0},{uri:"dns:domain.org?type=TXT",shouldMatch:!0},{uri:"https://domain.org",shouldMatch:!1}]},{"../enums":"/home/yarmo/dev/doip/doipjs/src/enums.js"}],"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/fediverse.js":[function(e,t,o){const r=e("../enums"),i=/^https:\/\/(.*)\/users\/(.*)\/?/;o.reURI=i,o.processURI=e=>{const t=e.match(i);return{serviceprovider:{type:"web",name:"fediverse"},match:{regularExpression:i,isAmbiguous:!0},profile:{display:`@${t[2]}@${t[1]}`,uri:e,qr:null},proof:{uri:e,request:{fetcher:r.Fetcher.HTTP,access:r.ProofAccess.GENERIC,format:r.ProofFormat.JSON,data:{url:e,format:r.ProofFormat.JSON}}},claim:{format:r.ClaimFormat.FINGERPRINT,relation:r.ClaimRelation.CONTAINS,path:["summary"]}}},o.tests=[{uri:"https://domain.org/users/alice",shouldMatch:!0},{uri:"https://domain.org/users/alice/",shouldMatch:!0},{uri:"https://domain.org/alice",shouldMatch:!1}]},{"../enums":"/home/yarmo/dev/doip/doipjs/src/enums.js"}],"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/gitea.js":[function(e,t,o){const r=e("../enums"),i=/^https:\/\/(.*)\/(.*)\/gitea_proof\/?/;o.reURI=i,o.processURI=e=>{const t=e.match(i);return{serviceprovider:{type:"web",name:"gitea"},match:{regularExpression:i,isAmbiguous:!0},profile:{display:`${t[2]}@${t[1]}`,uri:`https://${t[1]}/${t[2]}`,qr:null},proof:{uri:e,request:{fetcher:r.Fetcher.HTTP,access:r.ProofAccess.NOCORS,format:r.ProofFormat.JSON,data:{url:`https://${t[1]}/api/v1/repos/${t[2]}/gitea_proof`,format:r.ProofFormat.JSON}}},claim:{format:r.ClaimFormat.MESSAGE,relation:r.ClaimRelation.EQUALS,path:["description"]}}},o.tests=[{uri:"https://domain.org/alice/gitea_proof",shouldMatch:!0},{uri:"https://domain.org/alice/gitea_proof/",shouldMatch:!0},{uri:"https://domain.org/alice/other_proof",shouldMatch:!1}]},{"../enums":"/home/yarmo/dev/doip/doipjs/src/enums.js"}],"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/github.js":[function(e,t,o){const r=e("../enums"),i=/^https:\/\/gist\.github\.com\/(.*)\/(.*)\/?/;o.reURI=i,o.processURI=e=>{const t=e.match(i);return{serviceprovider:{type:"web",name:"github"},match:{regularExpression:i,isAmbiguous:!1},profile:{display:t[1],uri:"https://github.com/"+t[1],qr:null},proof:{uri:e,request:{fetcher:r.Fetcher.HTTP,access:r.ProofAccess.GENERIC,format:r.ProofFormat.JSON,data:{url:"https://api.github.com/gists/"+t[2],format:r.ProofFormat.JSON}}},claim:{format:r.ClaimFormat.MESSAGE,relation:r.ClaimRelation.CONTAINS,path:["files","openpgp.md","content"]}}},o.tests=[{uri:"https://gist.github.com/Alice/123456789",shouldMatch:!0},{uri:"https://gist.github.com/Alice/123456789/",shouldMatch:!0},{uri:"https://domain.org/Alice/123456789",shouldMatch:!1}]},{"../enums":"/home/yarmo/dev/doip/doipjs/src/enums.js"}],"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/gitlab.js":[function(e,t,o){const r=e("../enums"),i=/^https:\/\/(.*)\/(.*)\/gitlab_proof\/?/;o.reURI=i,o.processURI=e=>{const t=e.match(i);return{serviceprovider:{type:"web",name:"gitlab"},match:{regularExpression:i,isAmbiguous:!0},profile:{display:`${t[2]}@${t[1]}`,uri:`https://${t[1]}/${t[2]}`,qr:null},proof:{uri:e,request:{fetcher:r.Fetcher.GITLAB,access:r.ProofAccess.GENERIC,format:r.ProofFormat.JSON,data:{domain:t[1],username:t[2]}}},claim:{format:r.ClaimFormat.MESSAGE,relation:r.ClaimRelation.EQUALS,path:["description"]}}},o.tests=[{uri:"https://gitlab.domain.org/alice/gitlab_proof",shouldMatch:!0},{uri:"https://gitlab.domain.org/alice/gitlab_proof/",shouldMatch:!0},{uri:"https://domain.org/alice/other_proof",shouldMatch:!1}]},{"../enums":"/home/yarmo/dev/doip/doipjs/src/enums.js"}],"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/hackernews.js":[function(e,t,o){const r=e("../enums"),i=/^https:\/\/news\.ycombinator\.com\/user\?id=(.*)\/?/;o.reURI=i,o.processURI=e=>{const t=e.match(i);return{serviceprovider:{type:"web",name:"hackernews"},match:{regularExpression:i,isAmbiguous:!1},profile:{display:t[1],uri:e,qr:null},proof:{uri:`https://hacker-news.firebaseio.com/v0/user/${t[1]}.json`,request:{fetcher:r.Fetcher.HTTP,access:r.ProofAccess.NOCORS,format:r.ProofFormat.JSON,data:{url:`https://hacker-news.firebaseio.com/v0/user/${t[1]}.json`,format:r.ProofFormat.JSON}}},claim:{format:r.ClaimFormat.URI,relation:r.ClaimRelation.CONTAINS,path:["about"]}}},o.tests=[{uri:"https://news.ycombinator.com/user?id=Alice",shouldMatch:!0},{uri:"https://news.ycombinator.com/user?id=Alice/",shouldMatch:!0},{uri:"https://domain.org/user?id=Alice",shouldMatch:!1}]},{"../enums":"/home/yarmo/dev/doip/doipjs/src/enums.js"}],"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/index.js":[function(e,t,o){const r={dns:e("./dns"),irc:e("./irc"),xmpp:e("./xmpp"),matrix:e("./matrix"),twitter:e("./twitter"),reddit:e("./reddit"),liberapay:e("./liberapay"),hackernews:e("./hackernews"),lobsters:e("./lobsters"),devto:e("./devto"),gitea:e("./gitea"),gitlab:e("./gitlab"),github:e("./github"),mastodon:e("./mastodon"),fediverse:e("./fediverse"),discourse:e("./discourse"),owncast:e("./owncast")};o.list=["dns","irc","xmpp","matrix","twitter","reddit","liberapay","hackernews","lobsters","devto","gitea","gitlab","github","mastodon","fediverse","discourse","owncast"],o.data=r},{"./devto":"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/devto.js","./discourse":"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/discourse.js","./dns":"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/dns.js","./fediverse":"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/fediverse.js","./gitea":"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/gitea.js","./github":"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/github.js","./gitlab":"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/gitlab.js","./hackernews":"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/hackernews.js","./irc":"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/irc.js","./liberapay":"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/liberapay.js","./lobsters":"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/lobsters.js","./mastodon":"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/mastodon.js","./matrix":"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/matrix.js","./owncast":"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/owncast.js","./reddit":"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/reddit.js","./twitter":"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/twitter.js","./xmpp":"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/xmpp.js"}],"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/irc.js":[function(e,t,o){const r=e("../enums"),i=/^irc\:\/\/(.*)\/([a-zA-Z0-9]*)/;o.reURI=i,o.processURI=e=>{const t=e.match(i);return{serviceprovider:{type:"communication",name:"irc"},match:{regularExpression:i,isAmbiguous:!1},profile:{display:`irc://${t[1]}/${t[2]}`,uri:e,qr:null},proof:{uri:null,request:{fetcher:r.Fetcher.IRC,access:r.ProofAccess.SERVER,format:r.ProofFormat.JSON,data:{domain:t[1],nick:t[2]}}},claim:{format:r.ClaimFormat.URI,relation:r.ClaimRelation.CONTAINS,path:[]}}},o.tests=[{uri:"irc://chat.ircserver.org/Alice1",shouldMatch:!0},{uri:"irc://chat.ircserver.org/alice?param=123",shouldMatch:!0},{uri:"https://chat.ircserver.org/alice",shouldMatch:!1}]},{"../enums":"/home/yarmo/dev/doip/doipjs/src/enums.js"}],"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/liberapay.js":[function(e,t,o){const r=e("../enums"),i=/^https:\/\/liberapay\.com\/(.*)\/?/;o.reURI=i,o.processURI=e=>{const t=e.match(i);return{serviceprovider:{type:"web",name:"liberapay"},match:{regularExpression:i,isAmbiguous:!1},profile:{display:t[1],uri:e,qr:null},proof:{uri:e,request:{fetcher:r.Fetcher.HTTP,access:r.ProofAccess.GENERIC,format:r.ProofFormat.JSON,data:{url:`https://liberapay.com/${t[1]}/public.json`,format:r.ProofFormat.JSON}}},claim:{format:r.ClaimFormat.MESSAGE,relation:r.ClaimRelation.CONTAINS,path:["statements","content"]}}},o.tests=[{uri:"https://liberapay.com/alice",shouldMatch:!0},{uri:"https://liberapay.com/alice/",shouldMatch:!0},{uri:"https://domain.org/alice",shouldMatch:!1}]},{"../enums":"/home/yarmo/dev/doip/doipjs/src/enums.js"}],"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/lobsters.js":[function(e,t,o){const r=e("../enums"),i=/^https:\/\/lobste\.rs\/u\/(.*)\/?/;o.reURI=i,o.processURI=e=>{const t=e.match(i);return{serviceprovider:{type:"web",name:"lobsters"},match:{regularExpression:i,isAmbiguous:!1},profile:{display:t[1],uri:e,qr:null},proof:{uri:`https://lobste.rs/u/${t[1]}.json`,request:{fetcher:r.Fetcher.HTTP,access:r.ProofAccess.NOCORS,format:r.ProofFormat.JSON,data:{url:`https://lobste.rs/u/${t[1]}.json`,format:r.ProofFormat.JSON}}},claim:{format:r.ClaimFormat.MESSAGE,relation:r.ClaimRelation.CONTAINS,path:["about"]}}},o.tests=[{uri:"https://lobste.rs/u/Alice",shouldMatch:!0},{uri:"https://lobste.rs/u/Alice/",shouldMatch:!0},{uri:"https://domain.org/u/Alice",shouldMatch:!1}]},{"../enums":"/home/yarmo/dev/doip/doipjs/src/enums.js"}],"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/mastodon.js":[function(e,t,o){const r=e("../enums"),i=/^https:\/\/(.*)\/@(.*)\/?/;o.reURI=i,o.processURI=e=>{const t=e.match(i);return{serviceprovider:{type:"web",name:"mastodon"},match:{regularExpression:i,isAmbiguous:!0},profile:{display:`@${t[2]}@${t[1]}`,uri:e,qr:null},proof:{uri:e,request:{fetcher:r.Fetcher.HTTP,access:r.ProofAccess.GENERIC,format:r.ProofFormat.JSON,data:{url:e,format:r.ProofFormat.JSON}}},claim:{format:r.ClaimFormat.FINGERPRINT,relation:r.ClaimRelation.CONTAINS,path:["attachment","value"]}}},o.tests=[{uri:"https://domain.org/@alice",shouldMatch:!0},{uri:"https://domain.org/@alice/",shouldMatch:!0},{uri:"https://domain.org/alice",shouldMatch:!1}]},{"../enums":"/home/yarmo/dev/doip/doipjs/src/enums.js"}],"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/matrix.js":[function(e,t,o){const r=e("../enums"),i=e("query-string"),s=/^matrix\:u\/(?:\@)?([^@:]*\:[^?]*)(\?.*)?/;o.reURI=s,o.processURI=e=>{const t=e.match(s);if(!t[2])return null;const o=i.parse(t[2]);if(!("org.keyoxide.e"in o)||!("org.keyoxide.r"in o))return null;const a="https://matrix.to/#/@"+t[1],d=`https://matrix.to/#/${o["org.keyoxide.r"]}/${o["org.keyoxide.e"]}`;return{serviceprovider:{type:"communication",name:"matrix"},match:{regularExpression:s,isAmbiguous:!1},profile:{display:"@"+t[1],uri:a,qr:null},proof:{uri:d,request:{fetcher:r.Fetcher.MATRIX,access:r.ProofAccess.GRANTED,format:r.ProofFormat.JSON,data:{eventId:o["org.keyoxide.e"],roomId:o["org.keyoxide.r"]}}},claim:{format:r.ClaimFormat.MESSAGE,relation:r.ClaimRelation.CONTAINS,path:["content","body"]}}},o.tests=[{uri:"matrix:u/alice:matrix.domain.org?org.keyoxide.r=!123:domain.org&org.keyoxide.e=$123",shouldMatch:!0},{uri:"matrix:u/alice:matrix.domain.org",shouldMatch:!0},{uri:"xmpp:alice@domain.org",shouldMatch:!1},{uri:"https://domain.org/@alice",shouldMatch:!1}]},{"../enums":"/home/yarmo/dev/doip/doipjs/src/enums.js","query-string":"/home/yarmo/dev/doip/doipjs/node_modules/query-string/index.js"}],"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/owncast.js":[function(e,t,o){const r=e("../enums"),i=/^https:\/\/(.*)/;o.reURI=i,o.processURI=e=>{const t=e.match(i);return{serviceprovider:{type:"web",name:"owncast"},match:{regularExpression:i,isAmbiguous:!0},profile:{display:t[1],uri:e,qr:null},proof:{uri:e+"/api/config",request:{fetcher:r.Fetcher.HTTP,access:r.ProofAccess.GENERIC,format:r.ProofFormat.JSON,data:{url:e+"/api/config",format:r.ProofFormat.JSON}}},claim:{format:r.ClaimFormat.FINGERPRINT,relation:r.ClaimRelation.CONTAINS,path:["socialHandles","url"]}}},o.tests=[{uri:"https://live.domain.org",shouldMatch:!0},{uri:"https://live.domain.org/",shouldMatch:!0},{uri:"https://domain.org/live",shouldMatch:!0},{uri:"https://domain.org/live/",shouldMatch:!0}]},{"../enums":"/home/yarmo/dev/doip/doipjs/src/enums.js"}],"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/reddit.js":[function(e,t,o){const r=e("../enums"),i=/^https:\/\/(?:www\.)?reddit\.com\/user\/(.*)\/comments\/(.*)\/(.*)\/?/;o.reURI=i,o.processURI=e=>{const t=e.match(i);return{serviceprovider:{type:"web",name:"reddit"},match:{regularExpression:i,isAmbiguous:!1},profile:{display:t[1],uri:"https://www.reddit.com/user/"+t[1],qr:null},proof:{uri:e,request:{fetcher:r.Fetcher.HTTP,access:r.ProofAccess.NOCORS,format:r.ProofFormat.JSON,data:{url:`https://www.reddit.com/user/${t[1]}/comments/${t[2]}.json`,format:r.ProofFormat.JSON}}},claim:{format:r.ClaimFormat.MESSAGE,relation:r.ClaimRelation.CONTAINS,path:["data","children","data","selftext"]}}},o.tests=[{uri:"https://www.reddit.com/user/Alice/comments/123456/post",shouldMatch:!0},{uri:"https://www.reddit.com/user/Alice/comments/123456/post/",shouldMatch:!0},{uri:"https://reddit.com/user/Alice/comments/123456/post",shouldMatch:!0},{uri:"https://reddit.com/user/Alice/comments/123456/post/",shouldMatch:!0},{uri:"https://domain.org/user/Alice/comments/123456/post",shouldMatch:!1}]},{"../enums":"/home/yarmo/dev/doip/doipjs/src/enums.js"}],"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/twitter.js":[function(e,t,o){const r=e("../enums"),i=/^https:\/\/twitter\.com\/(.*)\/status\/([0-9]*)(?:\?.*)?/;o.reURI=i,o.processURI=e=>{const t=e.match(i);return{serviceprovider:{type:"web",name:"twitter"},match:{regularExpression:i,isAmbiguous:!1},profile:{display:"@"+t[1],uri:"https://twitter.com/"+t[1],qr:null},proof:{uri:e,request:{fetcher:r.Fetcher.TWITTER,access:r.ProofAccess.GRANTED,format:r.ProofFormat.TEXT,data:{tweetId:t[2]}}},claim:{format:r.ClaimFormat.MESSAGE,relation:r.ClaimRelation.CONTAINS,path:[]}}},o.tests=[{uri:"https://twitter.com/alice/status/1234567890123456789",shouldMatch:!0},{uri:"https://twitter.com/alice/status/1234567890123456789/",shouldMatch:!0},{uri:"https://domain.org/alice/status/1234567890123456789",shouldMatch:!1}]},{"../enums":"/home/yarmo/dev/doip/doipjs/src/enums.js"}],"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/xmpp.js":[function(e,t,o){const r=e("../enums"),i=/^xmpp:([a-zA-Z0-9\.\-\_]*)@([a-zA-Z0-9\.\-\_]*)(?:\?(.*))?/;o.reURI=i,o.processURI=e=>{const t=e.match(i);return{serviceprovider:{type:"communication",name:"xmpp"},match:{regularExpression:i,isAmbiguous:!1},profile:{display:`${t[1]}@${t[2]}`,uri:e,qr:e},proof:{uri:null,request:{fetcher:r.Fetcher.XMPP,access:r.ProofAccess.SERVER,format:r.ProofFormat.TEXT,data:{id:`${t[1]}@${t[2]}`,field:"note"}}},claim:{format:r.ClaimFormat.MESSAGE,relation:r.ClaimRelation.CONTAINS,path:[]}}},o.tests=[{uri:"xmpp:alice@domain.org",shouldMatch:!0},{uri:"xmpp:alice@domain.org?omemo-sid-123456789=A1B2C3D4E5F6G7H8I9",shouldMatch:!0},{uri:"https://domain.org",shouldMatch:!1}]},{"../enums":"/home/yarmo/dev/doip/doipjs/src/enums.js"}],"/home/yarmo/dev/doip/doipjs/src/defaults.js":[function(e,t,o){const r={proxy:{hostname:null,policy:e("./enums").ProxyPolicy.NEVER},claims:{irc:{nick:null},matrix:{instance:null,accessToken:null},xmpp:{service:null,username:null,password:null},twitter:{bearerToken:null}}};o.opts=r},{"./enums":"/home/yarmo/dev/doip/doipjs/src/enums.js"}],"/home/yarmo/dev/doip/doipjs/src/enums.js":[function(e,t,o){const r={ADAPTIVE:"adaptive",ALWAYS:"always",NEVER:"never"};Object.freeze(r);const i={HTTP:"http",DNS:"dns",IRC:"irc",XMPP:"xmpp",MATRIX:"matrix",GITLAB:"gitlab",TWITTER:"twitter"};Object.freeze(i);const s={GENERIC:0,NOCORS:1,GRANTED:2,SERVER:3};Object.freeze(s);const a={JSON:"json",TEXT:"text"};Object.freeze(a);const d={URI:0,FINGERPRINT:1,MESSAGE:2};Object.freeze(d);const n={CONTAINS:0,EQUALS:1,ONEOF:2};Object.freeze(n);const l={INIT:"init",MATCHED:"matched",VERIFIED:"verified"};Object.freeze(l),o.ProxyPolicy=r,o.Fetcher=i,o.ProofAccess=s,o.ProofFormat=a,o.ClaimFormat=d,o.ClaimRelation=n,o.ClaimStatus=l},{}],"/home/yarmo/dev/doip/doipjs/src/fetcher/dns.js":[function(e,t,o){const r=e("dns");t.exports.timeout=5e3,t.exports.fn=async(e,o)=>{let i;const s=new Promise(((o,r)=>{i=setTimeout((()=>r(new Error("Request was timed out"))),e.fetcherTimeout?e.fetcherTimeout:t.exports.timeout)})),a=new Promise(((t,o)=>{r.resolveTxt(e.domain,((r,i)=>{r?o(r):t({domain:e.domain,records:{txt:i}})}))}));return Promise.race([a,s]).then((e=>(clearTimeout(i),e)))}},{dns:"/home/yarmo/dev/doip/doipjs/node_modules/browserify/lib/_empty.js"}],"/home/yarmo/dev/doip/doipjs/src/fetcher/gitlab.js":[function(e,t,o){const r=e("bent")("GET");t.exports.timeout=5e3,t.exports.fn=async(e,o)=>{let i;const s=new Promise(((o,r)=>{i=setTimeout((()=>r(new Error("Request was timed out"))),e.fetcherTimeout?e.fetcherTimeout:t.exports.timeout)})),a=new Promise((async(t,o)=>{const i=`https://${e.domain}/api/v4/users?username=${e.username}`,s=await r(i,null,{Accept:"application/json"}),a=(await s.json()).find((t=>t.username===e.username));a||o("No user with username "+e.username);const d=`https://${e.domain}/api/v4/users/${a.id}/projects`,n=await r(d,null,{Accept:"application/json"}),l=(await n.json()).find((e=>"gitlab_proof"===e.path));l||o("No project found"),t(l)}));return Promise.race([a,s]).then((e=>(clearTimeout(i),e)))}},{bent:"/home/yarmo/dev/doip/doipjs/node_modules/bent/src/browser.js"}],"/home/yarmo/dev/doip/doipjs/src/fetcher/http.js":[function(e,t,o){const r=e("bent")("GET"),i=e("../enums");t.exports.timeout=5e3,t.exports.fn=async(o,s)=>{let a;const d=new Promise(((e,r)=>{a=setTimeout((()=>r(new Error("Request was timed out"))),o.fetcherTimeout?o.fetcherTimeout:t.exports.timeout)})),n=new Promise(((t,s)=>{if(o.url)switch(o.format){case i.ProofFormat.JSON:r(o.url,null,{Accept:"application/json","User-Agent":"doipjs/"+e("../../package.json").version}).then((async e=>await e.json())).then((e=>{t(e)})).catch((e=>{s(e)}));break;case i.ProofFormat.TEXT:r(o.url).then((async e=>await e.text())).then((e=>{t(e)})).catch((e=>{s(e)}));break;default:s("No specified data format")}else s("No valid URI provided")}));return Promise.race([n,d]).then((e=>(clearTimeout(a),e)))}},{"../../package.json":"/home/yarmo/dev/doip/doipjs/package.json","../enums":"/home/yarmo/dev/doip/doipjs/src/enums.js",bent:"/home/yarmo/dev/doip/doipjs/node_modules/bent/src/browser.js"}],"/home/yarmo/dev/doip/doipjs/src/fetcher/index.js":[function(e,t,o){o.dns=e("./dns"),o.gitlab=e("./gitlab"),o.http=e("./http"),o.irc=e("./irc"),o.matrix=e("./matrix"),o.twitter=e("./twitter"),o.xmpp=e("./xmpp")},{"./dns":"/home/yarmo/dev/doip/doipjs/src/fetcher/dns.js","./gitlab":"/home/yarmo/dev/doip/doipjs/src/fetcher/gitlab.js","./http":"/home/yarmo/dev/doip/doipjs/src/fetcher/http.js","./irc":"/home/yarmo/dev/doip/doipjs/src/fetcher/irc.js","./matrix":"/home/yarmo/dev/doip/doipjs/src/fetcher/matrix.js","./twitter":"/home/yarmo/dev/doip/doipjs/src/fetcher/twitter.js","./xmpp":"/home/yarmo/dev/doip/doipjs/src/fetcher/xmpp.js"}],"/home/yarmo/dev/doip/doipjs/src/fetcher/irc.js":[function(e,t,o){const r=e("irc-upd"),i=e("validator");t.exports.timeout=2e4,t.exports.fn=async(e,o)=>{let s;const a=new Promise(((o,r)=>{s=setTimeout((()=>r(new Error("Request was timed out"))),e.fetcherTimeout?e.fetcherTimeout:t.exports.timeout)})),d=new Promise(((t,s)=>{try{i.isAscii(o.claims.irc.nick)}catch(e){throw new Error(`IRC fetcher was not set up properly (${e.message})`)}try{const i=new r.Client(e.domain,o.claims.irc.nick,{port:6697,secure:!0,channels:[]}),s=/[a-zA-Z0-9\-\_]+\s+:\s(openpgp4fpr\:.*)/,a=/End\sof\s.*\staxonomy./;let d=[];i.addListener("registered",(t=>{i.send("PRIVMSG NickServ :TAXONOMY "+e.nick)})),i.addListener("notice",((e,o,r,n)=>{if(s.test(r)){const e=r.match(s);d.push(e[1])}a.test(r)&&(i.disconnect(),t(d))}))}catch(e){s(e)}}));return Promise.race([d,a]).then((e=>(clearTimeout(s),e)))}},{"irc-upd":"irc-upd",validator:"/home/yarmo/dev/doip/doipjs/node_modules/validator/index.js"}],"/home/yarmo/dev/doip/doipjs/src/fetcher/matrix.js":[function(e,t,o){const r=e("bent")("GET"),i=e("validator");t.exports.timeout=5e3,t.exports.fn=async(e,o)=>{let s;const a=new Promise(((o,r)=>{s=setTimeout((()=>r(new Error("Request was timed out"))),e.fetcherTimeout?e.fetcherTimeout:t.exports.timeout)})),d=new Promise(((t,s)=>{try{i.isFQDN(o.claims.matrix.instance),i.isAscii(o.claims.matrix.accessToken)}catch(e){throw new Error(`Matrix fetcher was not set up properly (${e.message})`)}const a=`https://${o.claims.matrix.instance}/_matrix/client/r0/rooms/${e.roomId}/event/${e.eventId}?access_token=${o.claims.matrix.accessToken}`;r(a,null,{Accept:"application/json"}).then((async e=>await e.json())).then((e=>{t(e)})).catch((e=>{s(e)}))}));return Promise.race([d,a]).then((e=>(clearTimeout(s),e)))}},{bent:"/home/yarmo/dev/doip/doipjs/node_modules/bent/src/browser.js",validator:"/home/yarmo/dev/doip/doipjs/node_modules/validator/index.js"}],"/home/yarmo/dev/doip/doipjs/src/fetcher/twitter.js":[function(e,t,o){const r=e("bent")("GET"),i=e("validator");t.exports.timeout=5e3,t.exports.fn=async(e,o)=>{let s;const a=new Promise(((o,r)=>{s=setTimeout((()=>r(new Error("Request was timed out"))),e.fetcherTimeout?e.fetcherTimeout:t.exports.timeout)})),d=new Promise(((t,s)=>{try{i.isAscii(o.claims.twitter.bearerToken)}catch(e){throw new Error(`Twitter fetcher was not set up properly (${e.message})`)}r(`https://api.twitter.com/1.1/statuses/show.json?id=${e.tweetId}&tweet_mode=extended`,null,{Accept:"application/json",Authorization:"Bearer "+o.claims.twitter.bearerToken}).then((async e=>await e.json())).then((e=>{t(e.full_text)})).catch((e=>{s(e)}))}));return Promise.race([d,a]).then((e=>(clearTimeout(s),e)))}},{bent:"/home/yarmo/dev/doip/doipjs/node_modules/bent/src/browser.js",validator:"/home/yarmo/dev/doip/doipjs/node_modules/validator/index.js"}],"/home/yarmo/dev/doip/doipjs/src/fetcher/xmpp.js":[function(e,t,o){(function(o){(function(){const r=e("jsdom"),{client:i,xml:s}=e("@xmpp/client"),a=e("@xmpp/debug"),d=e("validator");t.exports.timeout=5e3;let n=null,l=null;t.exports.fn=async(e,u)=>{let c;const m=new Promise(((o,r)=>{c=setTimeout((()=>r(new Error("Request was timed out"))),e.fetcherTimeout?e.fetcherTimeout:t.exports.timeout)})),p=new Promise((async(t,c)=>{try{d.isFQDN(u.claims.xmpp.service),d.isAscii(u.claims.xmpp.username),d.isAscii(u.claims.xmpp.password)}catch(e){throw new Error(`XMPP fetcher was not set up properly (${e.message})`)}if(!n||"online"!==n.status){const e=await(async(e,t,r)=>new Promise(((s,d)=>{const n=i({service:e,username:t,password:r});"production"!==o.env.NODE_ENV&&a(n,!0);const{iqCaller:l}=n;n.start(),n.on("online",(e=>{s({xmpp:n,iqCaller:l})})),n.on("error",(e=>{d(e)}))})))(u.claims.xmpp.service,u.claims.xmpp.username,u.claims.xmpp.password);n=e.xmpp,l=e.iqCaller}const m=(await l.request(s("iq",{type:"get",to:e.id},s("vCard","vcard-temp")),3e4)).getChild("vCard","vcard-temp").toString(),p=new r.JSDOM(m);try{let o;switch(e.field.toLowerCase()){case"desc":case"note":if(o=p.window.document.querySelector("note text"),o||(o=p.window.document.querySelector("DESC")),!o)throw new Error("No DESC or NOTE field found in vCard");o=o.textContent;break;default:o=p.window.document.querySelector(e).textContent}n.stop(),t(o)}catch(e){c(e)}}));return Promise.race([p,m]).then((e=>(clearTimeout(c),e)))}}).call(this)}).call(this,e("_process"))},{"@xmpp/client":"@xmpp/client","@xmpp/debug":"@xmpp/debug",_process:"/home/yarmo/dev/doip/doipjs/node_modules/process/browser.js",jsdom:"jsdom",validator:"/home/yarmo/dev/doip/doipjs/node_modules/validator/index.js"}],"/home/yarmo/dev/doip/doipjs/src/index.js":[function(e,t,o){const r=e("./claim"),i=e("./claimDefinitions"),s=e("./proofs"),a=e("./keys"),d=e("./signatures"),n=e("./enums"),l=e("./defaults"),u=e("./utils");o.Claim=r,o.claimDefinitions=i,o.proofs=s,o.keys=a,o.signatures=d,o.enums=n,o.defaults=l,o.utils=u},{"./claim":"/home/yarmo/dev/doip/doipjs/src/claim.js","./claimDefinitions":"/home/yarmo/dev/doip/doipjs/src/claimDefinitions/index.js","./defaults":"/home/yarmo/dev/doip/doipjs/src/defaults.js","./enums":"/home/yarmo/dev/doip/doipjs/src/enums.js","./keys":"/home/yarmo/dev/doip/doipjs/src/keys.js","./proofs":"/home/yarmo/dev/doip/doipjs/src/proofs.js","./signatures":"/home/yarmo/dev/doip/doipjs/src/signatures.js","./utils":"/home/yarmo/dev/doip/doipjs/src/utils.js"}],"/home/yarmo/dev/doip/doipjs/src/keys.js":[function(e,t,o){(function(t){(function(){const r=e("bent")("GET"),i=e("valid-url"),s="undefined"!=typeof window?window.openpgp:void 0!==t?t.openpgp:null,a=e("./claim");o.fetchHKP=(e,t)=>new Promise((async(o,r)=>{const i=t?"https://"+t:"https://keys.openpgp.org",a=new s.HKP(i),d={query:e};let n=await a.lookup(d).catch((e=>{r("Key does not exist or could not be fetched")}));n=await s.key.readArmored(n).then((e=>e.keys[0])).catch((e=>null)),n?o(n):r("Key does not exist or could not be fetched")})),o.fetchWKD=e=>new Promise((async(t,o)=>{const r=new s.WKD,i={email:e},a=await r.lookup(i).then((e=>e.keys[0])).catch((e=>null));a?t(a):o("Key does not exist or could not be fetched")})),o.fetchKeybase=(e,t)=>new Promise((async(e,t)=>{try{await r(opts.keyLink).then((e=>{if(200===e.status)return e})).then((e=>e.text()))}catch(e){t("Error fetching Keybase key: "+e.message)}const o=await s.key.readArmored(rawKeyContent).then((e=>e.keys[0])).catch((e=>null));o?e(o):t("Key does not exist or could not be fetched")})),o.fetchPlaintext=e=>new Promise((async(t,o)=>{t((await s.key.readArmored(e)).keys[0])})),o.fetchURI=e=>new Promise((async(t,r)=>{i.isUri(e)||r("Invalid URI");const s=e.match(/([a-zA-Z0-9]*):([a-zA-Z0-9@._=+\-]*)(?:\:([a-zA-Z0-9@._=+\-]*))?/);switch(s[1]||r("Invalid URI"),s[1]){case"hkp":t(o.fetchHKP(s[3]?s[3]:s[2],s[3]?s[2]:null));break;case"wkd":t(o.fetchWKD(s[2]));break;case"kb":t(o.fetchKeybase(s[2],s.length>=4?s[3]:null));break;default:r("Invalid URI protocol")}})),o.process=e=>new Promise((async(t,o)=>{e&&e instanceof s.key.Key||o("Invalid public key");const r=await e.primaryKey.getFingerprint(),i=await e.getPrimaryUser(),d=e.users;let n=[];d.forEach(((e,t)=>{if(n[t]={userData:{id:e.userId?e.userId.userid:null,name:e.userId?e.userId.name:null,email:e.userId?e.userId.email:null,comment:e.userId?e.userId.comment:null,isPrimary:i.index===t},claims:[]},"selfCertifications"in e&&e.selfCertifications.length>0){const o=e.selfCertifications[0].rawNotations;n[t].claims=o.map((({name:e,value:t,humanReadable:o})=>{if(o&&"proof@metacode.biz"===e){const e=s.util.decode_utf8(t);return new a(e,r)}}))}})),t({fingerprint:r,users:n,primaryUserIndex:i.index,key:{data:e,fetchMethod:null,uri:null}})}))}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./claim":"/home/yarmo/dev/doip/doipjs/src/claim.js",bent:"/home/yarmo/dev/doip/doipjs/node_modules/bent/src/browser.js","valid-url":"/home/yarmo/dev/doip/doipjs/node_modules/valid-url/index.js"}],"/home/yarmo/dev/doip/doipjs/src/proofs.js":[function(e,t,o){const r=e("browser-or-node"),i=e("./fetcher"),s=e("./utils"),a=e("./enums"),d=(e,t)=>{switch(t.proxy.policy){case a.ProxyPolicy.ALWAYS:return u(e,t);case a.ProxyPolicy.NEVER:switch(e.proof.request.access){case a.ProofAccess.GENERIC:case a.ProofAccess.GRANTED:return l(e,t);case a.ProofAccess.NOCORS:case a.ProofAccess.SERVER:throw new Error("Impossible to fetch proof (bad combination of service access and proxy policy)");default:throw new Error("Invalid proof access value")}break;case a.ProxyPolicy.ADAPTIVE:switch(e.proof.request.access){case a.ProofAccess.GENERIC:return l(e,t);case a.ProofAccess.NOCORS:return u(e,t);case a.ProofAccess.GRANTED:return c(e,t);case a.ProofAccess.SERVER:throw new Error("Impossible to fetch proof (bad combination of service access and proxy policy)");default:throw new Error("Invalid proof access value")}break;default:throw new Error("Invalid proxy policy")}},n=(e,t)=>{switch(t.proxy.policy){case a.ProxyPolicy.ALWAYS:return u(e,t);case a.ProxyPolicy.NEVER:return l(e,t);case a.ProxyPolicy.ADAPTIVE:return c(e,t);default:throw new Error("Invalid proxy policy")}},l=(e,t)=>new Promise(((o,r)=>{i[e.proof.request.fetcher].fn(e.proof.request.data,t).then((t=>o({fetcher:e.proof.request.fetcher,data:e,viaProxy:!1,result:t}))).catch((e=>r(e)))})),u=(e,t)=>new Promise(((o,r)=>{let a;try{a=s.generateProxyURL(e.proof.request.fetcher,e.proof.request.data,t)}catch(e){r(e)}const d={url:a,format:e.proof.request.format,fetcherTimeout:i[e.proof.request.fetcher].timeout};i.http.fn(d,t).then((t=>o({fetcher:"http",data:e,viaProxy:!0,result:t}))).catch((e=>r(e)))})),c=(e,t)=>new Promise(((o,r)=>{l(e,t).then((e=>o(e))).catch((i=>{u(e,t).then((e=>o(e))).catch((e=>r([i,e])))}))}));o.fetch=(e,t)=>{switch(e.proof.request.fetcher){case a.Fetcher.HTTP:e.proof.request.data.format=e.proof.request.format}return r.isNode?n(e,t):d(e,t)}},{"./enums":"/home/yarmo/dev/doip/doipjs/src/enums.js","./fetcher":"/home/yarmo/dev/doip/doipjs/src/fetcher/index.js","./utils":"/home/yarmo/dev/doip/doipjs/src/utils.js","browser-or-node":"/home/yarmo/dev/doip/doipjs/node_modules/browser-or-node/lib/index.js"}],"/home/yarmo/dev/doip/doipjs/src/signatures.js":[function(e,t,o){(function(t){(function(){const r="undefined"!=typeof window?window.openpgp:void 0!==t?t.openpgp:null,i=e("./claim"),s=e("./keys");o.process=e=>new Promise((async(t,o)=>{let a,d={fingerprint:null,users:[{userData:{},claims:[]}],primaryUserIndex:null,key:{data:null,fetchMethod:null,uri:null}};try{a=await r.cleartext.readArmored(e)}catch(e){return void o(new Error("invalid_signature"))}const n=a.signature.packets[0].issuerKeyId.toHex(),l=a.signature.packets[0].signersUserId,u=a.signature.packets[0].preferredKeyServer||"https://keys.openpgp.org/",c=a.getText();let m=[];if(c.split("\n").forEach(((e,t)=>{const o=e.match(/^([a-zA-Z0-9]*)\=(.*)$/i);if(o)switch(o[1].toLowerCase()){case"key":m.push(o[2]);break;case"proof":d.users[0].claims.push(new i(o[2]))}})),m.length>0)try{d.key.uri=m[0],d.key.data=await s.fetchURI(d.key.uri),d.key.fetchMethod=d.key.uri.split(":")[0]}catch(e){}if(!d.key.data&&l)try{d.key.uri="wkd:"+l,d.key.data=await s.fetchURI(d.key.uri),d.key.fetchMethod="wkd"}catch(e){}if(!d.key.data)try{const e=u.match(/^(.*\:\/\/)?([^/]*)(?:\/)?$/i);d.key.uri=`hkp:${e[2]}:${n||l}`,d.key.data=await s.fetchURI(d.key.uri),d.key.fetchMethod="hkp"}catch(e){return void o(new Error("key_not_found"))}d.fingerprint=d.key.data.keyPacket.getFingerprint(),d.users[0].claims.forEach((e=>{e.fingerprint=d.fingerprint}));const p=await d.key.data.getPrimaryUser();let f;l&&d.key.data.users.forEach((e=>{e.userId.email==l&&(f=e)})),f||(f=p.user),d.users[0].userData={id:f.userId?f.userId.userid:null,name:f.userId?f.userId.name:null,email:f.userId?f.userId.email:null,comment:f.userId?f.userId.comment:null,isPrimary:p.user.userId.userid===f.userId.userid},d.primaryUserIndex=d.users[0].userData.isPrimary?0:null,t(d)}))}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./claim":"/home/yarmo/dev/doip/doipjs/src/claim.js","./keys":"/home/yarmo/dev/doip/doipjs/src/keys.js"}],"/home/yarmo/dev/doip/doipjs/src/utils.js":[function(e,t,o){const r=e("validator"),i=e("./enums");o.generateProxyURL=(e,t,o)=>{try{r.isFQDN(o.proxy.hostname)}catch(e){throw new Error("Invalid proxy hostname")}let i=[];return Object.keys(t).forEach((e=>{i.push(`${e}=${encodeURIComponent(t[e])}`)})),`http://${o.proxy.hostname}/api/2/get/${e}?${i.join("&")}`},o.generateClaim=(e,t)=>{switch(t){case i.ClaimFormat.URI:return"openpgp4fpr:"+e;case i.ClaimFormat.MESSAGE:return`[Verifying my OpenPGP key: openpgp4fpr:${e}]`;case i.ClaimFormat.FINGERPRINT:return e;default:throw new Error("No valid claim format")}}},{"./enums":"/home/yarmo/dev/doip/doipjs/src/enums.js",validator:"/home/yarmo/dev/doip/doipjs/node_modules/validator/index.js"}],"/home/yarmo/dev/doip/doipjs/src/verifications.js":[function(e,t,o){const r=e("./utils"),i=e("./enums"),s=(e,t,o,r)=>{let a;if(!e)return!1;if(Array.isArray(e)){let i=!1;return e.forEach(((e,a)=>{i||(i=s(e,t,o,r))})),i}if(0==t.length)switch(r){default:case i.ClaimRelation.CONTAINS:return a=new RegExp(o,"gi"),a.test(e.replace(/\r?\n|\r|\\/g,""));case i.ClaimRelation.EQUALS:return e.replace(/\r?\n|\r|\\/g,"").toLowerCase()==o.toLowerCase();case i.ClaimRelation.ONEOF:return a=new RegExp(o,"gi"),a.test(e.join("|"))}try{t[0]}catch(e){throw new Error("err_json_structure_incorrect")}return s(e[t[0]],t.slice(1),o,r)};o.run=(e,t,o)=>{let a={result:!1,completed:!1,errors:[]};switch(t.proof.request.format){case i.ProofFormat.JSON:try{a.result=s(e,t.claim.path,r.generateClaim(o,t.claim.format),t.claim.relation),a.completed=!0}catch(e){a.errors.push(e.message?e.message:e)}break;case i.ProofFormat.TEXT:try{const i=new RegExp(r.generateClaim(o,t.claim.format).replace("[","\\[").replace("]","\\]"),"gi");a.result=i.test(e.replace(/\r?\n|\r/,"")),a.completed=!0}catch(e){a.errors.push("err_unknown_text_verification")}}return a}},{"./enums":"/home/yarmo/dev/doip/doipjs/src/enums.js","./utils":"/home/yarmo/dev/doip/doipjs/src/utils.js"}]},{},["/home/yarmo/dev/doip/doipjs/src/index.js"])("/home/yarmo/dev/doip/doipjs/src/index.js")}));