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 static test vectors #33

Merged
merged 53 commits into from
Feb 16, 2024
Merged

Add static test vectors #33

merged 53 commits into from
Feb 16, 2024

Conversation

aljones15
Copy link
Collaborator

@aljones15 aljones15 commented Jan 30, 2024

Adds configurable static test vectors to project. This does not use the vectors from the ecdsa spec yet, but can be configured to use them in the future.

Partially Addresses this issue: #29

Features:

  • A new credentials section in runner.json that allows configuring static test vectors.
  • A new script that clones the vc-di-ecdsa repo and TestVectors into the project.
  • A new dir mocks that contains static test vectors and respective pointers.
  • A new config property issuerName for configuring the issuer used to create test data.
  • A new config property holderName for configuring the holder used to create sd test data.

@aljones15 aljones15 self-assigned this Jan 30, 2024
@aljones15 aljones15 force-pushed the add-static-test-vectors branch 2 times, most recently from e6a55b2 to d6d3f9c Compare February 7, 2024 16:03
Copy link
Member

@TallTed TallTed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tiny

tests/50-sd-verify.js Outdated Show resolved Hide resolved
aljones15 and others added 26 commits February 13, 2024 15:53
Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com>
@aljones15 aljones15 marked this pull request as ready for review February 13, 2024 18:33
Copy link
Member

@TallTed TallTed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small, human-facing

CHANGELOG.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
aljones15 and others added 2 commits February 13, 2024 19:44
Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com>
Co-authored-by: Ted Thibodeau Jr <tthibodeau@openlinksw.com>
Copy link
Member

@BigBlueHat BigBlueHat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly just need clarity around some things.

@@ -23,3 +23,4 @@ reports/**
credentials/*.json
.vscode
.localImplementationsConfig.cjs
tests/input/**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's in this directory? Is it populated by someone/something?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is where the static test vectors from vc-di-ecdsa are being stored. This follows the existing convention of storing test vectors in /tests/input such as in the VC 2.0 Data Model tests. We're not using anything in that DIR yet, but we do plan on using those vectors in the future.

README.md Outdated
the issuer name using an environment variable or setting `issuerName` in `./config/runner.json`.

For the `ecdsa-rdfc-2019` suite use `RDFC_ISSUER_NAME`.
For the `ecdsa-sd-2023` suite use `SD_ISSUER_NAME`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So...set RDFC_ISSUER_NAME to some string value?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be improved here: c97f3e4

README.md Outdated
To generate test data used in the test suite, testers are required to specify
the issuer name using the environment variable `ISSUER_NAME`.
the issuer name using an environment variable or setting `issuerName` in `./config/runner.json`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is issuerName in config/runner.json, but the other variables are environment variables?

Also, this says you can do that either way, but it removes what environment variable name to use. Should that be SD_ISSUER_NAME? And if so, why the name change? And is issuerName in config/runner.json the same thing?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hopefully improved the explanation here: c97f3e4

README.md Outdated
If `$HOLDER_NAME` is not specified, `Digital Bazaar` will be used.
In addition, the environment variable `SD_HOLDER_NAME` or the setting `holderName` in `./config/runner.json`
can be used to specify the VC holder name for generating disclosed test credentials for ECDSA-SD tests.
If `$SD_HOLDER_NAME` or `holderName` is not specified, `Digital Bazaar` will be used.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this just for reporting purposes? Or is this a lookup of some kind? If it's a lookup (from the implementations list?), we should spell that out here. If it's just a string for reporting purposes, we should set it to something generic to avoid confusion.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it needs to match an implementation name. The implementation used it not noted in the report unless it fails to create the test data in some suites. Anyways, addressed here: c97f3e4

README.md Outdated
### Changing the Test Tag
These test suites use tags to identify which implementation's endpoints are used in tests.
### Configuring the Tests
The suites call on a common config file stored at `./config/runner.json`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This particular sentence should likely be moved up to the top of "Usage"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved to the top and expanded here: a356456

README.md Outdated
"suites": {
"ecdsa-rdfc-2019": {
"tags": ["ecdsa-rdfc-2019"],
"issuerName": "Digital Bazaar",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file increasingly feels confused in purpose. If it's a committed file in git history, we don't want local test running folks to ever edit it--which essentially causes a fork.

So, any "runtime" config should be kept elsewhere.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So there are now vector.json and runner.json files here: a6ebbef

// select less than full subarrays
const pointers2 = credentialHasArrays.selectivePointers.slice(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not real keen on the incrementing variable name. Can we use something clearer?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as discussed this test data is has been historically a little weird, anyways improved the pointer names here: 67418b3 in the vc-generator PR these test vectors should be created programmatically outside of the before statement.

signedCredential: signedAchievementCredential,
vcHolder
});
disclosedCredentialsWithLessThanFullSubArray.push(
revealedAchievementCredential2);

// select w/o first array element
// select w/o first 7 array element
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove the first 7 elements? No need to explain it in a reply here, but explaining it in a comment in the code would help folks who work with you on this or who use it as reference when testing their implementations.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is hopefully addressed somewhat here: 67418b3

as the original 2 pieces of test data appear to have been identical, this change at the least seems to improve the diversity of test data.

tests/helpers.js Outdated
Comment on lines 58 to 60
export const createMultipleVcs = async ({}) => {

};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should come out until it's in use.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent catch, was going to move test data generation outside of the before statements and into helpers to clean up the suites, but to much going on in this PR. Removed createMultipleVc here: da1f798

@@ -1,5 +1,73 @@
/*!
* Copyright 2023 Digital Bazaar, Inc. All Rights Reserved
* Copyright 2023-2024 Digital Bazaar, Inc. All Rights Reserved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can also drop the "All Rights Reserved" text, fwiw. It's ancient...and means things are under copyright. Something I missed removing earlier.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

appended this as an additional task to this issue: #27

Copy link
Member

@BigBlueHat BigBlueHat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small thing that can wait, so please plow ahead.

CHANGELOG.md Outdated Show resolved Hide resolved
Copyright 2023 Digital Bazaar, Inc.

SPDX-License-Identifier: BSD-3-Clause
-->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Co-authored-by: BigBlueHat <byoung@digitalbazaar.com>
@aljones15 aljones15 merged commit e20df31 into main Feb 16, 2024
2 checks passed
@aljones15 aljones15 deleted the add-static-test-vectors branch February 16, 2024 14:17
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.

3 participants