Update definitions

This commit is contained in:
Yarmo Mackenbach 2021-04-12 15:59:03 +02:00
parent a9e69de547
commit f4308fb79d
No known key found for this signature in database
GPG key ID: 37367F4AF4087AD1
17 changed files with 204 additions and 211 deletions

View file

@ -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 See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
const { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums') const E = require('../enums')
const reURI = /^https:\/\/dev\.to\/(.*)\/(.*)\/?/ const reURI = /^https:\/\/dev\.to\/(.*)\/(.*)\/?/
@ -35,17 +35,21 @@ const processURI = (uri, opts) => {
}, },
proof: { proof: {
uri: uri, uri: uri,
fetch: `https://dev.to/api/articles/${match[1]}/${match[2]}`, request: {
access: proofAccess.NOCORS, fetcher: E.Fetcher.HTTP,
format: proofFormat.JSON, access: E.ProofAccess.NOCORS,
format: E.ProofFormat.JSON,
data: {
url: `https://dev.to/api/articles/${match[1]}/${match[2]}`,
}
}
}, },
claim: { claim: {
fingerprint: null, fingerprint: null,
format: claimFormat.MESSAGE, format: E.ClaimFormat.MESSAGE,
relation: claimRelation.CONTAINS, relation: E.ClaimRelation.CONTAINS,
path: ['body_markdown'], path: ['body_markdown'],
}, },
customRequestHandler: null,
} }
} }

View file

@ -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 See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
const { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums') const E = require('../enums')
const reURI = /^https:\/\/(.*)\/u\/(.*)\/?/ const reURI = /^https:\/\/(.*)\/u\/(.*)\/?/
@ -35,17 +35,21 @@ const processURI = (uri, opts) => {
}, },
proof: { proof: {
uri: uri, uri: uri,
fetch: `https://${match[1]}/u/${match[2]}.json`, request: {
access: proofAccess.NOCORS, fetcher: E.Fetcher.HTTP,
format: proofFormat.JSON, access: E.ProofAccess.NOCORS,
format: E.ProofFormat.JSON,
data: {
url: `https://${match[1]}/u/${match[2]}.json`,
}
}
}, },
claim: { claim: {
fingerprint: null, fingerprint: null,
format: claimFormat.MESSAGE, format: E.ClaimFormat.MESSAGE,
relation: claimRelation.CONTAINS, relation: E.ClaimRelation.CONTAINS,
path: ['user', 'bio_raw'], path: ['user', 'bio_raw'],
}, },
customRequestHandler: null,
} }
} }

View file

@ -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 See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
const { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums') const E = require('../enums')
const dns = require('dns')
const bent = require('bent')
const req = bent('GET')
const reURI = /^dns:([a-zA-Z0-9\.\-\_]*)(?:\?(.*))?/ 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) => { const processURI = (uri, opts) => {
if (!opts) { if (!opts) {
opts = {} opts = {}
@ -63,17 +35,21 @@ const processURI = (uri, opts) => {
}, },
proof: { proof: {
uri: null, uri: null,
fetch: null, request: {
access: proofAccess.SERVER, fetcher: E.Fetcher.DNS,
format: proofFormat.JSON, access: E.ProofAccess.SERVER,
format: E.ProofFormat.JSON,
data: {
domain: match[1],
}
}
}, },
claim: { claim: {
fingerprint: null, fingerprint: null,
format: claimFormat.URI, format: E.ClaimFormat.URI,
relation: claimRelation.CONTAINS, relation: E.ClaimRelation.CONTAINS,
path: ['records', 'txt'], path: ['records', 'txt'],
}, },
customRequestHandler: customRequestHandler,
} }
} }

View file

