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

Update tag to be configurable via env variable. #49

Merged
merged 3 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions tests/10-create.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*!
* Copyright (c) 2022 Digital Bazaar, Inc. All rights reserved.
* Copyright (c) 2022-2024 Digital Bazaar, Inc.
* SPDX-License-Identifier: BSD-3-Clause
*/
import {bs58Decode, getPublicKeyBytes} from './helpers.js';
import chai from 'chai';
Expand All @@ -9,9 +10,10 @@ import {
import {endpoints} from 'vc-test-suite-implementations';
import {generateTestData} from './vc-generator/index.js';
import {klona} from 'klona';
import {tag} from './test-config.js';
import {v4 as uuidv4} from 'uuid';

// only use implementations with `Ed25519 2020` issuers.
const tag = 'Ed25519Signature2020';
const {match} = endpoints.filterByTag({tags: [tag], property: 'issuers'});
const should = chai.should();

Expand Down Expand Up @@ -43,7 +45,7 @@ describe('Ed25519Signature2020 (create)', function() {
before(async function() {
const [issuer] = endpoints;
verifier = implementation.verifiers.find(
verifier => verifier.tags.has('Ed25519Signature2020'));
verifier => verifier.tags.has(tag));
const {settings: {id: issuerId, options}} = issuer;
const body = {credential: klona(validVc), options};
body.credential.id = `urn:uuid:${uuidv4()}`;
Expand Down
8 changes: 5 additions & 3 deletions tests/20-verify.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*!
* Copyright (c) 2022 Digital Bazaar, Inc. All rights reserved.
* Copyright (c) 2022-2024 Digital Bazaar, Inc.
* SPDX-License-Identifier: BSD-3-Clause
*/
import {bs58Decode, bs58Encode} from './helpers.js';
import {verificationFail, verificationSuccess} from './assertions.js';
Expand All @@ -9,10 +10,11 @@ import {
import {endpoints} from 'vc-test-suite-implementations';
import {generateTestData} from './vc-generator/index.js';
import {klona} from 'klona';
import {tag} from './test-config.js';

// only use implementations with `Ed25519 2020` verifiers.
const {match} = endpoints.filterByTag({
tags: ['Ed25519Signature2020'],
tags: [tag],
property: 'verifiers'
});

Expand Down Expand Up @@ -43,7 +45,7 @@ describe('Ed25519Signature2020 (verify)', function() {
for(const [name, {implementation}] of match) {
describe(name, function() {
const verifier = implementation.verifiers.find(
verifier => verifier.tags.has('Ed25519Signature2020'));
verifier => verifier.tags.has(tag));
it('MUST verify a valid VC with an Ed25519Signature2020 proof',
async function() {
this.test.cell = {
Expand Down
7 changes: 4 additions & 3 deletions tests/30-interop.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
/*!
* Copyright (c) 2022 Digital Bazaar, Inc. All rights reserved.
* Copyright (c) 2022-2024 Digital Bazaar, Inc.
* SPDX-License-Identifier: BSD-3-Clause
*/
import chai from 'chai';
import {filterByTag} from 'vc-test-suite-implementations';
import {generateTestData} from './vc-generator/index.js';
import {klona} from 'klona';
import {tag} from './test-config.js';
import {v4 as uuidv4} from 'uuid';

const should = chai.should();
const tag = 'Ed25519Signature2020';

// only use implementations with `Ed25519 2020` issuers.
const {
Expand Down Expand Up @@ -36,7 +37,7 @@ describe('Ed25519Signature2020 (interop)', function() {
let issuerError;
before(async function() {
const issuer = issuers.find(issuer =>
issuer.tags.has('Ed25519Signature2020'));
issuer.tags.has(tag));
const {settings: {id: issuerId, options}} = issuer;
const body = {credential: klona(validVc), options};
body.credential.id = `urn:uuid:${uuidv4()}`;
Expand Down
28 changes: 28 additions & 0 deletions tests/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
BSD 3-Clause License

Copyright (c) 2024, W3C, Inc.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3 changes: 2 additions & 1 deletion tests/assertions.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*!
* Copyright (c) 2022 Digital Bazaar, Inc. All rights reserved.
* Copyright (c) 2022-2024 Digital Bazaar, Inc.
* SPDX-License-Identifier: BSD-3-Clause
*/
import chai from 'chai';

Expand Down
3 changes: 2 additions & 1 deletion tests/helpers.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*!
* Copyright (c) 2022 Digital Bazaar, Inc. All rights reserved.
* Copyright (c) 2022-2024 Digital Bazaar, Inc.
* SPDX-License-Identifier: BSD-3-Clause
*/
import * as didKey from '@digitalbazaar/did-method-key';
import {IdDecoder, IdEncoder} from 'bnid';
Expand Down
6 changes: 6 additions & 0 deletions tests/test-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*!
* Copyright (c) 2022-2024 Digital Bazaar, Inc.
* SPDX-License-Identifier: BSD-3-Clause
*/

export const tag = process.env.TAG || 'Ed25519Signature2020';
3 changes: 2 additions & 1 deletion tests/vc-generator/TestEd25519Signature2020.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*!
* Copyright (c) 2022 Digital Bazaar, Inc. All rights reserved.
* Copyright (c) 2022-2024 Digital Bazaar, Inc.
* SPDX-License-Identifier: BSD-3-Clause
*/
import * as base58btc from 'base58-universal';
import {
Expand Down
3 changes: 2 additions & 1 deletion tests/vc-generator/TestLinkedDataSignature.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*!
* Copyright (c) 2022 Digital Bazaar, Inc. All rights reserved.
* Copyright (c) 2022-2024 Digital Bazaar, Inc.
* SPDX-License-Identifier: BSD-3-Clause
*/
import {api} from './util.js';
import {createRequire} from 'node:module';
Expand Down
3 changes: 2 additions & 1 deletion tests/vc-generator/contexts.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*!
* Copyright (c) 2022 Digital Bazaar, Inc. All rights reserved.
* Copyright (c) 2022-2024 Digital Bazaar, Inc.
* SPDX-License-Identifier: BSD-3-Clause
*/
// import {contexts} from '@digitalbazaar/vc';
import credentialsCtx from 'credentials-context';
Expand Down
3 changes: 2 additions & 1 deletion tests/vc-generator/documentLoader.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*!
* Copyright (c) 2022 Digital Bazaar, Inc. All rights reserved.
* Copyright (c) 2022-2024 Digital Bazaar, Inc.
* SPDX-License-Identifier: BSD-3-Clause
*/
import {contextMap} from './contexts.js';
import {JsonLdDocumentLoader} from 'jsonld-document-loader';
Expand Down
3 changes: 2 additions & 1 deletion tests/vc-generator/hashDigest.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*!
* Copyright (c) 2022 Digital Bazaar, Inc. All rights reserved.
* Copyright (c) 2022-2024 Digital Bazaar, Inc.
* SPDX-License-Identifier: BSD-3-Clause
*/
import crypto from 'crypto';

Expand Down
3 changes: 2 additions & 1 deletion tests/vc-generator/helpers.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*!
* Copyright (c) 2022 Digital Bazaar, Inc. All rights reserved.
* Copyright (c) 2022-2024 Digital Bazaar, Inc.
* SPDX-License-Identifier: BSD-3-Clause
*/
import * as didKey from '@digitalbazaar/did-method-key';
import {decodeSecretKeySeed} from 'bnid';
Expand Down
3 changes: 2 additions & 1 deletion tests/vc-generator/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*!
* Copyright (c) 2022 Digital Bazaar, Inc. All rights reserved.
* Copyright (c) 2022-2024 Digital Bazaar, Inc.
* SPDX-License-Identifier: BSD-3-Clause
*/
import * as base58btc from 'base58-universal';
import * as vc from '@digitalbazaar/vc';
Expand Down
3 changes: 2 additions & 1 deletion tests/vc-generator/util.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*!
* Copyright (c) 2022 Digital Bazaar, Inc. All rights reserved.
* Copyright (c) 2022-2024 Digital Bazaar, Inc.
* SPDX-License-Identifier: BSD-3-Clause
*/
export const api = {};

Expand Down