Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
"prepare": "husky"
},
"dependencies": {
"@aztec/bb.js": "3.0.0-nightly.20251104",
"@creit.tech/stellar-wallets-kit": "^1.5.0",
"@noir-lang/noir_js": "1.0.0-beta.19",
"@radix-ui/react-dialog": "^1.1.15",
"@radix-ui/react-label": "^2.1.8",
"@radix-ui/react-separator": "^1.1.8",
Expand Down
29 changes: 0 additions & 29 deletions public/zk/noir_not_expired.json

This file was deleted.

18 changes: 0 additions & 18 deletions public/zk/noir_valid_status.json

This file was deleted.

24 changes: 0 additions & 24 deletions public/zk/noir_workshop.json

This file was deleted.

37 changes: 0 additions & 37 deletions src/@types/credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,45 +36,8 @@ export type CredentialVerifyProps = {
status?: string | null;
since?: string | null;
revealed?: Record<string, unknown> | null;
zkValid?: boolean | null;
zkStatement?: ZkStatement | null;
hasVerified?: boolean;
};

export type ZkTypeEqStatement = {
kind: 'typeEq';
selectedKeys: string[];
isValid: boolean;
typeHash: string;
expectedHash: string;
valid: string;
};

export type ZkIsAdultStatement = {
kind: 'isAdult';
selectedKeys: string[];
isAdult: boolean;
};

export type ZkNotExpiredStatement = {
kind: 'notExpired';
selectedKeys: string[];
notExpired: boolean;
};

export type ZkIsValidStatement = {
kind: 'isValid';
selectedKeys: string[];
isValid: boolean;
};

export type ZkStatement =
| 'none'
| ZkTypeEqStatement
| ZkIsAdultStatement
| ZkNotExpiredStatement
| ZkIsValidStatement;

export type CredentialCardProps = {
name: string;
category: string;
Expand Down
6 changes: 6 additions & 0 deletions src/@types/guided-tour.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export interface TourStep {
icon: React.ReactNode;
title: string;
description: string;
content?: React.ReactNode;
}
62 changes: 1 addition & 61 deletions src/components/modules/credentials/hooks/useCredentialVerify.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
'use client';

import { useEffect, useState } from 'react';
import type { ZkStatement } from '@/@types/credentials';
import { useNetwork } from '@/providers/network.provider';
import { useWalletContext } from '@/providers/wallet.provider';
import { verifyZkProof } from '@/lib/zk';
import { useActaApiKey } from '@/components/modules/vault/hooks/use-acta-api-key';
import { actaFetchJson } from '@/lib/actaApi';

Expand All @@ -20,14 +18,10 @@ export function useCredentialVerify(vcId: string) {
const { apiKey } = useActaApiKey();
const [verify, setVerify] = useState<VerifyResult | null>(null);
const [revealed, setRevealed] = useState<Record<string, unknown> | null>(null);
const [zkValid, setZkValid] = useState<boolean | null>(null);
const [zkStatement, setZkStatement] = useState<ZkStatement | null>(null);
const [hasVerified, setHasVerified] = useState(false);
const [reverifyLoading, setReverifyLoading] = useState(false);
const [shareParam, setShareParam] = useState<unknown>(null);
const [hasZkProofInShare, setHasZkProofInShare] = useState(false);
const [shareType, setShareType] = useState<string | null>(null);
const [shareLoading, setShareLoading] = useState(true);

useEffect(() => {
const read = async () => {
if (typeof window === 'undefined') {
Expand Down Expand Up @@ -92,9 +86,6 @@ export function useCredentialVerify(vcId: string) {
if (shareParam && typeof shareParam === 'object') {
const sp = shareParam as {
revealedFields?: Record<string, unknown>;
statement?: unknown;
proof?: string;
ok?: boolean;
type?: unknown;
};
setRevealed(sp.revealedFields || null);
Expand All @@ -106,24 +97,8 @@ export function useCredentialVerify(vcId: string) {
} else {
setShareType(null);
}
const st = sp.statement;
const hasSt =
typeof st === 'object' &&
st &&
'kind' in st &&
(st as { kind?: string }).kind !== 'none';
const hasProof = typeof sp.proof === 'string' && sp.proof.length > 0;
const hasZk = Boolean(hasSt && hasProof);
setHasZkProofInShare(hasZk);
if (hasZk) {
setZkStatement(st as ZkStatement);
} else {
setZkStatement(null);
}
// No auto-verification: status must be shown only after user clicks
}

// API-based verification requires API key + owner wallet address.
if (vcId && walletAddress && apiKey.trim()) {
try {
const v = await actaFetchJson<{ status: string; since?: string }>({
Expand All @@ -148,44 +123,9 @@ export function useCredentialVerify(vcId: string) {
run();
}, [vcId, network, walletAddress, shareParam, apiKey]);

const reverify = async () => {
if (!shareParam || typeof shareParam !== 'object') return;
const sp = shareParam as {
statement?: {
kind?: string;
typeHash?: string;
expectedHash?: string;
valid?: string;
};
publicSignals?: string[];
proof?: string;
ok?: boolean;
};
try {
setReverifyLoading(true);
if (typeof sp.ok === 'boolean') {
setZkValid(sp.ok === true);
setHasVerified(true);
return;
}
const ok = await verifyZkProof(sp as unknown as typeof sp);
setZkValid(ok);
setHasVerified(true);
} catch {
} finally {
setReverifyLoading(false);
}
};

return {
verify,
revealed,
zkValid,
zkStatement,
reverify,
reverifyLoading,
hasVerified,
hasZkProofInShare,
shareType,
shareLoading,
};
Expand Down
Loading