@ -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 See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
const { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums') const E = require('../enums')
const reURI = /^https:\/\/(.*)\/users\/(.*)\/?/ const reURI = /^https:\/\/(.*)\/users\/(.*)\/?/
@ -35,17 +35,21 @@ const processURI = (uri, opts) => {
}, },
proof: { proof: {
uri: uri, uri: uri,
fetch: null, request: {
access: proofAccess.GENERIC, fetcher: E.Fetcher.HTTP,
format: proofFormat.JSON, access: E.ProofAccess.GENERIC,
format: E.ProofFormat.JSON,
data: {
url: uri,
}
}
}, },
claim: { claim: {
fingerprint: null, fingerprint: null,
format: claimFormat.FINGERPRINT, format: E.ClaimFormat.FINGERPRINT,
relation: claimRelation.CONTAINS, relation: E.ClaimRelation.CONTAINS,
path: ['summary'], path: ['summary'],
}, },
customRequestHandler: null,
} }
} }

View file

@ -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 See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
const { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums') const E = require('../enums')
const reURI = /^https:\/\/(.*)\/(.*)\/gitea_proof\/?/ const reURI = /^https:\/\/(.*)\/(.*)\/gitea_proof\/?/
@ -35,17 +35,21 @@ const processURI = (uri, opts) => {
}, },
proof: { proof: {
uri: uri, uri: uri,
fetch: `https://${match[1]}/api/v1/repos/${match[2]}/gitea_proof`, request: {
access: proofAccess.NOCORS, fetcher: E.Fetcher.HTTP,
format: proofFormat.JSON, access: E.ProofAccess.NOCORS,
format: E.ProofFormat.JSON,
data: {
url: `https://${match[1]}/api/v1/repos/${match[2]}/gitea_proof`,
}
}
}, },
claim: { claim: {
fingerprint: null, fingerprint: null,
format: claimFormat.MESSAGE, format: E.ClaimFormat.MESSAGE,
relation: claimRelation.EQUALS, relation: E.ClaimRelation.EQUALS,
path: ['description'], path: ['description'],
}, },
customRequestHandler: null,
} }
} }

View file

@ -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 See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
const { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums') const E = require('../enums')
const reURI = /^https:\/\/gist\.github\.com\/(.*)\/(.*)\/?/ const reURI = /^https:\/\/gist\.github\.com\/(.*)\/(.*)\/?/
@ -35,17 +35,21 @@ const processURI = (uri, opts) => {
}, },
proof: { proof: {
uri: uri, uri: uri,
fetch: `https://api.github.com/gists/${match[2]}`, request: {
access: proofAccess.GENERIC, fetcher: E.Fetcher.HTTP,
format: proofFormat.JSON, access: E.ProofAccess.GENERIC,
format: E.ProofFormat.JSON,
data: {
url: `https://api.github.com/gists/${match[2]}`,
}
}
}, },
claim: { claim: {
fingerprint: null, fingerprint: null,
format: claimFormat.MESSAGE, format: E.ClaimFormat.MESSAGE,
relation: claimRelation.CONTAINS, relation: E.ClaimRelation.CONTAINS,
path: ['files', 'openpgp.md', 'content'], path: ['files', 'openpgp.md', 'content'],
}, },
customRequestHandler: null,
} }
} }

View file

@ -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 See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
const { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums') const E = require('../enums')
const bent = require('bent')
const req = bent('GET')
const reURI = /^https:\/\/(.*)\/(.*)\/gitlab_proof\/?/ 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) => { const processURI = (uri, opts) => {
if (!opts) { if (!opts) {
opts = {} opts = {}
@ -77,17 +35,22 @@ const processURI = (uri, opts) => {
}, },
proof: { proof: {
uri: uri, uri: uri,
fetch: null, request: {
access: proofAccess.GENERIC, fetcher: E.Fetcher.GITLAB,
format: proofFormat.JSON, access: E.ProofAccess.GENERIC,
format: E.ProofFormat.JSON,
data: {
domain: match[1],
username: match[2],
}
}
}, },
claim: { claim: {
fingerprint: null, fingerprint: null,
format: claimFormat.MESSAGE, format: E.ClaimFormat.MESSAGE,
relation: claimRelation.EQUALS, relation: E.ClaimRelation.EQUALS,
path: ['description'], path: ['description'],
}, },
customRequestHandler: customRequestHandler,
} }
} }

