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

Add ecdsa-sd-2023 proofValue payload missing elements negative test (E -> D) #104

Open
wants to merge 5 commits into
base: add-3-sd-proofValue-tests
Choose a base branch
from

Conversation

aljones15
Copy link
Contributor

@aljones15 aljones15 commented Nov 18, 2024

Adds a single test for the statement: "If the result is not an array of the following five elements — a byte array of length 64; a byte array of length 36; an array of byte arrays, each of length 64; a map of integers to byte arrays, each of length 32; and an array of integers — an error MUST be raised and SHOULD convey an error type of PROOF_VERIFICATION_ERROR."

Produces an invalid proofValue with only 2 elements in the payload:

  invalidProofArray.proof.proofValue = serializeProofValue({
    payload: [params.baseSignature, params.publicKey]
  }); 
{
  "@context": [
    "https://www.w3.org/ns/credentials/v2",
    {
      "@protected": true,
      "DriverLicenseCredential": "urn:example:DriverLicenseCredential",
      "DriverLicense": {
        "@id": "urn:example:DriverLicense",
        "@context": {
          "@protected": true,
          "id": "@id",
          "type": "@type",
          "documentIdentifier": "urn:example:documentIdentifier",
          "dateOfBirth": "urn:example:dateOfBirth",
          "expirationDate": "urn:example:expiration",
          "issuingAuthority": "urn:example:issuingAuthority"
        }
      },
      "driverLicense": {
        "@id": "urn:example:driverLicense",
        "@type": "@id"
      }
    }
  ],
  "id": "urn:uuid:36245ee9-9074-4b05-a777-febff2e69757",
  "type": [
    "VerifiableCredential",
    "DriverLicenseCredential"
  ],
  "issuer": "did:key:zDnaepBuvsQ8cpsWrVKw8fbpGpvPeNSjVPTWoq6cRqaYzBKVP",
  "credentialSubject": {
    "id": "urn:uuid:1a0e4ef5-091f-4060-842e-18e519ab9440",
    "driverLicense": {
      "type": "DriverLicense",
      "documentIdentifier": "T21387yc328c7y32h23f23",
      "dateOfBirth": "01-01-1990",
      "expirationDate": "01-01-2030",
      "issuingAuthority": "VA"
    }
  },
  "proof": {
    "type": "DataIntegrityProof",
    "created": "2024-11-18T14:52:03Z",
    "verificationMethod": "did:key:zDnaepBuvsQ8cpsWrVKw8fbpGpvPeNSjVPTWoq6cRqaYzBKVP#zDnaepBuvsQ8cpsWrVKw8fbpGpvPeNSjVPTWoq6cRqaYzBKVP",
    "cryptosuite": "ecdsa-sd-2023",
    "proofPurpose": "assertionMethod",
    "proofValue": "u2V0BglhAAf1-kHEjD-dONViF43NlXCJHcL4gMc-oiiYgWWG8sFAIpMzYLKzKgsCuGdGAAfsM5KN9L1p05fEjx_v7dVUnQFgjgCQDrcrw3ORQLG2yA2W6Kd4DxhrT5zCivAGyIgja4OxI5N4"
  }
}

Additionally:

  1. Refactors stubDerive into a class DeriveStub which allows serializeDisclosureProofValue to produce both valid and invalid proofValues.
  2. Copies parareDisclosureProofValue from ecdsa-sd-2023 into stubs and uses it to produce an invalid fixture.

@aljones15 aljones15 self-assigned this Nov 18, 2024
@aljones15 aljones15 marked this pull request as ready for review November 18, 2024 15:01
@aljones15 aljones15 changed the title Add 1 sd missing cbor elements Add ecdsa-sd-2023 proofValue payload missing elements negative test Nov 18, 2024
@aljones15 aljones15 changed the title Add ecdsa-sd-2023 proofValue payload missing elements negative test Add ecdsa-sd-2023 proofValue payload missing elements negative test (E -> D) Nov 18, 2024
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 this pull request may close these issues.

1 participant