Skip to content

Commit

Permalink
Enable all pseudonym test vector tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlongley committed Feb 11, 2025
1 parent 8193b56 commit ea8a5d3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 55 deletions.
7 changes: 0 additions & 7 deletions test/fixtures/pseudonym-sha256.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ BLS12381_SHA256.fixtures = [{
domain: h2b('4508e372d4ede742110dbcbc3e0c0d286f6d7388827b98805f7b62ad17678d93')
}
}, {
only: true,
name: 'valid all prover committed messages and signer messages revealed proof',
operation: 'NymProofGenAndProofVerify',
parameters: {
Expand Down Expand Up @@ -215,7 +214,6 @@ BLS12381_SHA256.fixtures = [{
verified: true
}
}, {
only: true,
name: 'valid half prover committed messages and all signer messages revealed proof',
operation: 'NymProofGenAndProofVerify',
parameters: {
Expand Down Expand Up @@ -250,7 +248,6 @@ BLS12381_SHA256.fixtures = [{
verified: true
}
}, {
only: true,
name: 'valid all prover committed messages and half signer messages revealed proof',
operation: 'NymProofGenAndProofVerify',
parameters: {
Expand Down Expand Up @@ -287,7 +284,6 @@ BLS12381_SHA256.fixtures = [{
verified: true
}
}, {
only: true,
name: 'valid half prover committed messages and half signer messages revealed proof',
operation: 'NymProofGenAndProofVerify',
parameters: {
Expand Down Expand Up @@ -328,7 +324,6 @@ BLS12381_SHA256.fixtures = [{
verified: true
}
}, {
only: true,
name: 'valid no prover committed messages and half signer messages revealed proof',
operation: 'NymProofGenAndProofVerify',
parameters: {
Expand Down Expand Up @@ -365,7 +360,6 @@ BLS12381_SHA256.fixtures = [{
verified: true
}
}, {
only: true,
name: 'valid half prover committed messages and no signer messages revealed proof',
operation: 'NymProofGenAndProofVerify',
parameters: {
Expand Down Expand Up @@ -400,7 +394,6 @@ BLS12381_SHA256.fixtures = [{
verified: true
}
}, {
only: true,
name: 'valid no prover committed messages and no signer messages revealed proof',
operation: 'NymProofGenAndProofVerify',
parameters: {
Expand Down
49 changes: 1 addition & 48 deletions test/pseudonym.spec.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,15 @@
/*!
* Copyright (c) 2023-2025 Digital Bazaar, Inc. All rights reserved.
*/
import {BlindSign, BlindVerify} from '../lib/bbs/blind/interface.js';
import {
BlindSignWithNym, BlindVerifyWithNym,
CalculatePseudonym, NymCommit,
ProofGenWithPseudonym, ProofVerifyWithPseudonym
NymCommit, ProofGenWithPseudonym, ProofVerifyWithPseudonym
} from '../lib/bbs/pseudonym/interface.js';
import chai from 'chai';
import {CIPHERSUITES_TEST_VECTORS} from './pseudonym-test-vectors.js';
import {mocked_calculate_random_scalars} from '../lib/bbs/util.js';
chai.should();

const OPERATIONS = {
CalculatePseudonym,
CommitAndBlindSignWithNymAndBlindVerify,
PidVerifyAndProofGenWithPseudonym,
ProofVerifyWithPseudonym,
// FIXME: remove `PidSignAndVerify`
PidSignAndVerify,
NymCommit,
NymCommitAndBlindSignWithNymAndBlindVerify,
NymProofGenAndProofVerify
Expand Down Expand Up @@ -49,10 +40,6 @@ describe.only('Pseudonym BBS test vectors', () => {
}
});

// FIXME: remove me
async function PidSignAndVerify() {}
async function CommitAndBlindSignWithNymAndBlindVerify() {}

// runs `NymCommit`, `BlindSign`, then `BlindVerify`
async function NymCommitAndBlindSignWithNymAndBlindVerify({
SK, PK,
Expand Down Expand Up @@ -152,37 +139,3 @@ async function NymProofGenAndProofVerify({
});
return {proof, verified};
}

// runs `BlindVerify` w/`pid` and `ProofGenWithPseudonym`
async function PidVerifyAndProofGenWithPseudonym({
PK,
signature,
verifier_id, pseudonym, pid,
header = new Uint8Array(),
ph = new Uint8Array(),
messages = [], disclosed_indexes,
secret_prover_blind,
signer_blind,
api_id, ciphersuite,
proof_mocked_random_scalars_options
} = {}) {
const verifyResult = await BlindVerify({
PK, signature, header,
messages: [...messages, pid], committed_messages: [],
secret_prover_blind,
signer_blind,
api_id, ciphersuite
});
verifyResult.should.equal(true);
const x = await ProofGenWithPseudonym({
//return ProofGenWithPseudonym({
PK, signature,
pseudonym, verifier_id, pid,
header, ph,
messages, disclosed_indexes,
api_id, ciphersuite,
mocked_random_scalars_options: proof_mocked_random_scalars_options
});
console.log('x', Buffer.from(x).toString('hex'));
return x;
}

0 comments on commit ea8a5d3

Please sign in to comment.