View file

@ -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 See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
const { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums') const E = require('../enums')
const reURI = /^https:\/\/news\.ycombinator\.com\/user\?id=(.*)\/?/ const reURI = /^https:\/\/news\.ycombinator\.com\/user\?id=(.*)\/?/
@ -35,17 +35,21 @@ const processURI = (uri, opts) => {
}, },
proof: { proof: {
uri: `https://hacker-news.firebaseio.com/v0/user/${match[1]}.json`, uri: `https://hacker-news.firebaseio.com/v0/user/${match[1]}.json`,
fetch: null, request: {
access: proofAccess.NOCORS, fetcher: E.Fetcher.HTTP,
format: proofFormat.JSON, access: E.ProofAccess.NOCORS,
format: E.ProofFormat.JSON,
data: {
url: `https://hacker-news.firebaseio.com/v0/user/${match[1]}.json`,
}
}
}, },
claim: { claim: {
fingerprint: null, fingerprint: null,
format: claimFormat.URI, format: E.ClaimFormat.URI,
relation: claimRelation.CONTAINS, relation: E.ClaimRelation.CONTAINS,
path: ['about'], path: ['about'],
}, },
customRequestHandler: null,
} }
} }

View file

@ -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 See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
const { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums') const E = require('../enums')
const utils = require('../utils')
const reURI = /^irc\:\/\/(.*)\/([a-zA-Z0-9]*)/ const reURI = /^irc\:\/\/(.*)\/([a-zA-Z0-9]*)/
@ -35,18 +34,23 @@ const processURI = (uri, opts) => {
qr: null, qr: null,
}, },
proof: { proof: {
uri: utils.generateProxyURL('irc', [match[1], match[2]], opts), uri: null,
fetch: null, request: {
access: proofAccess.SERVER, fetcher: E.Fetcher.IRC,
format: proofFormat.JSON, access: E.ProofAccess.SERVER,
format: E.ProofFormat.JSON,
data: {
domain: match[1],
nick: match[2],
}
}
}, },
claim: { claim: {
fingerprint: null, fingerprint: null,
format: claimFormat.URI, format: E.ClaimFormat.URI,
relation: claimRelation.CONTAINS, relation: E.ClaimRelation.CONTAINS,
path: [], path: [],
}, },
customRequestHandler: null,
} }
} }

View file

@ -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 See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
const { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums') const E = require('../enums')
const reURI = /^https:\/\/liberapay\.com\/(.*)\/?/ const reURI = /^https:\/\/liberapay\.com\/(.*)\/?/
@ -35,17 +35,21 @@ const processURI = (uri, opts) => {
}, },
proof: { proof: {
uri: uri, uri: uri,
fetch: `https://liberapay.com/${match[1]}/public.json`, request: {
access: proofAccess.GENERIC, fetcher: E.Fetcher.HTTP,
format: proofFormat.JSON, access: E.ProofAccess.GENERIC,
format: E.ProofFormat.JSON,
data: {
url: `https://liberapay.com/${match[1]}/public.json`,
}
}
}, },
claim: { claim: {
fingerprint: null, fingerprint: null,
format: claimFormat.MESSAGE, format: E.ClaimFormat.MESSAGE,
relation: claimRelation.CONTAINS, relation: E.ClaimRelation.CONTAINS,
path: ['statements', 'content'], path: ['statements', 'content'],
}, },
customRequestHandler: null,
} }
} }

View file

