Skip to content

Commit a279836

Browse files
committed
prettier
1 parent ebd40c6 commit a279836

File tree

6 files changed

+49
-33
lines changed

6 files changed

+49
-33
lines changed

src/iden3comm/handlers/contract-request.ts

+6-10
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
import { CircuitId } from '../../circuits/models';
22
import { IProofService } from '../../proof/proof-service';
3-
import {
4-
defaultAcceptProfile,
5-
PROTOCOL_MESSAGE_TYPE,
6-
ProtocolVersion
7-
} from '../constants';
3+
import { defaultAcceptProfile, PROTOCOL_MESSAGE_TYPE, ProtocolVersion } from '../constants';
84
import { AcceptProfile, BasicMessage, IPackageManager, ZeroKnowledgeProofResponse } from '../types';
95
import { ContractInvokeRequest, ContractInvokeResponse } from '../types/protocol/contract-request';
106
import { DID, ChainIds, getUnixTimestamp } from '@iden3/js-iden3-core';
@@ -195,11 +191,11 @@ export class ContractRequestHandler
195191
);
196192

197193
const identifier = DID.parse(message.to);
198-
const authResponse = await processProofAuth(
199-
identifier,
200-
this._proofService,
201-
{ supportedCircuits: this._supportedCircuits, acceptProfile, challenge: BigInt(10) }
202-
);
194+
const authResponse = await processProofAuth(identifier, this._proofService, {
195+
supportedCircuits: this._supportedCircuits,
196+
acceptProfile,
197+
challenge: BigInt(10)
198+
});
203199

