Run prettier

This commit is contained in:
Yarmo Mackenbach 2020-12-05 23:14:09 +01:00
parent b9c76b7c0e
commit 34dc50d031
3 changed files with 66 additions and 58 deletions

View file

@ -51,7 +51,7 @@ Verifies the identity behind the provided **array of uris** using the **fingerpr
**Parameters**
| Name | Type | Mandatory | Description |
| ----------- | ------ | --------- | -------------------------------- |
| ----------- | ------ | --------- | ---------------------------- |
| uriArray | array | true | array of uris |
| fingerprint | string | false | the fingerprint of the claim |
| opts | object | false | options (see below) |
@ -71,12 +71,12 @@ _(async)_ doip.claims.verify(key, [fingerprint], [opts])
Verifies the identity behind the claims contained within the provided
**key** using the **fingerprint**. This key is outputted by the
[keys.fetch.*()](#keysfetchuriuri) commands.
[keys.fetch.\*()](#keysfetchuriuri) commands.
**Parameters**
| Name | Type | Mandatory | Description |
| ----------- | ------ | --------- | -------------------------------- |
| ----------- | ------ | --------- | ---------------------------- |
| key | object | true | a public key |
| fingerprint | string | false | the fingerprint of the claim |
| opts | object | false | options (see below) |
@ -100,7 +100,7 @@ other `keys.fetch.*` commands.
**Parameters**
| Name | Type | Mandatory | Description |
| ----------- | ------ | --------- | -------------------------------- |
| ---- | ------ | --------- | --------------------- |
| uri | string | true | public key identifier |
Possible formats for `uri`:
@ -125,7 +125,7 @@ Fetches a key using HKP-compatible key servers.
**Parameters**
| Name | Type | Mandatory | Description |
| ---------------- | ------ | --------- | -------------------------------- |
| ---------------- | ------ | --------- | --------------------- |
| fingerprint | string | true | public key identifier |
| keyserverBaseUrl | string | false | base URL of keyserver |
@ -144,7 +144,7 @@ Fetches a key using HKP-compatible key servers.
**Parameters**
| Name | Type | Mandatory | Description |
| ---------------- | ------ | --------- | -------------------------------- |
| ---------------- | ------ | --------- | --------------------- |
| email | string | true | public key identifier |
| keyserverBaseUrl | string | false | base URL of keyserver |
@ -163,7 +163,7 @@ Fetches a key using the WKD protocol.
**Parameters**
| Name | Type | Mandatory | Description |
| ----------- | ------ | --------- | -------------------------------- |
| ----- | ------ | --------- | -------------- |
| wkdId | string | true | WKD identifier |
`wkdId` looks like an email address and is formatted as `username@domain.org`.
@ -181,7 +181,7 @@ Parses the `keyPlaintext`.
**Parameters**
| Name | Type | Mandatory | Description |
| ------------ | ------ | --------- | -------------------------------- |
| ------------ | ------ | --------- | ----------------- |
| keyPlaintext | string | true | ASCII key content |
**Returns**

View file

@ -16,7 +16,11 @@ limitations under the License.
const path = require('path')
const mergeOptions = require('merge-options')
const validUrl = require('valid-url')
const openpgp = require(path.join(require.resolve('openpgp'), '..', 'openpgp.min.js'))
const openpgp = require(path.join(
require.resolve('openpgp'),
'..',
'openpgp.min.js'
))
const serviceproviders = require('./serviceproviders')
const keys = require('./keys')
const utils = require('./utils')

View file

@ -65,7 +65,8 @@ const match = (uri, opts) => {
return matches
}
const directRequestHandler = async (spData, opts) => {
const directRequestHandler = (spData, opts) => {
return new Promise(async (resolve, reject) => {
const url = spData.proof.fetch ? spData.proof.fetch : spData.proof.uri
let res
@ -75,19 +76,21 @@ const directRequestHandler = async (spData, opts) => {
Accept: 'application/json',
'User-Agent': `doipjs/${require('../package.json').version}`,
})
return await res.json()
resolve(await res.json())
break
case 'text':
res = await req(url)
return await res.text()
resolve(await res.text())
break
default:
throw new Error('No specified proof data format')
reject('No specified proof data format')
break
}
})
}
const proxyRequestHandler = async (spData, opts) => {
const proxyRequestHandler = (spData, opts) => {
return new Promise(async (resolve, reject) => {
const url = spData.proof.fetch ? spData.proof.fetch : spData.proof.uri
const res = await req(
utils.generateProxyURL(spData.proof.format, url, opts),
@ -95,7 +98,8 @@ const proxyRequestHandler = async (spData, opts) => {
{ Accept: 'application/json' }
)
const json = await res.json()
return json.content
resolve(json.content)
})
}
exports.list = list