@ -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 See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
const { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums') const E = require('../enums')
const reURI = /^https:\/\/lobste\.rs\/u\/(.*)\/?/ const reURI = /^https:\/\/lobste\.rs\/u\/(.*)\/?/
@ -35,17 +35,21 @@ const processURI = (uri, opts) => {
}, },
proof: { proof: {
uri: `https://lobste.rs/u/${match[1]}.json`, uri: `https://lobste.rs/u/${match[1]}.json`,
fetch: null, request: {
access: proofAccess.NOCORS, fetcher: E.Fetcher.HTTP,
format: proofFormat.JSON, access: E.ProofAccess.NOCORS,
format: E.ProofFormat.JSON,
data: {
url: `https://lobste.rs/u/${match[1]}.json`,
}
}
}, },
claim: { claim: {
fingerprint: null, fingerprint: null,
format: claimFormat.MESSAGE, format: E.ClaimFormat.MESSAGE,
relation: claimRelation.CONTAINS, relation: E.ClaimRelation.CONTAINS,
path: ['about'], path: ['about'],
}, },
customRequestHandler: null,
} }
} }

View file

@ -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 See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
const { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums') const E = require('../enums')
const reURI = /^https:\/\/(.*)\/@(.*)\/?/ const reURI = /^https:\/\/(.*)\/@(.*)\/?/
@ -35,17 +35,21 @@ const processURI = (uri, opts) => {
}, },
proof: { proof: {
uri: uri, uri: uri,
fetch: null, request: {
access: proofAccess.GENERIC, fetcher: E.Fetcher.HTTP,
format: proofFormat.JSON, access: E.ProofAccess.GENERIC,
format: E.ProofFormat.JSON,
data: {
url: uri,
}
}
}, },
claim: { claim: {
fingerprint: null, fingerprint: null,
format: claimFormat.FINGERPRINT, format: E.ClaimFormat.FINGERPRINT,
relation: claimRelation.CONTAINS, relation: E.ClaimRelation.CONTAINS,
path: ['attachment', 'value'], path: ['attachment', 'value'],
}, },
customRequestHandler: null,
} }
} }

View file

@ -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 See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
const { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums') const E = require('../enums')
const bent = require('bent')
const req = bent('GET')
const queryString = require('query-string') const queryString = require('query-string')
const utils = require('../utils')
const reURI = /^matrix\:u\/(?:\@)?([^@:]*\:[^?]*)(\?.*)?/ const reURI = /^matrix\:u\/(?:\@)?([^@:]*\:[^?]*)(\?.*)?/
@ -27,23 +24,19 @@ const processURI = (uri, opts) => {
} }
const match = uri.match(reURI) const match = uri.match(reURI)
let profileUrl = null, if (!match[2]) {
eventUrl = null, return 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
)
}
} }
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 { return {
serviceprovider: { serviceprovider: {
type: 'communication', type: 'communication',
@ -56,17 +49,22 @@ const processURI = (uri, opts) => {
}, },
proof: { proof: {
uri: eventUrl, uri: eventUrl,
fetch: proofUrl, request: {
access: proofAccess.GRANTED, fetcher: E.Fetcher.MATRIX,
format: proofFormat.JSON, access: E.ProofAccess.GRANTED,
format: E.ProofFormat.JSON,
data: {
eventId: params['org.keyoxide.e'],
roomId: params['org.keyoxide.r'],
}
}
}, },
claim: { claim: {
fingerprint: null, fingerprint: null,
format: claimFormat.MESSAGE, format: E.ClaimFormat.MESSAGE,
relation: claimRelation.CONTAINS, relation: E.ClaimRelation.CONTAINS,
path: ['data', 'content', 'body'], path: ['data', 'content', 'body'],
}, },
customRequestHandler: null,
} }
} }

View file

@ -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 See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
const { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums') const E = require('../enums')
const reURI = /^https:\/\/(.*)/ const reURI = /^https:\/\/(.*)/
@ -35,17 +35,21 @@ const processURI = (uri, opts) => {
}, },
proof: { proof: {
uri: `${uri}/api/config`, uri: `${uri}/api/config`,
fetch: null, request: {
access: proofAccess.GENERIC, fetcher: E.Fetcher.HTTP,
format: proofFormat.JSON, access: E.ProofAccess.GENERIC,
format: E.ProofFormat.JSON,
data: {
url: `${uri}/api/config`,
}
}
}, },
claim: { claim: {
fingerprint: null, fingerprint: null,
format: claimFormat.FINGERPRINT, format: E.ClaimFormat.FINGERPRINT,
relation: claimRelation.CONTAINS, relation: E.ClaimRelation.CONTAINS,
path: ['socialHandles', 'url'], path: ['socialHandles', 'url'],
}, },
customRequestHandler: null,
} }
} }

