diff --git a/src/index.js b/src/index.js index 83f87e2..053c7b3 100644 --- a/src/index.js +++ b/src/index.js @@ -13,6 +13,7 @@ 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 mergeOptions = require('merge-options') const validUrl = require('valid-url') const serviceproviders = require('./serviceproviders') const claimVerification = require('./claimVerification') @@ -22,9 +23,12 @@ const verify = async (uri, fingerprint, opts) => { if (!fingerprint) { fingerprint = null } if (!opts) { opts = {} } - if (!('doipProxyHostname' in opts) || !opts.doipProxyHostname) { - opts.doipProxyHostname = 'proxy.keyoxide.org' + const defaultOpts = { + returnMatchesOnly: false, + proxyPolicy: 'adaptive', + doipProxyHostname: 'proxy.keyoxide.org' } + opts = mergeOptions(defaultOpts, opts) if (!validUrl.isUri(uri)) { throw new Error('Not a valid URI') diff --git a/src/utils.js b/src/utils.js index a3518bb..00bd60f 100644 --- a/src/utils.js +++ b/src/utils.js @@ -1,4 +1,5 @@ const generateProxyURL = (type, url, opts) => { + if (!opts || !opts.doipProxyHostname) { return null } return `https://${opts.doipProxyHostname}/api/1/get/${type}/${encodeURIComponent(url)}` }