204200
return this._verifierMultiQuery.submitResponse(
205201
ethSigner,

src/iden3comm/types/protocol/contract-request.ts

-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ export type ContractInvokeTransactionData = {
4444
network?: string;
4545
};
4646

47-
4847
/** AuthProofResponse represents structure of zkp response */
4948
export type AuthProofResponse = {
5049
authType: string;

src/proof/proof-service.ts

+8-7
Original file line numberDiff line numberDiff line change
@@ -403,13 +403,14 @@ export class ProofService implements IProofService {
403403
let zkProof;
404404

405405
switch (proofAuth.circuitId) {
406-
case CircuitId.AuthV2: {
407-
const challenge = opts.challenge
408-
? BytesHelper.intToBytes(opts.challenge)
409-
: new Uint8Array(32);
410-
zkProof = await this.generateAuthV2Proof(challenge, identifier);
411-
}
412-
break;
406+
case CircuitId.AuthV2:
407+
{
408+
const challenge = opts.challenge
409+
? BytesHelper.intToBytes(opts.challenge)
410+
: new Uint8Array(32);
411+
zkProof = await this.generateAuthV2Proof(challenge, identifier);
412+
}
413+
break;
413414
default:
414415
throw new Error(`CircuitId ${proofAuth.circuitId} is not supported`);
415416
}

src/storage/blockchain/onchain-verifier-multi-query.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,7 @@ export class OnChainVerifierMultiQuery implements IOnChainVerifierMultiQuery {
216216
}
217217

218218
const crossChainProofs = this.packCrossChainProofs(gistUpdateArr, stateUpdateArr);
219-
return [
220-
payloadAuthResponse,
221-
payloadResponses,
222-
crossChainProofs
223-
];
219+
return [payloadAuthResponse, payloadResponses, crossChainProofs];
224220
}
225221

226222
public async prepareTxArgsSubmit(

src/storage/interfaces/onchain-verifier-multi-query.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
AuthProofResponse,
44
ContractInvokeTransactionData,
55
JsonDocumentObjectValue,
6-
ZeroKnowledgeProofResponse,
6+
ZeroKnowledgeProofResponse
77
} from '../../iden3comm';
88

99
/**
@@ -26,7 +26,7 @@ export interface IOnChainVerifierMultiQuery {
2626
ethSigner: Signer,
2727
txData: ContractInvokeTransactionData,
2828
authResponse: AuthProofResponse,
29-
responses: ZeroKnowledgeProofResponse[],
29+
responses: ZeroKnowledgeProofResponse[]
3030
): Promise<Map<string, ZeroKnowledgeProofResponse[]>>;
3131

3232
/**
@@ -38,6 +38,6 @@ export interface IOnChainVerifierMultiQuery {
3838
prepareTxArgsSubmit(
3939
txData: ContractInvokeTransactionData,
4040
authResponse: AuthProofResponse,
41-
responses: ZeroKnowledgeProofResponse[],
41+
responses: ZeroKnowledgeProofResponse[]
4242
): Promise<JsonDocumentObjectValue[]>;
4343
}

tests/handlers/contract-request.test.ts

+31-7
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ describe.only('contract-request', () => {
154154
}
155155
};
156156

157-
158157
const mockVerifierMultiQuery: IOnChainVerifierMultiQuery = {
159158
submitResponse: async (
160159
ethSigner: Signer,
@@ -169,7 +168,7 @@ describe.only('contract-request', () => {
169168

170169
prepareTxArgsSubmit: async () => {
171170
return [];
172-
},
171+
}
173172
};
174173

175174
const getPackageMgr = async (
@@ -247,7 +246,12 @@ describe.only('contract-request', () => {
247246
proofService.generateAuthV2Inputs.bind(proofService),
248247
proofService.verifyState.bind(proofService)
249248
);
250-
contractRequestHandler = new ContractRequestHandler(packageMgr, proofService, mockZKPVerifier, mockVerifierMultiQuery);
249+
contractRequestHandler = new ContractRequestHandler(
250+
packageMgr,
251+
proofService,
252+
mockZKPVerifier,
253+
mockVerifierMultiQuery
254+
);
251255
});
252256

253257
it('contract request flow', async () => {
@@ -655,7 +659,12 @@ describe.only('contract-request', () => {
655659

656660
const zkpVerifier = new OnChainZKPVerifier([conf]);
657661
const verifierMultiQuery = new OnChainVerifierMultiQuery([conf]);
658-
contractRequestHandler = new ContractRequestHandler(packageMgr, proofService, zkpVerifier, verifierMultiQuery);
662+
contractRequestHandler = new ContractRequestHandler(
663+
packageMgr,
664+
proofService,
665+
zkpVerifier,
666+
verifierMultiQuery
667+
);
659668

660669
const transactionData: ContractInvokeTransactionData = {
661670
contract_address: contractAddress,
@@ -829,7 +838,12 @@ describe.only('contract-request', () => {
829838

830839
const zkpVerifier = new OnChainZKPVerifier([conf]);
831840
const verifierMultiQuery = new OnChainVerifierMultiQuery([conf]);
832-
contractRequestHandler = new ContractRequestHandler(packageMgr, proofService, zkpVerifier, verifierMultiQuery);
841+
contractRequestHandler = new ContractRequestHandler(
842+
packageMgr,
843+
proofService,
844+
zkpVerifier,
845+
verifierMultiQuery
846+
);
833847

834848
const transactionData: ContractInvokeTransactionData = {
835849
contract_address: erc20Verifier,
@@ -1010,7 +1024,12 @@ describe.only('contract-request', () => {
10101024
const verifierMultiQuery = new OnChainVerifierMultiQuery([zkpVerifierNetworkConfig], {
10111025
didResolverUrl: 'https://resolver-dev.privado.id'
10121026
});
1013-
contractRequestHandler = new ContractRequestHandler(packageMgr, proofService, zkpVerifier, verifierMultiQuery);
1027+
contractRequestHandler = new ContractRequestHandler(
1028+
packageMgr,
1029+
proofService,
1030+
zkpVerifier,
1031+
verifierMultiQuery
1032+
);
10141033

10151034
const transactionData: ContractInvokeTransactionData = {
10161035
contract_address: zkpVerifierNetworkConfig.contractAddress,
@@ -1196,7 +1215,12 @@ describe.only('contract-request', () => {
11961215
const verifierMultiQuery = new OnChainVerifierMultiQuery([amoyStateEthConfig], {
11971216
didResolverUrl: 'https://resolver-dev.privado.id'
11981217
});
1199-
contractRequestHandler = new ContractRequestHandler(packageMgr, proofService, zkpVerifier, verifierMultiQuery);
1218+
contractRequestHandler = new ContractRequestHandler(
1219+
packageMgr,
1220+
proofService,
1221+
zkpVerifier,
1222+
verifierMultiQuery
1223+
);
12001224

12011225
const transactionData: ContractInvokeTransactionData = {
12021226
contract_address: verifierAddress,

0 commit comments

Comments
 (0)