From f4308fb79d0f55fc0a194417f3b698a2c57ce1c0 Mon Sep 17 00:00:00 2001 From: Yarmo Mackenbach Date: Mon, 12 Apr 2021 15:59:03 +0200 Subject: [PATCH] Update definitions --- src/serviceproviders/devto.js | 18 +++++---- src/serviceproviders/discourse.js | 18 +++++---- src/serviceproviders/dns.js | 46 ++++++---------------- src/serviceproviders/fediverse.js | 18 +++++---- src/serviceproviders/gitea.js | 18 +++++---- src/serviceproviders/github.js | 18 +++++---- src/serviceproviders/gitlab.js | 61 ++++++------------------------ src/serviceproviders/hackernews.js | 18 +++++---- src/serviceproviders/irc.js | 22 ++++++----- src/serviceproviders/liberapay.js | 18 +++++---- src/serviceproviders/lobsters.js | 18 +++++---- src/serviceproviders/mastodon.js | 18 +++++---- src/serviceproviders/matrix.js | 48 +++++++++++------------ src/serviceproviders/owncast.js | 18 +++++---- src/serviceproviders/reddit.js | 18 +++++---- src/serviceproviders/twitter.js | 18 +++++---- src/serviceproviders/xmpp.js | 22 ++++++----- 17 files changed, 204 insertions(+), 211 deletions(-) diff --git a/src/serviceproviders/devto.js b/src/serviceproviders/devto.js index 4343215..17a0499 100644 --- a/src/serviceproviders/devto.js +++ b/src/serviceproviders/devto.js @@ -13,7 +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 { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums') +const E = require('../enums') const reURI = /^https:\/\/dev\.to\/(.*)\/(.*)\/?/ @@ -35,17 +35,21 @@ const processURI = (uri, opts) => { }, proof: { uri: uri, - fetch: `https://dev.to/api/articles/${match[1]}/${match[2]}`, - access: proofAccess.NOCORS, - format: proofFormat.JSON, + request: { + fetcher: E.Fetcher.HTTP, + access: E.ProofAccess.NOCORS, + format: E.ProofFormat.JSON, + data: { + url: `https://dev.to/api/articles/${match[1]}/${match[2]}`, + } + } }, claim: { fingerprint: null, - format: claimFormat.MESSAGE, - relation: claimRelation.CONTAINS, + format: E.ClaimFormat.MESSAGE, + relation: E.ClaimRelation.CONTAINS, path: ['body_markdown'], }, - customRequestHandler: null, } } diff --git a/src/serviceproviders/discourse.js b/src/serviceproviders/discourse.js index c1569e9..ab2f454 100644 --- a/src/serviceproviders/discourse.js +++ b/src/serviceproviders/discourse.js @@ -13,7 +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 { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums') +const E = require('../enums') const reURI = /^https:\/\/(.*)\/u\/(.*)\/?/ @@ -35,17 +35,21 @@ const processURI = (uri, opts) => { }, proof: { uri: uri, - fetch: `https://${match[1]}/u/${match[2]}.json`, - access: proofAccess.NOCORS, - format: proofFormat.JSON, + request: { + fetcher: E.Fetcher.HTTP, + access: E.ProofAccess.NOCORS, + format: E.ProofFormat.JSON, + data: { + url: `https://${match[1]}/u/${match[2]}.json`, + } + } }, claim: { fingerprint: null, - format: claimFormat.MESSAGE, - relation: claimRelation.CONTAINS, + format: E.ClaimFormat.MESSAGE, + relation: E.ClaimRelation.CONTAINS, path: ['user', 'bio_raw'], }, - customRequestHandler: null, } } diff --git a/src/serviceproviders/dns.js b/src/serviceproviders/dns.js index 224b528..167c55b 100644 --- a/src/serviceproviders/dns.js +++ b/src/serviceproviders/dns.js @@ -13,38 +13,10 @@ 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 { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums') -const dns = require('dns') -const bent = require('bent') -const req = bent('GET') +const E = require('../enums') 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(), - }, - } - } 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 = {} @@ -63,17 +35,21 @@ const processURI = (uri, opts) => { }, proof: { uri: null, - fetch: null, - access: proofAccess.SERVER, - format: proofFormat.JSON, + request: { + fetcher: E.Fetcher.DNS, + access: E.ProofAccess.SERVER, + format: E.ProofFormat.JSON, + data: { + domain: match[1], + } + } }, claim: { fingerprint: null, - format: claimFormat.URI, - relation: claimRelation.CONTAINS, + format: E.ClaimFormat.URI, + relation: E.ClaimRelation.CONTAINS, path: ['records', 'txt'], }, - customRequestHandler: customRequestHandler, } } diff --git a/src/serviceproviders/fediverse.js b/src/serviceproviders/fediverse.js index 3c14501..531973c 100644 --- a/src/serviceproviders/fediverse.js +++ b/src/serviceproviders/fediverse.js @@ -13,7 +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 { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums') +const E = require('../enums') const reURI = /^https:\/\/(.*)\/users\/(.*)\/?/ @@ -35,17 +35,21 @@ const processURI = (uri, opts) => { }, proof: { uri: uri, - fetch: null, - access: proofAccess.GENERIC, - format: proofFormat.JSON, + request: { + fetcher: E.Fetcher.HTTP, + access: E.ProofAccess.GENERIC, + format: E.ProofFormat.JSON, + data: { + url: uri, + } + } }, claim: { fingerprint: null, - format: claimFormat.FINGERPRINT, - relation: claimRelation.CONTAINS, + format: E.ClaimFormat.FINGERPRINT, + relation: E.ClaimRelation.CONTAINS, path: ['summary'], }, - customRequestHandler: null, } } diff --git a/src/serviceproviders/gitea.js b/src/serviceproviders/gitea.js index d258f62..7b37270 100644 --- a/src/serviceproviders/gitea.js +++ b/src/serviceproviders/gitea.js @@ -13,7 +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 { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums') +const E = require('../enums') const reURI = /^https:\/\/(.*)\/(.*)\/gitea_proof\/?/ @@ -35,17 +35,21 @@ const processURI = (uri, opts) => { }, proof: { uri: uri, - fetch: `https://${match[1]}/api/v1/repos/${match[2]}/gitea_proof`, - access: proofAccess.NOCORS, - format: proofFormat.JSON, + 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`, + } + } }, claim: { fingerprint: null, - format: claimFormat.MESSAGE, - relation: claimRelation.EQUALS, + format: E.ClaimFormat.MESSAGE, + relation: E.ClaimRelation.EQUALS, path: ['description'], }, - customRequestHandler: null, } } diff --git a/src/serviceproviders/github.js b/src/serviceproviders/github.js index 726f2bb..87dd140 100644 --- a/src/serviceproviders/github.js +++ b/src/serviceproviders/github.js @@ -13,7 +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 { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums') +const E = require('../enums') const reURI = /^https:\/\/gist\.github\.com\/(.*)\/(.*)\/?/ @@ -35,17 +35,21 @@ const processURI = (uri, opts) => { }, proof: { uri: uri, - fetch: `https://api.github.com/gists/${match[2]}`, - access: proofAccess.GENERIC, - format: proofFormat.JSON, + request: { + fetcher: E.Fetcher.HTTP, + access: E.ProofAccess.GENERIC, + format: E.ProofFormat.JSON, + data: { + url: `https://api.github.com/gists/${match[2]}`, + } + } }, claim: { fingerprint: null, - format: claimFormat.MESSAGE, - relation: claimRelation.CONTAINS, + format: E.ClaimFormat.MESSAGE, + relation: E.ClaimRelation.CONTAINS, path: ['files', 'openpgp.md', 'content'], }, - customRequestHandler: null, } } diff --git a/src/serviceproviders/gitlab.js b/src/serviceproviders/gitlab.js index e987cc1..7a24b46 100644 --- a/src/serviceproviders/gitlab.js +++ b/src/serviceproviders/gitlab.js @@ -13,52 +13,10 @@ 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 { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums') -const bent = require('bent') -const req = bent('GET') +const E = require('../enums') 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 = {} @@ -77,17 +35,22 @@ const processURI = (uri, opts) => { }, proof: { uri: uri, - fetch: null, - access: proofAccess.GENERIC, - format: proofFormat.JSON, + request: { + fetcher: E.Fetcher.GITLAB, + access: E.ProofAccess.GENERIC, + format: E.ProofFormat.JSON, + data: { + domain: match[1], + username: match[2], + } + } }, claim: { fingerprint: null, - format: claimFormat.MESSAGE, - relation: claimRelation.EQUALS, + format: E.ClaimFormat.MESSAGE, + relation: E.ClaimRelation.EQUALS, path: ['description'], }, - customRequestHandler: customRequestHandler, } } diff --git a/src/serviceproviders/hackernews.js b/src/serviceproviders/hackernews.js index d090160..34bfb72 100644 --- a/src/serviceproviders/hackernews.js +++ b/src/serviceproviders/hackernews.js @@ -13,7 +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 { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums') +const E = require('../enums') const reURI = /^https:\/\/news\.ycombinator\.com\/user\?id=(.*)\/?/ @@ -35,17 +35,21 @@ const processURI = (uri, opts) => { }, proof: { uri: `https://hacker-news.firebaseio.com/v0/user/${match[1]}.json`, - fetch: null, - access: proofAccess.NOCORS, - format: proofFormat.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`, + } + } }, claim: { fingerprint: null, - format: claimFormat.URI, - relation: claimRelation.CONTAINS, + format: E.ClaimFormat.URI, + relation: E.ClaimRelation.CONTAINS, path: ['about'], }, - customRequestHandler: null, } } diff --git a/src/serviceproviders/irc.js b/src/serviceproviders/irc.js index 2402075..15a2e48 100644 --- a/src/serviceproviders/irc.js +++ b/src/serviceproviders/irc.js @@ -13,8 +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 { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums') -const utils = require('../utils') +const E = require('../enums') const reURI = /^irc\:\/\/(.*)\/([a-zA-Z0-9]*)/ @@ -35,18 +34,23 @@ const processURI = (uri, opts) => { qr: null, }, proof: { - uri: utils.generateProxyURL('irc', [match[1], match[2]], opts), - fetch: null, - access: proofAccess.SERVER, - format: proofFormat.JSON, + uri: null, + request: { + fetcher: E.Fetcher.IRC, + access: E.ProofAccess.SERVER, + format: E.ProofFormat.JSON, + data: { + domain: match[1], + nick: match[2], + } + } }, claim: { fingerprint: null, - format: claimFormat.URI, - relation: claimRelation.CONTAINS, + format: E.ClaimFormat.URI, + relation: E.ClaimRelation.CONTAINS, path: [], }, - customRequestHandler: null, } } diff --git a/src/serviceproviders/liberapay.js b/src/serviceproviders/liberapay.js index 8e01f88..4cddf27 100644 --- a/src/serviceproviders/liberapay.js +++ b/src/serviceproviders/liberapay.js @@ -13,7 +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 { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums') +const E = require('../enums') const reURI = /^https:\/\/liberapay\.com\/(.*)\/?/ @@ -35,17 +35,21 @@ const processURI = (uri, opts) => { }, proof: { uri: uri, - fetch: `https://liberapay.com/${match[1]}/public.json`, - access: proofAccess.GENERIC, - format: proofFormat.JSON, + request: { + fetcher: E.Fetcher.HTTP, + access: E.ProofAccess.GENERIC, + format: E.ProofFormat.JSON, + data: { + url: `https://liberapay.com/${match[1]}/public.json`, + } + } }, claim: { fingerprint: null, - format: claimFormat.MESSAGE, - relation: claimRelation.CONTAINS, + format: E.ClaimFormat.MESSAGE, + relation: E.ClaimRelation.CONTAINS, path: ['statements', 'content'], }, - customRequestHandler: null, } } diff --git a/src/serviceproviders/lobsters.js b/src/serviceproviders/lobsters.js index a1e803f..17399ec 100644 --- a/src/serviceproviders/lobsters.js +++ b/src/serviceproviders/lobsters.js @@ -13,7 +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 { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums') +const E = require('../enums') const reURI = /^https:\/\/lobste\.rs\/u\/(.*)\/?/ @@ -35,17 +35,21 @@ const processURI = (uri, opts) => { }, proof: { uri: `https://lobste.rs/u/${match[1]}.json`, - fetch: null, - access: proofAccess.NOCORS, - format: proofFormat.JSON, + request: { + fetcher: E.Fetcher.HTTP, + access: E.ProofAccess.NOCORS, + format: E.ProofFormat.JSON, + data: { + url: `https://lobste.rs/u/${match[1]}.json`, + } + } }, claim: { fingerprint: null, - format: claimFormat.MESSAGE, - relation: claimRelation.CONTAINS, + format: E.ClaimFormat.MESSAGE, + relation: E.ClaimRelation.CONTAINS, path: ['about'], }, - customRequestHandler: null, } } diff --git a/src/serviceproviders/mastodon.js b/src/serviceproviders/mastodon.js index e3f7f37..340814e 100644 --- a/src/serviceproviders/mastodon.js +++ b/src/serviceproviders/mastodon.js @@ -13,7 +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 { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums') +const E = require('../enums') const reURI = /^https:\/\/(.*)\/@(.*)\/?/ @@ -35,17 +35,21 @@ const processURI = (uri, opts) => { }, proof: { uri: uri, - fetch: null, - access: proofAccess.GENERIC, - format: proofFormat.JSON, + request: { + fetcher: E.Fetcher.HTTP, + access: E.ProofAccess.GENERIC, + format: E.ProofFormat.JSON, + data: { + url: uri, + } + } }, claim: { fingerprint: null, - format: claimFormat.FINGERPRINT, - relation: claimRelation.CONTAINS, + format: E.ClaimFormat.FINGERPRINT, + relation: E.ClaimRelation.CONTAINS, path: ['attachment', 'value'], }, - customRequestHandler: null, } } diff --git a/src/serviceproviders/matrix.js b/src/serviceproviders/matrix.js index e60a59e..319003c 100644 --- a/src/serviceproviders/matrix.js +++ b/src/serviceproviders/matrix.js @@ -13,11 +13,8 @@ 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 { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums') -const bent = require('bent') -const req = bent('GET') +const E = require('../enums') const queryString = require('query-string') -const utils = require('../utils') const reURI = /^matrix\:u\/(?:\@)?([^@:]*\:[^?]*)(\?.*)?/ @@ -27,23 +24,19 @@ const processURI = (uri, 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']], - opts - ) - } + 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', @@ -56,17 +49,22 @@ const processURI = (uri, opts) => { }, proof: { uri: eventUrl, - fetch: proofUrl, - access: proofAccess.GRANTED, - format: proofFormat.JSON, + 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: { fingerprint: null, - format: claimFormat.MESSAGE, - relation: claimRelation.CONTAINS, + format: E.ClaimFormat.MESSAGE, + relation: E.ClaimRelation.CONTAINS, path: ['data', 'content', 'body'], }, - customRequestHandler: null, } } diff --git a/src/serviceproviders/owncast.js b/src/serviceproviders/owncast.js index e38e575..8cdc378 100644 --- a/src/serviceproviders/owncast.js +++ b/src/serviceproviders/owncast.js @@ -13,7 +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 { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums') +const E = require('../enums') const reURI = /^https:\/\/(.*)/ @@ -35,17 +35,21 @@ const processURI = (uri, opts) => { }, proof: { uri: `${uri}/api/config`, - fetch: null, - access: proofAccess.GENERIC, - format: proofFormat.JSON, + request: { + fetcher: E.Fetcher.HTTP, + access: E.ProofAccess.GENERIC, + format: E.ProofFormat.JSON, + data: { + url: `${uri}/api/config`, + } + } }, claim: { fingerprint: null, - format: claimFormat.FINGERPRINT, - relation: claimRelation.CONTAINS, + format: E.ClaimFormat.FINGERPRINT, + relation: E.ClaimRelation.CONTAINS, path: ['socialHandles', 'url'], }, - customRequestHandler: null, } } diff --git a/src/serviceproviders/reddit.js b/src/serviceproviders/reddit.js index 7b8b09f..4b212f9 100644 --- a/src/serviceproviders/reddit.js +++ b/src/serviceproviders/reddit.js @@ -13,7 +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 { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums') +const E = require('../enums') const reURI = /^https:\/\/(?:www\.)?reddit\.com\/user\/(.*)\/comments\/(.*)\/(.*)\/?/ @@ -35,17 +35,21 @@ const processURI = (uri, opts) => { }, proof: { uri: uri, - fetch: `https://www.reddit.com/user/${match[1]}/comments/${match[2]}.json`, - access: proofAccess.NOCORS, - format: proofFormat.JSON, + 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`, + } + } }, claim: { fingerprint: null, - format: claimFormat.MESSAGE, - relation: claimRelation.CONTAINS, + format: E.ClaimFormat.MESSAGE, + relation: E.ClaimRelation.CONTAINS, path: ['data', 'children', 'data', 'selftext'], }, - customRequestHandler: null, } } diff --git a/src/serviceproviders/twitter.js b/src/serviceproviders/twitter.js index 230dadd..8294aae 100644 --- a/src/serviceproviders/twitter.js +++ b/src/serviceproviders/twitter.js @@ -13,7 +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 { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums') +const E = require('../enums') const bent = require('bent') const req = bent('GET') const serviceproviders = require('../serviceproviders') @@ -82,17 +82,21 @@ const processURI = (uri, opts) => { }, proof: { uri: uri, - fetch: utils.generateProxyURL('twitter', match[2], opts), - access: proofAccess.GRANTED, - format: proofFormat.TEXT, + request: { + fetcher: E.Fetcher.TWITTER, + access: E.ProofAccess.GRANTED, + format: E.ProofFormat.TEXT, + data: { + tweetId: match[2], + } + } }, claim: { fingerprint: null, - format: claimFormat.MESSAGE, - relation: claimRelation.CONTAINS, + format: E.ClaimFormat.MESSAGE, + relation: E.ClaimRelation.CONTAINS, path: [], }, - customRequestHandler: customRequestHandler, } } diff --git a/src/serviceproviders/xmpp.js b/src/serviceproviders/xmpp.js index 1f333b7..0396a9a 100644 --- a/src/serviceproviders/xmpp.js +++ b/src/serviceproviders/xmpp.js @@ -13,8 +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 { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums') -const utils = require('../utils') +const E = require('../enums') const reURI = /^xmpp:([a-zA-Z0-9\.\-\_]*)@([a-zA-Z0-9\.\-\_]*)(?:\?(.*))?/ @@ -35,18 +34,23 @@ const processURI = (uri, opts) => { qr: uri, }, proof: { - uri: utils.generateProxyURL('xmpp', `${match[1]}@${match[2]}`, opts), - fetch: null, - access: proofAccess.SERVER, - format: proofFormat.JSON, + uri: null, + request: { + fetcher: E.Fetcher.XMPP, + access: E.ProofAccess.SERVER, + format: E.ProofFormat.JSON, + data: { + username: match[1], + service: match[2], + } + } }, claim: { fingerprint: null, - format: claimFormat.MESSAGE, - relation: claimRelation.CONTAINS, + format: E.ClaimFormat.MESSAGE, + relation: E.ClaimRelation.CONTAINS, path: [], }, - customRequestHandler: null, } }