@izi-noir/sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +458 -0
- package/dist/IProvingSystem-D9TnEig0.d.ts +140 -0
- package/dist/IProvingSystem-TKNofoo8.d.cts +140 -0
- package/dist/index.cjs +2793 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1196 -0
- package/dist/index.d.ts +1196 -0
- package/dist/index.js +2730 -0
- package/dist/index.js.map +1 -0
- package/dist/providers/arkworks.cjs +824 -0
- package/dist/providers/arkworks.cjs.map +1 -0
- package/dist/providers/arkworks.d.cts +121 -0
- package/dist/providers/arkworks.d.ts +121 -0
- package/dist/providers/arkworks.js +791 -0
- package/dist/providers/arkworks.js.map +1 -0
- package/dist/providers/barretenberg.cjs +822 -0
- package/dist/providers/barretenberg.cjs.map +1 -0
- package/dist/providers/barretenberg.d.cts +18 -0
- package/dist/providers/barretenberg.d.ts +18 -0
- package/dist/providers/barretenberg.js +790 -0
- package/dist/providers/barretenberg.js.map +1 -0
- package/dist/providers/solana.cjs +262 -0
- package/dist/providers/solana.cjs.map +1 -0
- package/dist/providers/solana.d.cts +223 -0
- package/dist/providers/solana.d.ts +223 -0
- package/dist/providers/solana.js +222 -0
- package/dist/providers/solana.js.map +1 -0
- package/dist/providers/sunspot.cjs +475 -0
- package/dist/providers/sunspot.cjs.map +1 -0
- package/dist/providers/sunspot.d.cts +210 -0
- package/dist/providers/sunspot.d.ts +210 -0
- package/dist/providers/sunspot.js +443 -0
- package/dist/providers/sunspot.js.map +1 -0
- package/dist/types-CaaigonG.d.cts +93 -0
- package/dist/types-CaaigonG.d.ts +93 -0
- package/dist/wasm/nodejs/arkworks_groth16_wasm.js +448 -0
- package/dist/wasm/nodejs/arkworks_groth16_wasm_bg.wasm +0 -0
- package/dist/wasm/web/arkworks_groth16_wasm.js +536 -0
- package/dist/wasm/web/arkworks_groth16_wasm_bg.wasm +0 -0
- package/dist/wasmInit-KV6DTj4J.d.ts +282 -0
- package/dist/wasmInit-iEYiiB8M.d.cts +282 -0
- package/package.json +87 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { CompiledCircuit, InputMap } from '@noir-lang/types';
|
|
2
|
+
import { P as ProofData } from './types-CaaigonG.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Chain types for multi-chain proof formatting
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Supported blockchain targets for proof verification
|
|
9
|
+
*/
|
|
10
|
+
type ChainId = 'solana' | 'ethereum';
|
|
11
|
+
/**
|
|
12
|
+
* Chain enum for IziNoir initialization.
|
|
13
|
+
* Use undefined (don't pass chain) for offchain mode.
|
|
14
|
+
*/
|
|
15
|
+
declare enum Chain {
|
|
16
|
+
/** Solana blockchain - uses Groth16 proofs with gnark format VK */
|
|
17
|
+
Solana = "solana",
|
|
18
|
+
/** Ethereum blockchain - uses Groth16 proofs (future support) */
|
|
19
|
+
Ethereum = "ethereum"
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Metadata about the compiled circuit
|
|
23
|
+
*/
|
|
24
|
+
interface CircuitMetadata {
|
|
25
|
+
/** Number of public inputs in the circuit */
|
|
26
|
+
numPublicInputs: number;
|
|
27
|
+
/** Optional circuit name for identification */
|
|
28
|
+
circuitName?: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Base interface for chain-specific metadata
|
|
32
|
+
*/
|
|
33
|
+
interface ChainMetadata {
|
|
34
|
+
chainId: ChainId;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Solana-specific metadata for VK account sizing and rent
|
|
38
|
+
*/
|
|
39
|
+
interface SolanaChainMetadata extends ChainMetadata {
|
|
40
|
+
chainId: 'solana';
|
|
41
|
+
/** Size of the VK account in bytes */
|
|
42
|
+
accountSize: number;
|
|
43
|
+
/** Estimated rent-exempt balance in lamports */
|
|
44
|
+
estimatedRent: number;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Ethereum-specific metadata (future)
|
|
48
|
+
*/
|
|
49
|
+
interface EthereumChainMetadata extends ChainMetadata {
|
|
50
|
+
chainId: 'ethereum';
|
|
51
|
+
/** Estimated gas for verification */
|
|
52
|
+
estimatedGas: bigint;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Type helper to get chain-specific metadata
|
|
56
|
+
*/
|
|
57
|
+
type ChainMetadataFor<T extends ChainId> = T extends 'solana' ? SolanaChainMetadata : T extends 'ethereum' ? EthereumChainMetadata : ChainMetadata;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Available proving system providers
|
|
61
|
+
*/
|
|
62
|
+
declare enum Provider {
|
|
63
|
+
/** Barretenberg backend - browser compatible, UltraHonk proofs (~16KB) */
|
|
64
|
+
Barretenberg = "barretenberg",
|
|
65
|
+
/** Arkworks WASM backend - browser compatible, Groth16 proofs (~256 bytes) */
|
|
66
|
+
Arkworks = "arkworks",
|
|
67
|
+
/** Sunspot CLI backend - Node.js only, Groth16 proofs (~256 bytes) */
|
|
68
|
+
Sunspot = "sunspot"
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Configuration for circuit paths (required for Sunspot)
|
|
72
|
+
*/
|
|
73
|
+
interface CircuitPaths {
|
|
74
|
+
/** Path to the proving key file */
|
|
75
|
+
pkPath: string;
|
|
76
|
+
/** Path to the verification key file */
|
|
77
|
+
vkPath: string;
|
|
78
|
+
/** Path to the compiled circuit JSON file */
|
|
79
|
+
circuitPath: string;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Configuration for IziNoir initialization
|
|
83
|
+
*/
|
|
84
|
+
interface IziNoirConfig {
|
|
85
|
+
/** The proving system provider to use */
|
|
86
|
+
provider: Provider;
|
|
87
|
+
/**
|
|
88
|
+
* Target blockchain for proof formatting.
|
|
89
|
+
* If omitted, operates in offchain mode (raw proofs, no chain formatting).
|
|
90
|
+
*/
|
|
91
|
+
chain?: Chain;
|
|
92
|
+
/** Circuit paths - required for Sunspot provider */
|
|
93
|
+
circuitPaths?: CircuitPaths;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
interface ICompiler {
|
|
97
|
+
compile(noirCode: string): Promise<CompiledCircuit>;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Interface for generating zero-knowledge proofs
|
|
102
|
+
*/
|
|
103
|
+
interface IProver {
|
|
104
|
+
/**
|
|
105
|
+
* Generate a proof for the given circuit and inputs
|
|
106
|
+
*
|
|
107
|
+
* @param circuit - The compiled circuit to prove
|
|
108
|
+
* @param inputs - The inputs (both public and private) for the circuit
|
|
109
|
+
* @returns The proof data including proof bytes and public inputs
|
|
110
|
+
*/
|
|
111
|
+
generateProof(circuit: CompiledCircuit, inputs: InputMap): Promise<ProofData>;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Interface for verifying zero-knowledge proofs
|
|
116
|
+
*/
|
|
117
|
+
interface IVerifier {
|
|
118
|
+
/**
|
|
119
|
+
* Verify a proof against a compiled circuit
|
|
120
|
+
*
|
|
121
|
+
* @param circuit - The compiled circuit used to generate the proof
|
|
122
|
+
* @param proof - The proof bytes to verify
|
|
123
|
+
* @param publicInputs - The public inputs that were used
|
|
124
|
+
* @returns true if the proof is valid, false otherwise
|
|
125
|
+
*/
|
|
126
|
+
verifyProof(circuit: CompiledCircuit, proof: Uint8Array, publicInputs: string[]): Promise<boolean>;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Unified interface for a complete proving system.
|
|
131
|
+
* Combines compilation, proof generation, and verification into a single abstraction.
|
|
132
|
+
*
|
|
133
|
+
* Implementations:
|
|
134
|
+
* - Barretenberg: WASM-based (browser compatible), UltraHonk proofs
|
|
135
|
+
* - Sunspot: CLI-based (Node.js only), Groth16 proofs for Solana
|
|
136
|
+
*/
|
|
137
|
+
interface IProvingSystem extends ICompiler, IProver, IVerifier {
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export { type ChainId as C, type EthereumChainMetadata as E, type IziNoirConfig as I, Provider as P, type SolanaChainMetadata as S, type CircuitMetadata as a, type ChainMetadataFor as b, Chain as c, type IProvingSystem as d, type CircuitPaths as e, type ChainMetadata as f, type ICompiler as g, type IProver as h, type IVerifier as i };
|