Merge branch 'main' into support-fediverse-posts

This commit is contained in:
Yarmo Mackenbach 2022-11-17 19:21:26 +00:00
commit 82ee7e2dda
19 changed files with 40 additions and 44 deletions

View file

@ -46,11 +46,11 @@ const processURI = (uri) => {
} }
} }
}, },
claim: { claim: [{
format: E.ClaimFormat.URI, format: E.ClaimFormat.URI,
relation: E.ClaimRelation.CONTAINS, relation: E.ClaimRelation.CONTAINS,
path: ['body_markdown'] path: ['body_markdown']
} }]
} }
} }

View file

@ -46,11 +46,11 @@ const processURI = (uri) => {
} }
} }
}, },
claim: { claim: [{
format: E.ClaimFormat.URI, format: E.ClaimFormat.URI,
relation: E.ClaimRelation.CONTAINS, relation: E.ClaimRelation.CONTAINS,
path: ['user', 'bio_raw'] path: ['user', 'bio_raw']
} }]
} }
} }

View file

@ -45,11 +45,11 @@ const processURI = (uri) => {
} }
} }
}, },
claim: { claim: [{
format: E.ClaimFormat.URI, format: E.ClaimFormat.URI,
relation: E.ClaimRelation.CONTAINS, relation: E.ClaimRelation.CONTAINS,
path: ['records', 'txt'] path: ['records', 'txt']
} }]
} }
} }

View file

@ -46,11 +46,11 @@ const processURI = (uri) => {
} }
} }
}, },
claim: { claim: [{
format: E.ClaimFormat.URI, format: E.ClaimFormat.URI,
relation: E.ClaimRelation.EQUALS, relation: E.ClaimRelation.EQUALS,
path: ['description'] path: ['description']
} }]
} }
} }

View file

@ -46,11 +46,11 @@ const processURI = (uri) => {
} }
} }
}, },
claim: { claim: [{
format: E.ClaimFormat.URI, format: E.ClaimFormat.URI,
relation: E.ClaimRelation.CONTAINS, relation: E.ClaimRelation.CONTAINS,
path: ['files', 'openpgp.md', 'content'] path: ['files', 'openpgp.md', 'content']
} }]
} }
} }

View file

@ -46,11 +46,11 @@ const processURI = (uri) => {
} }
} }
}, },
claim: { claim: [{
format: E.ClaimFormat.URI, format: E.ClaimFormat.URI,
relation: E.ClaimRelation.EQUALS, relation: E.ClaimRelation.EQUALS,
path: ['description'] path: ['description']
} }]
} }
} }

View file

@ -46,11 +46,11 @@ const processURI = (uri) => {
} }
} }
}, },
claim: { claim: [{
format: E.ClaimFormat.URI, format: E.ClaimFormat.URI,
relation: E.ClaimRelation.CONTAINS, relation: E.ClaimRelation.CONTAINS,
path: ['about'] path: ['about']
} }]
} }
} }

View file

@ -46,11 +46,11 @@ const processURI = (uri) => {
} }
} }
}, },
claim: { claim: [{
format: E.ClaimFormat.URI, format: E.ClaimFormat.URI,
relation: E.ClaimRelation.CONTAINS, relation: E.ClaimRelation.CONTAINS,
path: [] path: []
} }]
} }
} }

View file

@ -46,11 +46,11 @@ const processURI = (uri) => {
} }
} }
}, },
claim: { claim: [{
format: E.ClaimFormat.URI, format: E.ClaimFormat.URI,
relation: E.ClaimRelation.CONTAINS, relation: E.ClaimRelation.CONTAINS,
path: ['statements', 'content'] path: ['statements', 'content']
} }]
} }
} }

View file

@ -46,11 +46,11 @@ const processURI = (uri) => {
} }
} }
}, },
claim: { claim: [{
format: E.ClaimFormat.FINGERPRINT, format: E.ClaimFormat.FINGERPRINT,
relation: E.ClaimRelation.CONTAINS, relation: E.ClaimRelation.CONTAINS,
path: ['profile', 'links'] path: ['profile', 'links']
} }]
} }
} }

View file

