Make data structure uniform

This commit is contained in:
Yarmo Mackenbach 2022-11-16 22:25:32 +01:00
parent 4ff11947e4
commit 1e37969dc6
No known key found for this signature in database
GPG key ID: 37367F4AF4087AD1
19 changed files with 40 additions and 44 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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