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
32 changes: 32 additions & 0 deletions dist/core/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,4 +309,36 @@ export interface RecoveryStatus {
expires_at: number;
identity_did: string;
}
export type ProofType = 'age_over_18' | 'age_range' | 'citizenship_verified' | 'jurisdiction_membership';
export interface CredentialData {
age?: number;
jurisdiction?: string;
is_verified_citizen?: boolean;
}
export interface GenerateProofRequest {
identity_id: string;
proof_type: ProofType;
credential_data: CredentialData;
}
export interface ProofData {
proof_data: string;
public_inputs: string[];
proof_type: ProofType;
generated_at: number;
valid_until: number;
}
export interface GenerateProofResponse {
status: string;
proof: ProofData;
valid_until: number;
}
export interface VerifyProofRequest {
proof: ProofData;
}
export interface VerifyProofResponse {
status: string;
valid: boolean;
claim: ProofType;
verified_at: number;
}
//# sourceMappingURL=types.d.ts.map
2 changes: 1 addition & 1 deletion dist/core/types.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 38 additions & 3 deletions dist/core/zhtp-api-methods.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* All API method implementations for various operations
*/
import { ZhtpApiCore } from './zhtp-api-core';
import { Identity, Wallet, NetworkStatus, DaoProposal, DaoStats, Transaction, Delegate, ProposalDetails, TreasuryRecord, DApp, SmartContract, ContractDeploymentResult, ContractExecutionResult, Asset, NodeStatus, GasInfo, Proof, SignupRequest, LoginRequest, BackupData, BackupVerification, BackupStatus, ImportBackupResponse, SeedVerification, SeedPhrases, Guardian, GuardianResponse, RecoverySession, RecoveryStatus, CitizenshipResult } from './types';
import { Identity, Wallet, NetworkStatus, DaoProposal, DaoStats, Transaction, Delegate, ProposalDetails, TreasuryRecord, DApp, SmartContract, ContractDeploymentResult, ContractExecutionResult, Asset, NodeStatus, GasInfo, SignupRequest, LoginRequest, BackupData, BackupVerification, BackupStatus, ImportBackupResponse, SeedVerification, SeedPhrases, Guardian, GuardianResponse, RecoverySession, RecoveryStatus, CitizenshipResult, ProofData, GenerateProofRequest, VerifyProofResponse } from './types';
export declare abstract class ZhtpApiMethods extends ZhtpApiCore {
signIn(did: string, passphrase: string): Promise<Identity>;
createIdentity(data: any): Promise<Identity>;
Expand Down Expand Up @@ -178,8 +178,43 @@ export declare abstract class ZhtpApiMethods extends ZhtpApiCore {
queryContract(contractId: string, functionName?: string, args?: any[]): Promise<Record<string, any>>;
getContractMetadata(contractId: string): Promise<SmartContract>;
upgradeContract(contractId: string, newBytecode: string, metadata?: Record<string, any>): Promise<ContractDeploymentResult>;
generateZkProof(data: Record<string, any>): Promise<Proof>;
verifyZkProof(proof: Proof): Promise<boolean>;
/**
* Generate a zero-knowledge proof for privacy-preserving credential verification
*
* Supported proof types:
* - age_over_18: Prove age >= 18 without revealing exact age
* - age_range: Prove age in range (18-25, 26-40, 41-65, 66+) without revealing exact age
* - citizenship_verified: Prove verified citizen status without revealing identity
* - jurisdiction_membership: Prove membership in jurisdiction without revealing personal data
*
* @param request - Proof generation request with identity_id, proof_type, and credential_data
* @param sessionToken - Session token for authentication
* @returns Generated proof data with 24-hour expiration
*
* @example
* const proof = await client.generateZkProof({
* identity_id: myIdentity.id,
* proof_type: "age_over_18",
* credential_data: { age: 25 }
* }, sessionToken);
*/
generateZkProof(request: GenerateProofRequest, sessionToken: string): Promise<ProofData>;
/**
* Verify a zero-knowledge proof
*
* Validates that a proof is cryptographically sound and has not expired.
* Does NOT reveal the underlying credential values.
*
* @param proof - Proof data to verify
* @returns Verification result with validity status and claim type
*
* @example
* const verification = await client.verifyZkProof(proof);
* if (verification.valid) {
* console.log(`Verified claim: ${verification.claim}`);
* }
*/
verifyZkProof(proof: ProofData): Promise<VerifyProofResponse>;
testConnection(): Promise<boolean>;
getProtocolInfo(): Promise<{
success: boolean;
Expand Down
Loading