Skip to content

Commit

Permalink
Use supportedEcdsaKeyTypes to get key type and use latest
Browse files Browse the repository at this point in the history
`data-integrity-test-suite-assertion` package.
  • Loading branch information
JSAssassin committed Nov 17, 2023
1 parent fd40c06 commit af2ee12
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 18 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"@digitalbazaar/mocha-w3c-interop-reporter": "^1.5.0",
"base58-universal": "^2.0.0",
"chai": "^4.3.7",
"data-integrity-test-suite-assertion": "github:w3c-ccg/data-integrity-test-suite-assertion",
"data-integrity-test-suite-assertion": "github:w3c-ccg/data-integrity-test-suite-assertion#add-isEcdsaTests",
"jsonld-document-loader": "^2.0.0",
"klona": "^2.0.6",
"mocha": "^10.2.0",
Expand Down
23 changes: 8 additions & 15 deletions tests/10-rdfc-create.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,33 +22,26 @@ const should = chai.should();

describe('ecdsa-rdfc-2019 (create)', function() {
checkDataIntegrityProofFormat({
implemented: match
implemented: match,
isEcdsaTests: true
});
describe('ecdsa-rdfc-2019 (issuer)', function() {
this.matrix = true;
this.report = true;
const names = [...match.keys()];
this.implemented = [];
for(const name of names) {
const {endpoints} = match.get(name);
if(endpoints.length > 1) {
for(const endpoint of endpoints) {
const {tags} = endpoint.settings;
const keyType = getKeyType(tags);
this.implemented.push(`${name}: ${keyType}`);
}
} else {
const {tags} = endpoints[0].settings;
const keyType = getKeyType(tags);
for(const [name, {endpoints}] of match) {
for(const endpoint of endpoints) {
const {supportedEcdsaKeyTypes} = endpoint.settings;
const keyType = getKeyType(supportedEcdsaKeyTypes);
this.implemented.push(`${name}: ${keyType}`);
}
}
this.rowLabel = 'Test Name';
this.columnLabel = 'Implementation';
for(const [name, {endpoints, implementation}] of match) {
for(const endpoint of endpoints) {
const tags = endpoint.settings.tags;
const keyType = getKeyType(tags);
const {supportedEcdsaKeyTypes} = endpoint.settings;
const keyType = getKeyType(supportedEcdsaKeyTypes);
describe(`${name}: ${keyType}`, function() {
const issuer = endpoint;
const verifier = implementation.verifiers.find(
Expand Down
4 changes: 2 additions & 2 deletions tests/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ export const multibaseMultikeyHeaderP256 =
export const multibaseMultikeyHeaderP384 =
SUPPORTED_BASE58_ECDSA_MULTIKEY_HEADERS.get('P-384');

export function getKeyType(tags) {
export function getKeyType(supportedEcdsaKeyTypes) {
const supportedKeyTypes = ['P-256', 'P-384'];
for(const keyType of supportedKeyTypes) {
if(tags.includes(keyType)) {
if(supportedEcdsaKeyTypes.includes(keyType)) {
return keyType;
}
}
Expand Down

0 comments on commit af2ee12

Please sign in to comment.