0.0.1 • Published 6 months ago

@gizatech/luminair-web v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

LuminAIR WASM Verifier

Browser-based proof verifier for LuminAIR STARK proofs.

Installation

npm install @gizatech/luminair-web

Usage

import init, { verify, test_wasm_module } from '@gizatech/luminair-web';

async function verifyProof() {
    // Initialize the WASM module
    await init();
    
    // Test the module
    console.log(test_wasm_module());
    
    // Load binary files
    const proofResponse = await fetch('./proof.bin');
    const settingsResponse = await fetch('./settings.bin');
    
    const proofBytes = new Uint8Array(await proofResponse.arrayBuffer());
    const settingsBytes = new Uint8Array(await settingsResponse.arrayBuffer());
    
    // Verify proof using binary data
    const result = verify(proofBytes, settingsBytes);
    
    if (result.success) {
        console.log('Proof verification successful!');
    } else {
        console.error('Verification failed:', result.error_message);
    }
}

verifyProof();

API

verify(proofBytes: Uint8Array, settingsBytes: Uint8Array): VerificationResult

Verifies a LuminAIR proof.

test_wasm_module(): string

Tests if the WASM module is working correctly.

get_version(): string

Returns the version of the verifier.

VerificationResult

interface VerificationResult {
    readonly success: boolean;
    readonly error_message?: string;
}

Binary Format

The verifier expects binary files serialized using the bincode format:

  • Proof files: Contains LuminairProof<Blake2sMerkleHasher>
  • Settings files: Contains CircuitSettings
0.0.1

6 months ago