From d08135cfe2f903641b44588566e41fa6dffc2dbc Mon Sep 17 00:00:00 2001 From: Marc Velmer Date: Fri, 19 Jan 2024 12:48:31 +0100 Subject: [PATCH] Fixed export `CspProofType` --- src/client.ts | 3 ++- src/core/vote.ts | 7 ------- src/services/census.ts | 2 +- src/services/csp.ts | 9 ++++++++- src/types/vote/csp.ts | 2 +- test/integration/csp.test.ts | 3 +-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/client.ts b/src/client.ts index 02ce76c9..d181a98e 100644 --- a/src/client.ts +++ b/src/client.ts @@ -5,7 +5,7 @@ import { Buffer } from 'buffer'; import invariant from 'tiny-invariant'; import { AccountCore } from './core/account'; import { ElectionCore } from './core/election'; -import { CspProofType, VoteCore } from './core/vote'; +import { VoteCore } from './core/vote'; import { Account, AllElectionStatus, @@ -39,6 +39,7 @@ import { ChainCircuits, ChainService, CspCensusProof, + CspProofType, CspService, ElectionCreationSteps, ElectionCreationStepValue, diff --git a/src/core/vote.ts b/src/core/vote.ts index 28820fe4..53436a73 100644 --- a/src/core/vote.ts +++ b/src/core/vote.ts @@ -31,13 +31,6 @@ export type VotePackage = { votes: VoteValues; }; -export enum CspProofType { - ECDSA = ProofCA_Type.ECDSA, - ECDSA_PIDSALTED = ProofCA_Type.ECDSA_PIDSALTED, - ECDSA_BLIND = ProofCA_Type.ECDSA_BLIND, - ECDSA_BLIND_PIDSALTED = ProofCA_Type.ECDSA_BLIND_PIDSALTED, -} - export abstract class VoteCore extends TransactionCore { /** * Cannot be constructed. diff --git a/src/services/census.ts b/src/services/census.ts index 55357927..00f3d3ed 100644 --- a/src/services/census.ts +++ b/src/services/census.ts @@ -3,7 +3,7 @@ import { CensusType, ICensusParticipant, PlainCensus, WeightedCensus } from '../ import { CensusAPI, ICensusImportResponse, ICensusPublishResponse, WalletAPI } from '../api'; import { Wallet } from '@ethersproject/wallet'; import invariant from 'tiny-invariant'; -import { CspProofType } from '../core/vote'; +import { CspProofType } from './csp'; interface CensusServiceProperties { auth: CensusAuth; diff --git a/src/services/csp.ts b/src/services/csp.ts index 0a0e9e01..5585b576 100644 --- a/src/services/csp.ts +++ b/src/services/csp.ts @@ -3,7 +3,7 @@ import invariant from 'tiny-invariant'; import { CensusType, CspVote, Election, Vote } from '../types'; import { CspAPI, ICspInfoResponse } from '../api/csp'; import { CensusBlind, getBlindedPayload } from '../util/blind-signing'; -import { CspProofType } from '../core/vote'; +import { ProofCA_Type } from '@vocdoni/proto/vochain'; interface CspServiceProperties { info: ICspInfoResponse; @@ -11,6 +11,13 @@ interface CspServiceProperties { type CspServiceParameters = ServiceProperties & CspServiceProperties; +export enum CspProofType { + ECDSA = ProofCA_Type.ECDSA, + ECDSA_PIDSALTED = ProofCA_Type.ECDSA_PIDSALTED, + ECDSA_BLIND = ProofCA_Type.ECDSA_BLIND, + ECDSA_BLIND_PIDSALTED = ProofCA_Type.ECDSA_BLIND_PIDSALTED, +} + export class CspService extends Service implements CspServiceProperties { public info: ICspInfoResponse; diff --git a/src/types/vote/csp.ts b/src/types/vote/csp.ts index 7f0923be..641000e7 100644 --- a/src/types/vote/csp.ts +++ b/src/types/vote/csp.ts @@ -1,5 +1,5 @@ import { Vote } from './vote'; -import { CspProofType } from '../../core/vote'; +import { CspProofType } from '../../services'; export class CspVote extends Vote { private _signature: string; diff --git a/test/integration/csp.test.ts b/test/integration/csp.test.ts index b3be6a92..79d1bdd6 100644 --- a/test/integration/csp.test.ts +++ b/test/integration/csp.test.ts @@ -1,12 +1,11 @@ import { ICspFinalStepResponse, ICspIntermediateStepResponse } from '../../src/api/csp'; import { Wallet } from '@ethersproject/wallet'; -import { Election, VocdoniSDKClient, Vote } from '../../src'; +import { CspProofType, Election, VocdoniSDKClient, Vote } from '../../src'; import { CspCensus } from '../../src'; // @ts-ignore import { clientParams, setFaucetURL } from './util/client.params'; // @ts-ignore import { waitForElectionReady } from './util/client.utils'; -import { CspProofType } from '../../src/core/vote'; const CSP_URL = process.env.BLINDCSP_URL ?? 'https://csp-dev-simplemath.vocdoni.net/v1'; const CSP_PUBKEY = process.env.BLINDCSP_PUBKEY ?? '025de8cb8de1005aa939c1403e37e1fa165ebc758da49cb37215c6237d01591104';