mirror of
https://codeberg.org/keyoxide/doipjs.git
synced 2024-12-22 14:39:28 -07:00
Add URI validation
This commit is contained in:
parent
cdbb0b1ef1
commit
b78d7a7ce9
3 changed files with 23 additions and 3 deletions
13
package-lock.json
generated
13
package-lock.json
generated
|
@ -7,6 +7,9 @@
|
||||||
"": {
|
"": {
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
|
"dependencies": {
|
||||||
|
"valid-url": "^1.0.9"
|
||||||
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"chai": "^4.2.0",
|
"chai": "^4.2.0",
|
||||||
"license-check-and-add": "^3.0.4",
|
"license-check-and-add": "^3.0.4",
|
||||||
|
@ -1462,6 +1465,11 @@
|
||||||
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=",
|
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"node_modules/valid-url": {
|
||||||
|
"version": "1.0.9",
|
||||||
|
"resolved": "https://registry.npmjs.org/valid-url/-/valid-url-1.0.9.tgz",
|
||||||
|
"integrity": "sha1-HBRHm0DxOXp1eC8RXkCGRHQzogA="
|
||||||
|
},
|
||||||
"node_modules/which": {
|
"node_modules/which": {
|
||||||
"version": "2.0.2",
|
"version": "2.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
||||||
|
@ -2769,6 +2777,11 @@
|
||||||
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=",
|
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"valid-url": {
|
||||||
|
"version": "1.0.9",
|
||||||
|
"resolved": "https://registry.npmjs.org/valid-url/-/valid-url-1.0.9.tgz",
|
||||||
|
"integrity": "sha1-HBRHm0DxOXp1eC8RXkCGRHQzogA="
|
||||||
|
},
|
||||||
"which": {
|
"which": {
|
||||||
"version": "2.0.2",
|
"version": "2.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
||||||
|
|
|
@ -3,7 +3,9 @@
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"description": "Decentralized OpenPGP Identity Proofs library in node",
|
"description": "Decentralized OpenPGP Identity Proofs library in node",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"dependencies": {},
|
"dependencies": {
|
||||||
|
"valid-url": "^1.0.9"
|
||||||
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"chai": "^4.2.0",
|
"chai": "^4.2.0",
|
||||||
"license-check-and-add": "^3.0.4",
|
"license-check-and-add": "^3.0.4",
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
const verify = (url, fingerprint, opts) => {
|
const validUrl = require('valid-url')
|
||||||
|
const serviceprovidersList = require('./serviceproviders').serviceprovidersList
|
||||||
|
|
||||||
|
const verify = (uri, fingerprint, opts) => {
|
||||||
|
if !(validUrl.isUri(uri)) {
|
||||||
|
throw new Error('The provided URI was not valid')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.verify = verify
|
exports.verify = verify
|
||||||
exports.serviceproviders = require('./serviceproviders').serviceproviders
|
exports.serviceproviders = require('./serviceproviders').serviceproviders
|
||||||
exports.serviceprovidersList = require('./serviceproviders').serviceprovidersList
|
exports.serviceprovidersList = serviceprovidersList
|
||||||
|
|
Loading…
Reference in a new issue