View file

@ -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 See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
const { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums') const E = require('../enums')
const reURI = /^https:\/\/(?:www\.)?reddit\.com\/user\/(.*)\/comments\/(.*)\/(.*)\/?/ const reURI = /^https:\/\/(?:www\.)?reddit\.com\/user\/(.*)\/comments\/(.*)\/(.*)\/?/
@ -35,17 +35,21 @@ const processURI = (uri, opts) => {
}, },
proof: { proof: {
uri: uri, uri: uri,
fetch: `https://www.reddit.com/user/${match[1]}/comments/${match[2]}.json`, request: {
access: proofAccess.NOCORS, fetcher: E.Fetcher.HTTP,
format: proofFormat.JSON, access: E.ProofAccess.NOCORS,
format: E.ProofFormat.JSON,
data: {
url: `https://www.reddit.com/user/${match[1]}/comments/${match[2]}.json`,
}
}
}, },
claim: { claim: {
fingerprint: null, fingerprint: null,
format: claimFormat.MESSAGE, format: E.ClaimFormat.MESSAGE,
relation: claimRelation.CONTAINS, relation: E.ClaimRelation.CONTAINS,
path: ['data', 'children', 'data', 'selftext'], path: ['data', 'children', 'data', 'selftext'],
}, },
customRequestHandler: null,
} }
} }

View file

@ -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 See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
const { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums') const E = require('../enums')
const bent = require('bent') const bent = require('bent')
const req = bent('GET') const req = bent('GET')
const serviceproviders = require('../serviceproviders') const serviceproviders = require('../serviceproviders')
@ -82,17 +82,21 @@ const processURI = (uri, opts) => {
}, },
proof: { proof: {
uri: uri, uri: uri,
fetch: utils.generateProxyURL('twitter', match[2], opts), request: {
access: proofAccess.GRANTED, fetcher: E.Fetcher.TWITTER,
format: proofFormat.TEXT, access: E.ProofAccess.GRANTED,
format: E.ProofFormat.TEXT,
data: {
tweetId: match[2],
}
}
}, },
claim: { claim: {
fingerprint: null, fingerprint: null,
format: claimFormat.MESSAGE, format: E.ClaimFormat.MESSAGE,
relation: claimRelation.CONTAINS, relation: E.ClaimRelation.CONTAINS,
path: [], path: [],
}, },
customRequestHandler: customRequestHandler,
} }
} }

View file

@ -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 See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
const { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums') const E = require('../enums')
const utils = require('../utils')
const reURI = /^xmpp:([a-zA-Z0-9\.\-\_]*)@([a-zA-Z0-9\.\-\_]*)(?:\?(.*))?/ const reURI = /^xmpp:([a-zA-Z0-9\.\-\_]*)@([a-zA-Z0-9\.\-\_]*)(?:\?(.*))?/
@ -35,18 +34,23 @@ const processURI = (uri, opts) => {
qr: uri, qr: uri,
}, },
proof: { proof: {
uri: utils.generateProxyURL('xmpp', `${match[1]}@${match[2]}`, opts), uri: null,
fetch: null, request: {
access: proofAccess.SERVER, fetcher: E.Fetcher.XMPP,
format: proofFormat.JSON, access: E.ProofAccess.SERVER,
format: E.ProofFormat.JSON,
data: {
username: match[1],
service: match[2],
}
}
}, },
claim: { claim: {
fingerprint: null, fingerprint: null,
format: claimFormat.MESSAGE, format: E.ClaimFormat.MESSAGE,
relation: claimRelation.CONTAINS, relation: E.ClaimRelation.CONTAINS,
path: [], path: [],
}, },
customRequestHandler: null,
} }
} }