@ -46,11 +46,11 @@ const processURI = (uri) => {
} }
} }
}, },
claim: { claim: [{
format: E.ClaimFormat.URI, format: E.ClaimFormat.URI,
relation: E.ClaimRelation.CONTAINS, relation: E.ClaimRelation.CONTAINS,
path: ['about'] path: ['about']
} }]
} }
} }

View file

@ -60,11 +60,11 @@ const processURI = (uri) => {
} }
} }
}, },
claim: { claim: [{
format: E.ClaimFormat.URI, format: E.ClaimFormat.URI,
relation: E.ClaimRelation.CONTAINS, relation: E.ClaimRelation.CONTAINS,
path: ['content', 'body'] path: ['content', 'body']
} }]
} }
} }

View file

@ -46,11 +46,11 @@ const processURI = (uri) => {
} }
} }
}, },
claim: { claim: [{
format: E.ClaimFormat.FINGERPRINT, format: E.ClaimFormat.FINGERPRINT,
relation: E.ClaimRelation.CONTAINS, relation: E.ClaimRelation.CONTAINS,
path: ['socialHandles', 'url'] path: ['socialHandles', 'url']
} }]
} }
} }

View file

@ -46,11 +46,11 @@ const processURI = (uri) => {
} }
} }
}, },
claim: { claim: [{
format: E.ClaimFormat.URI, format: E.ClaimFormat.URI,
relation: E.ClaimRelation.CONTAINS, relation: E.ClaimRelation.CONTAINS,
path: ['data', 'children', 'data', 'selftext'] path: ['data', 'children', 'data', 'selftext']
} }]
} }
} }

View file

@ -48,11 +48,11 @@ const processURI = (uri) => {
} }
} }
}, },
claim: { claim: [{
format: E.ClaimFormat.URI, format: E.ClaimFormat.URI,
relation: E.ClaimRelation.CONTAINS, relation: E.ClaimRelation.CONTAINS,
path: ['items', 'about_me'] path: ['items', 'about_me']
} }]
} }
} }

View file

@ -46,11 +46,11 @@ const processURI = (uri) => {
} }
} }
}, },
claim: { claim: [{
format: E.ClaimFormat.URI, format: E.ClaimFormat.URI,
relation: E.ClaimRelation.EQUALS, relation: E.ClaimRelation.EQUALS,
path: ['text'] path: ['text']
} }]
} }
} }

View file

@ -45,11 +45,11 @@ const processURI = (uri) => {
} }
} }
}, },
claim: { claim: [{
format: E.ClaimFormat.URI, format: E.ClaimFormat.URI,
relation: E.ClaimRelation.CONTAINS, relation: E.ClaimRelation.CONTAINS,
path: [] path: []
} }]
} }
} }

View file

@ -46,11 +46,11 @@ const processURI = (uri) => {
} }
} }
}, },
claim: { claim: [{
format: E.ClaimFormat.URI, format: E.ClaimFormat.URI,
relation: E.ClaimRelation.CONTAINS, relation: E.ClaimRelation.CONTAINS,
path: [] path: []
} }]
} }
} }

View file

@ -200,14 +200,10 @@ const run = async (proofData, claimData, fingerprint) => {
errors: [] errors: []
} }
const claimMethods = Array.isArray(claimData.claim)
? claimData.claim
: [claimData.claim]
switch (claimData.proof.request.format) { switch (claimData.proof.request.format) {
case E.ProofFormat.JSON: case E.ProofFormat.JSON:
for (let index = 0; index < claimMethods.length; index++) { for (let index = 0; index < claimData.claim.length; index++) {
const claimMethod = claimMethods[index] const claimMethod = claimData.claim[index]
try { try {
res.result = res.result || await runJSON( res.result = res.result || await runJSON(
proofData, proofData,
@ -223,8 +219,8 @@ const run = async (proofData, claimData, fingerprint) => {
res.completed = true res.completed = true
break break
case E.ProofFormat.TEXT: case E.ProofFormat.TEXT:
for (let index = 0; index < claimMethods.length; index++) { for (let index = 0; index < claimData.claim.length; index++) {
const claimMethod = claimMethods[index] const claimMethod = claimData.claim[index]
try { try {
res.result = res.result || await containsProof( res.result = res.result || await containsProof(
proofData, proofData,