Skip to content

Commit

Permalink
group "on generating input details"
Browse files Browse the repository at this point in the history
  • Loading branch information
lukachi committed Mar 18, 2024
1 parent aac1b49 commit 52d96c0
Show file tree
Hide file tree
Showing 2 changed files with 389 additions and 324 deletions.
17 changes: 14 additions & 3 deletions packages/zkp-iden3/src/helpers/proof-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
} from '@iden3/js-jsonld-merklization';
import type { NodeAux, ProofJSON } from '@iden3/js-merkletree';
import { Hash, Proof, ZERO_HASH } from '@iden3/js-merkletree';
import { CircuitId } from '@rarimo/rarime-connector';
import type { ProofQuery } from '@rarimo/rarime-connector';
import get from 'lodash/get';

Expand Down Expand Up @@ -167,7 +168,10 @@ const merklize = async (credential: W3CCredential): Promise<Merklizer> => {
// helpers used in other files
// ==========================================================================

export const checkVCAndGetClaims = async (credential: W3CCredential) => {
export const checkVCAndGetCoreClaim = async (
credential: W3CCredential,
circuitId: CircuitId,
) => {
const revStatus = await getRevocationStatus(credential.credentialStatus.id);

if (revStatus.mtp.existence) {
Expand Down Expand Up @@ -216,10 +220,17 @@ export const checkVCAndGetClaims = async (credential: W3CCredential) => {
throw new TypeError('core claim is not set in proofs');
}

const coreClaim = {
[CircuitId.AtomicQuerySigV2OnChain]: sigProofCoreClaim,
[CircuitId.AtomicQuerySigV2]: sigProofCoreClaim,

[CircuitId.AtomicQueryMTPV2]: mtpProofCoreClaim,
[CircuitId.AtomicQueryMTPV2OnChain]: mtpProofCoreClaim,
}[circuitId];

return {
revStatus,
mtpProofCoreClaim,
sigProofCoreClaim,
coreClaim,
};
};

Expand Down
Loading

0 comments on commit 52d96c0

Please sign in to comment.