Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constraints validation doesn’t work properly #3

Open
soluchok opened this issue Dec 11, 2020 · 0 comments
Open

Constraints validation doesn’t work properly #3

soluchok opened this issue Dec 11, 2020 · 0 comments

Comments

@soluchok
Copy link

soluchok commented Dec 11, 2020

In the example below we have a pattern custom:did:work:YUab9X6vawnYVfGPuNRVdk.

{
 "presentation_definition": {
  "locale": "en-US",
  "format": {
   "ldp_vp": {
    "proof_type": [
     "JcsEd25519Signature2020"
    ]
   }
  },
  "input_descriptors": [
   {
    "id": "name_input",
    "schema": {
     "uri": [
      "did:work:YUab9X6vawnYVfGPuNRVdk;id=ac254b19-8835-4907-a2eb-ac0442526d6a;version=1.0"
     ],
     "name": "Name Schema",
     "purpose": "To get an individual's first and last name"
    },
    "constraints": {
     "fields": [
      {
       "path": [
        "$.issuer"
       ],
       "purpose": "Must be from a known issuer",
       "filter": {
        "type": "string",
        "pattern": "custom:did:work:YUab9X6vawnYVfGPuNRVdk",
        "minLength": 1
       }
      },
      {
       "path": [
        "$.credentialSubject.lastName"
       ],
       "purpose": "We need your last name",
       "filter": {
        "type": "string",
        "minLength": 2
       }
      }
     ]
    }
   }
  ]
 }
}

In the output, you can see that we have issuer did:work:YUab9X6vawnYVfGPuNRVdk.

{
 "@context": [
  "https://www.w3.org/2018/credentials/v1",
  "https://identity.foundation/presentation-exchange/submission/v1"
 ],
 "type": [
  "VerifiablePresentation",
  "PresentationSubmission"
 ],
 "presentation_submission": {
  "locale": "en-US",
  "descriptor_map": [
   {
    "id": "name_input",
    "path": "$.verifiableCredential[0]",
    "format": "ldp_vp"
   }
  ]
 },
 "verifiableCredential": [
  {
   "modelVersion": "1.0",
   "@context": [
    "https://www.w3.org/2018/credentials/v1"
   ],
   "id": "46bd6465-1b75-4886-a667-d73a3ea087c0",
   "type": [
    "VerifiableCredential",
    "https://credentials.workday.com/docs/specification/v1.0/credential.json"
   ],
   "issuer": "did:work:YUab9X6vawnYVfGPuNRVdk",
   "issuanceDate": "2020-12-11T17:53:54+02:00",
   "credentialSchema": {
    "id": "did:work:YUab9X6vawnYVfGPuNRVdk;id=ac254b19-8835-4907-a2eb-ac0442526d6a;version=1.0",
    "type": "JsonSchemaValidatorWorkday2019"
   },
   "credentialStatus": {
    "id": "https://testrevocationservice.com//HFZfB4uBxat3EqsFrJAjX46EFDVHKnthLQuhWnmz27v4",
    "type": "WorkdayRevocation2020"
   },
   "nonTransferable": true,
   "credentialSubject": {
    "firstName": "Genghis",
    "id": "did:work:U5mgAxLaVuLkkr4LPNtDrN",
    "lastName": "Khan"
   },
   "claimProofs": {
    "firstName": {
     "created": "2020-12-11T15:53:54Z",
     "proofPurpose": "assertionMethod",
     "verificationMethod": "did:work:YUab9X6vawnYVfGPuNRVdk#key-1",
     "nonce": "43f12909-4a67-40bd-bfc3-6495ea19b2e7",
     "signatureValue": "5XntFtHoTQgUUbtyuFV7QkZkts8fBTfrUP9P5KdrTF4EWxuAsFAFggwcGrkoR5tYqoFjNfLqv6Ccsu8xtyU26G8d",
     "type": "JcsEd25519Signature2020"
    },
    "id": {
     "created": "2020-12-11T15:53:54Z",
     "proofPurpose": "assertionMethod",
     "verificationMethod": "did:work:YUab9X6vawnYVfGPuNRVdk#key-1",
     "nonce": "96b92197-2726-4dd5-a153-ffb1a5b20598",
     "signatureValue": "5bBeQ33cDnBpWkVQAYfyzrcvTBnzoSp8sHriZMbHxxE2KmETVDneffifqXoEdbBSYcvhkMFqiUSVnZiXpccyaFnM",
     "type": "JcsEd25519Signature2020"
    },
    "lastName": {
     "created": "2020-12-11T15:53:54Z",
     "proofPurpose": "assertionMethod",
     "verificationMethod": "did:work:YUab9X6vawnYVfGPuNRVdk#key-1",
     "nonce": "2a3b68bb-6c33-4335-9c29-4dd7c6260ba8",
     "signatureValue": "2sqWuhJD73vkw2nWvZf5odSxPN8Jn3vc4NBjFdwK8zvq6kWHB9CgvWuw4VYtyktWVFA8dTpkkMoeTLfN4neCMV7H",
     "type": "JcsEd25519Signature2020"
    }
   },
   "proof": {
    "created": "2020-12-11T15:53:54Z",
    "proofPurpose": "assertionMethod",
    "verificationMethod": "did:work:YUab9X6vawnYVfGPuNRVdk#key-1",
    "nonce": "a25544b7-59c5-44e5-b7dd-ffd569a8d6f2",
    "signatureValue": "49vN2r6scDekMUm2wNwRwq43P1fvWgweLpquh7j7z4NSvx8gCUNBAScFjTutVg51WR3nrYstBwTnE8gtEzXHCJ2q",
    "type": "JcsEd25519Signature2020"
   }
  }
 ],
 "proof": {
  "created": "2020-12-11T15:53:54Z",
  "proofPurpose": "assertionMethod",
  "verificationMethod": "did:work:U5mgAxLaVuLkkr4LPNtDrN#key-1",
  "nonce": "1e052617-42cf-4a86-b561-99d2aca76659",
  "signatureValue": "E7Lm6L4UKBSsRFuFoKdozPeXuuxZBMEr3Js3mVemoqyN5snHjMksoTwNdwjWKjzm6ZJ8TvJ16KRBqq7V4MrsfxR",
  "type": "JcsEd25519Signature2020"
 }
}

The expected result is that we should not have an output if the pattern doesn’t match.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant