Skip to content

Commit

Permalink
Revert "Add support of Auth V2 validator (#281)"
Browse files Browse the repository at this point in the history
This reverts commit 812ce46.
  • Loading branch information
daveroga authored Dec 17, 2024
1 parent 812ce46 commit 016dc28
Show file tree
Hide file tree
Showing 12 changed files with 344 additions and 446 deletions.
2 changes: 1 addition & 1 deletion .mocharc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
],
"spec": "tests/**/*.test.ts",
"require": "ts-node/register",
"timeout": "400000",
"timeout": "300000",
"maxDiffSize": "10000"
}
352 changes: 191 additions & 161 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@0xpolygonid/js-sdk",
"version": "1.25.1",
"version": "1.25.0",
"description": "SDK to work with Polygon ID",
"main": "dist/node/cjs/index.js",
"module": "dist/node/esm/index.js",
Expand Down
17 changes: 2 additions & 15 deletions src/circuits/auth-v2.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import { Hash, Proof } from '@iden3/js-merkletree';
import { Claim, Id } from '@iden3/js-iden3-core';
import { CircuitError, GISTProof, TreeState } from './models';
import {
BaseConfig,
getNodeAuxValue,
IStateInfoPubSignals,
prepareSiblingsStr,
StatesInfo
} from './common';
import { BaseConfig, getNodeAuxValue, prepareSiblingsStr } from './common';
import { Signature } from '@iden3/js-crypto';
import { byteDecoder, byteEncoder } from '../utils';

Expand Down Expand Up @@ -123,7 +117,7 @@ interface AuthV2CircuitInputs {
* @public
* @class AuthV2PubSignals
*/
export class AuthV2PubSignals implements IStateInfoPubSignals {
export class AuthV2PubSignals {
userID!: Id;
challenge!: bigint;
GISTRoot!: Hash;
Expand All @@ -149,11 +143,4 @@ export class AuthV2PubSignals implements IStateInfoPubSignals {
this.GISTRoot = Hash.fromString(sVals[2]);
return this;
}

getStatesInfo(): StatesInfo {
return {
states: [],
gists: [{ id: this.userID, root: this.GISTRoot }]
};
}
}
13 changes: 3 additions & 10 deletions src/iden3comm/handlers/contract-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
BasicHandlerOptions,
IProtocolMessageHandler
} from './message-handler';

/**
* Interface that allows the processing of the contract request
*
Expand Down Expand Up @@ -68,7 +69,6 @@ export class ContractRequestHandler
implements IContractRequestHandler, IProtocolMessageHandler
{
private readonly _supportedCircuits = [
CircuitId.AuthV2,
CircuitId.AtomicQueryMTPV2OnChain,
CircuitId.AtomicQuerySigV2OnChain,
CircuitId.AtomicQueryV3OnChain
Expand Down Expand Up @@ -125,19 +125,12 @@ export class ContractRequestHandler
throw new Error(`Invalid chain id ${chain_id}`);
}
const verifierDid = message.from ? DID.parse(message.from) : undefined;

const { scope = [] } = message.body;

const zkpResponses = await processZeroKnowledgeProofRequests(
did,
scope,
message?.body?.scope,
verifierDid,
this._proofService,
{
ethSigner,
challenge,
supportedCircuits: this._supportedCircuits
}
{ ethSigner, challenge, supportedCircuits: this._supportedCircuits }
);

const methodId = message.body.transaction_data.method_id.replace('0x', '');
Expand Down
66 changes: 0 additions & 66 deletions src/iden3comm/utils/contract-request.utils.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/iden3comm/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export * from './envelope';
export * from './message';
export * from './did';
export * from './contract-request.utils';
export * from './accept-profile';
17 changes: 0 additions & 17 deletions src/proof/proof-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,6 @@ export interface IProofService {
*/
generateAuthV2Inputs(hash: Uint8Array, did: DID, circuitId: CircuitId): Promise<Uint8Array>;

/**
* generates auth inputs
*
* @param {Uint8Array} hash - challenge that will be signed
* @param {DID} did - identity that will generate a proof
* @returns `Promise<ZKProof>`
*/
generateAuthV2Proof(hash: Uint8Array, did: DID): Promise<ZKProof>;

/**
* state verification function
*
Expand Down Expand Up @@ -497,14 +488,6 @@ export class ProofService implements IProofService {
return authInputs.inputsMarshal();
}

/** {@inheritdoc IProofService.generateAuthV2Proof} */
async generateAuthV2Proof(challenge: Uint8Array, did: DID): Promise<ZKProof> {
const authInputs = await this.generateAuthV2Inputs(challenge, did, CircuitId.AuthV2);

const zkProof = await this._prover.generate(authInputs, CircuitId.AuthV2);
return zkProof;
}

async verifyState(
circuitId: string,
pubSignals: string[],
Expand Down
Loading

0 comments on commit 016dc28

Please sign in to comment.