@umbra-privacy/rn-zk-prover 0.1.0 → 0.1.2
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/lib/typescript/src/generated/mopro_umbra_2.d.ts +0 -9
- package/lib/typescript/src/generated/mopro_umbra_2.d.ts.map +1 -1
- package/package.json +5 -4
- package/src/NativeMoproFfi.ts +10 -0
- package/src/generated/mopro_umbra_2-ffi.ts +153 -0
- package/src/generated/mopro_umbra_2.ts +838 -0
- package/src/index.tsx +41 -0
|
@@ -205,9 +205,6 @@ export declare const MoproError: Readonly<{
|
|
|
205
205
|
cause?: unknown;
|
|
206
206
|
}): Readonly<[string]>;
|
|
207
207
|
isError(error: unknown): error is Error;
|
|
208
|
-
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
209
|
-
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
210
|
-
stackTraceLimit: number;
|
|
211
208
|
};
|
|
212
209
|
Halo2Error: {
|
|
213
210
|
new (v0: string): {
|
|
@@ -276,9 +273,6 @@ export declare const MoproError: Readonly<{
|
|
|
276
273
|
cause?: unknown;
|
|
277
274
|
}): Readonly<[string]>;
|
|
278
275
|
isError(error: unknown): error is Error;
|
|
279
|
-
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
280
|
-
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
281
|
-
stackTraceLimit: number;
|
|
282
276
|
};
|
|
283
277
|
NoirError: {
|
|
284
278
|
new (v0: string): {
|
|
@@ -347,9 +341,6 @@ export declare const MoproError: Readonly<{
|
|
|
347
341
|
cause?: unknown;
|
|
348
342
|
}): Readonly<[string]>;
|
|
349
343
|
isError(error: unknown): error is Error;
|
|
350
|
-
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
351
|
-
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
352
|
-
stackTraceLimit: number;
|
|
353
344
|
};
|
|
354
345
|
}>;
|
|
355
346
|
export type MoproError = InstanceType<typeof MoproError[keyof Omit<typeof MoproError, 'instanceOf'>]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mopro_umbra_2.d.ts","sourceRoot":"","sources":["../../../../src/generated/mopro_umbra_2.ts"],"names":[],"mappings":"AAoCA,OAAO,EACL,KAAK,eAAe,EAQpB,UAAU,EAMV,oBAAoB,EACE,MAAM,6BAA6B,CAAC;AAa5D,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,iBAAiB,CAa9G;AACL,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,gBAAgB,CAa3H;AACL,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE,aAAa,EAAE,OAAO,GAAG,WAAW,CAgB7K;AACL,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,GAAG,WAAW,CAc1I;AACL;;;GAGG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAQpC;AACL,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,iBAAiB,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAa3G;AACL,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,G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ARM;;;eAGG;;;;;;SAe2C;sBAKzB,GAAG,GAAG,GAAG;;4BAjBd,QAAQ,CAChC,CAAC,MAAM,CACN,CAAC;YARM;;;eAGG;;;;;;SAoByC;;;4BAjB5B,QAAQ,CAChC,CAAC,MAAM,CACN,CAAC;YARM;;;eAGG;;;;;;YAwB+B,QAAQ,CAClD,CAAC,MAAM,CACN,CAAC;;;EAiBE,CAAC;AAIL,MAAM,MAAM,UAAU,GAAG,YAAY,CACjC,OAAO,UAAU,CAAC,MAAM,IAAI,CAAC,OAAO,UAAU,EAAE,YAAY,CAAC,CAAC,CACjE,CAAC;AAoEF,oBAAY,QAAQ;IAChB,QAAQ,IAAA;IACR,UAAU,IAAA;CACb;AAyCD;;;;;;;;;GASG;AACH,iBAAS,uBAAuB,SAiC3B;;;;;uBAjlBc,UAAU;4CASQ,UAAU,GAAG,IAAI;gDAOb,MAAM;;;;;uBAkD5B,UAAU;kDAMQ,UAAU,GAAG,IAAI;sDAIb,MAAM;;;;;uBAgD5B,UAAU;mCAOQ,UAAU,GAAG,IAAI;uCAKb,MAAM;;;;;uBAiD5B,UAAU;mCAOQ,UAAU,GAAG,IAAI;uCAKb,MAAM;;;;;uBAgD5B,UAAU;iDAMQ,UAAU,GAAG,IAAI;qDAIb,MAAM;;;;;uBA8L5B,UAAU;2CAQQ,UAAU,GAAG,IAAI;+CAyBb,MAAM;;;;;uBAqC5B,UAAU;yCAOQ,UAAU,GAAG,IAAI;6CAMb,MAAM;;;;;;AAmE/C,wBAWG"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umbra-privacy/rn-zk-prover",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.2",
|
|
5
5
|
"description": "ZK Prover bindings for React Native for Umbra Privacy ZKs",
|
|
6
6
|
"main": "./lib/module/index.js",
|
|
7
7
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"./package.json": "./package.json"
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
|
+
"src",
|
|
17
18
|
"lib",
|
|
18
19
|
"android",
|
|
19
20
|
"ios",
|
|
@@ -49,14 +50,14 @@
|
|
|
49
50
|
],
|
|
50
51
|
"repository": {
|
|
51
52
|
"type": "git",
|
|
52
|
-
"url": "git+https://github.com/
|
|
53
|
+
"url": "git+https://github.com/umbra-defi/rn-zk-prover.git"
|
|
53
54
|
},
|
|
54
55
|
"author": "ZK Mopro Team (https://zkmopro.com)",
|
|
55
56
|
"license": "MIT",
|
|
56
57
|
"bugs": {
|
|
57
|
-
"url": "https://github.com/
|
|
58
|
+
"url": "https://github.com/umbra-defi/rn-zk-prover/issues"
|
|
58
59
|
},
|
|
59
|
-
"homepage": "https://github.com/
|
|
60
|
+
"homepage": "https://github.com/umbra-defi/rn-zk-prover#readme",
|
|
60
61
|
"publishConfig": {
|
|
61
62
|
"registry": "https://registry.npmjs.org/",
|
|
62
63
|
"access": "restricted"
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Generated by uniffi-bindgen-react-native
|
|
2
|
+
import type { TurboModule } from 'react-native';
|
|
3
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
4
|
+
|
|
5
|
+
export interface Spec extends TurboModule {
|
|
6
|
+
installRustCrate(): boolean;
|
|
7
|
+
cleanupRustCrate(): boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default TurboModuleRegistry.getEnforcing<Spec>('MoproFfi');
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
// This file was autogenerated by some hot garbage in the `uniffi-bindgen-react-native` crate.
|
|
2
|
+
// Trust me, you don't want to mess with it!
|
|
3
|
+
|
|
4
|
+
/* tslint:disable */
|
|
5
|
+
/* eslint-disable */
|
|
6
|
+
// @ts-nocheck
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
type StructuralEquality as UniffiStructuralEquality,
|
|
10
|
+
type UniffiForeignFuture as RuntimeUniffiForeignFuture,
|
|
11
|
+
type UniffiRustCallStatus,
|
|
12
|
+
type UniffiRustArcPtr,
|
|
13
|
+
type UniffiRustFutureContinuationCallback as RuntimeUniffiRustFutureContinuationCallback,
|
|
14
|
+
type UniffiResult,
|
|
15
|
+
} from 'uniffi-bindgen-react-native';
|
|
16
|
+
|
|
17
|
+
interface NativeModuleInterface {
|
|
18
|
+
ubrn_uniffi_internal_fn_func_ffi__string_to_byte_length(string: string, uniffi_out_err: UniffiRustCallStatus): number;
|
|
19
|
+
ubrn_uniffi_internal_fn_func_ffi__string_to_arraybuffer(string: string, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
|
|
20
|
+
ubrn_uniffi_internal_fn_func_ffi__arraybuffer_to_string(buffer: Uint8Array, uniffi_out_err: UniffiRustCallStatus): string;
|
|
21
|
+
ubrn_uniffi_mopro_umbra_2_fn_func_generate_circom_proof(zkeyPath: Uint8Array, circuitInputs: Uint8Array, proofLib: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
|
|
22
|
+
ubrn_uniffi_mopro_umbra_2_fn_func_generate_halo2_proof(srsPath: Uint8Array, pkPath: Uint8Array, circuitInputs: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
|
|
23
|
+
ubrn_uniffi_mopro_umbra_2_fn_func_generate_noir_proof(circuitPath: Uint8Array, srsPath: Uint8Array, inputs: Uint8Array, onChain: number, vk: Uint8Array, lowMemoryMode: number, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
|
|
24
|
+
ubrn_uniffi_mopro_umbra_2_fn_func_get_noir_verification_key(circuitPath: Uint8Array, srsPath: Uint8Array, onChain: number, lowMemoryMode: number, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
|
|
25
|
+
ubrn_uniffi_mopro_umbra_2_fn_func_mopro_hello_world(uniffi_out_err: UniffiRustCallStatus): Uint8Array;
|
|
26
|
+
ubrn_uniffi_mopro_umbra_2_fn_func_verify_circom_proof(zkeyPath: Uint8Array, proofResult: Uint8Array, proofLib: Uint8Array, uniffi_out_err: UniffiRustCallStatus): number;
|
|
27
|
+
ubrn_uniffi_mopro_umbra_2_fn_func_verify_halo2_proof(srsPath: Uint8Array, vkPath: Uint8Array, proof: Uint8Array, publicInput: Uint8Array, uniffi_out_err: UniffiRustCallStatus): number;
|
|
28
|
+
ubrn_uniffi_mopro_umbra_2_fn_func_verify_noir_proof(circuitPath: Uint8Array, proof: Uint8Array, onChain: number, vk: Uint8Array, lowMemoryMode: number, uniffi_out_err: UniffiRustCallStatus): number;
|
|
29
|
+
ubrn_uniffi_mopro_umbra_2_checksum_func_generate_circom_proof(): number;
|
|
30
|
+
ubrn_uniffi_mopro_umbra_2_checksum_func_generate_halo2_proof(): number;
|
|
31
|
+
ubrn_uniffi_mopro_umbra_2_checksum_func_generate_noir_proof(): number;
|
|
32
|
+
ubrn_uniffi_mopro_umbra_2_checksum_func_get_noir_verification_key(): number;
|
|
33
|
+
ubrn_uniffi_mopro_umbra_2_checksum_func_mopro_hello_world(): number;
|
|
34
|
+
ubrn_uniffi_mopro_umbra_2_checksum_func_verify_circom_proof(): number;
|
|
35
|
+
ubrn_uniffi_mopro_umbra_2_checksum_func_verify_halo2_proof(): number;
|
|
36
|
+
ubrn_uniffi_mopro_umbra_2_checksum_func_verify_noir_proof(): number;
|
|
37
|
+
ubrn_ffi_mopro_umbra_2_uniffi_contract_version(): number;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Casting globalThis to any allows us to look for `NativeMoproUmbra2`
|
|
41
|
+
// if it was added via JSI.
|
|
42
|
+
//
|
|
43
|
+
// We use a getter here rather than simply `globalThis.NativeMoproUmbra2` so that
|
|
44
|
+
// if/when the startup sequence isn't just so, an empty value isn't inadvertantly cached.
|
|
45
|
+
const getter: () => NativeModuleInterface = () => (globalThis as any).NativeMoproUmbra2;
|
|
46
|
+
export default getter;
|
|
47
|
+
|
|
48
|
+
// Structs and function types for calling back into Typescript from Rust.
|
|
49
|
+
export type UniffiRustFutureContinuationCallback = (data: bigint, pollResult: number) => void;
|
|
50
|
+
type UniffiForeignFutureFree = (handle: bigint) => void;
|
|
51
|
+
type UniffiCallbackInterfaceFree = (handle: bigint) => void;
|
|
52
|
+
export type UniffiForeignFuture = {
|
|
53
|
+
handle: bigint;
|
|
54
|
+
free: UniffiForeignFutureFree;
|
|
55
|
+
};
|
|
56
|
+
export type UniffiForeignFutureStructU8 = {
|
|
57
|
+
returnValue: number;
|
|
58
|
+
callStatus: UniffiRustCallStatus;
|
|
59
|
+
};
|
|
60
|
+
export type UniffiForeignFutureCompleteU8 = (callbackData: bigint, result: UniffiForeignFutureStructU8) => void;
|
|
61
|
+
export type UniffiForeignFutureStructI8 = {
|
|
62
|
+
returnValue: number;
|
|
63
|
+
callStatus: UniffiRustCallStatus;
|
|
64
|
+
};
|
|
65
|
+
export type UniffiForeignFutureCompleteI8 = (callbackData: bigint, result: UniffiForeignFutureStructI8) => void;
|
|
66
|
+
export type UniffiForeignFutureStructU16 = {
|
|
67
|
+
returnValue: number;
|
|
68
|
+
callStatus: UniffiRustCallStatus;
|
|
69
|
+
};
|
|
70
|
+
export type UniffiForeignFutureCompleteU16 = (callbackData: bigint, result: UniffiForeignFutureStructU16) => void;
|
|
71
|
+
export type UniffiForeignFutureStructI16 = {
|
|
72
|
+
returnValue: number;
|
|
73
|
+
callStatus: UniffiRustCallStatus;
|
|
74
|
+
};
|
|
75
|
+
export type UniffiForeignFutureCompleteI16 = (callbackData: bigint, result: UniffiForeignFutureStructI16) => void;
|
|
76
|
+
export type UniffiForeignFutureStructU32 = {
|
|
77
|
+
returnValue: number;
|
|
78
|
+
callStatus: UniffiRustCallStatus;
|
|
79
|
+
};
|
|
80
|
+
export type UniffiForeignFutureCompleteU32 = (callbackData: bigint, result: UniffiForeignFutureStructU32) => void;
|
|
81
|
+
export type UniffiForeignFutureStructI32 = {
|
|
82
|
+
returnValue: number;
|
|
83
|
+
callStatus: UniffiRustCallStatus;
|
|
84
|
+
};
|
|
85
|
+
export type UniffiForeignFutureCompleteI32 = (callbackData: bigint, result: UniffiForeignFutureStructI32) => void;
|
|
86
|
+
export type UniffiForeignFutureStructU64 = {
|
|
87
|
+
returnValue: bigint;
|
|
88
|
+
callStatus: UniffiRustCallStatus;
|
|
89
|
+
};
|
|
90
|
+
export type UniffiForeignFutureCompleteU64 = (callbackData: bigint, result: UniffiForeignFutureStructU64) => void;
|
|
91
|
+
export type UniffiForeignFutureStructI64 = {
|
|
92
|
+
returnValue: bigint;
|
|
93
|
+
callStatus: UniffiRustCallStatus;
|
|
94
|
+
};
|
|
95
|
+
export type UniffiForeignFutureCompleteI64 = (callbackData: bigint, result: UniffiForeignFutureStructI64) => void;
|
|
96
|
+
export type UniffiForeignFutureStructF32 = {
|
|
97
|
+
returnValue: number;
|
|
98
|
+
callStatus: UniffiRustCallStatus;
|
|
99
|
+
};
|
|
100
|
+
export type UniffiForeignFutureCompleteF32 = (callbackData: bigint, result: UniffiForeignFutureStructF32) => void;
|
|
101
|
+
export type UniffiForeignFutureStructF64 = {
|
|
102
|
+
returnValue: number;
|
|
103
|
+
callStatus: UniffiRustCallStatus;
|
|
104
|
+
};
|
|
105
|
+
export type UniffiForeignFutureCompleteF64 = (callbackData: bigint, result: UniffiForeignFutureStructF64) => void;
|
|
106
|
+
export type UniffiForeignFutureStructPointer = {
|
|
107
|
+
returnValue: bigint;
|
|
108
|
+
callStatus: UniffiRustCallStatus;
|
|
109
|
+
};
|
|
110
|
+
export type UniffiForeignFutureCompletePointer = (callbackData: bigint, result: UniffiForeignFutureStructPointer) => void;
|
|
111
|
+
export type UniffiForeignFutureStructRustBuffer = {
|
|
112
|
+
returnValue: Uint8Array;
|
|
113
|
+
callStatus: UniffiRustCallStatus;
|
|
114
|
+
};
|
|
115
|
+
export type UniffiForeignFutureCompleteRustBuffer = (callbackData: bigint, result: UniffiForeignFutureStructRustBuffer) => void;
|
|
116
|
+
export type UniffiForeignFutureStructVoid = {
|
|
117
|
+
callStatus: UniffiRustCallStatus;
|
|
118
|
+
};
|
|
119
|
+
export type UniffiForeignFutureCompleteVoid = (callbackData: bigint, result: UniffiForeignFutureStructVoid) => void;
|
|
120
|
+
|
|
121
|
+
// UniffiRustFutureContinuationCallback is generated as part of the component interface's
|
|
122
|
+
// ffi_definitions. However, we need it in the runtime.
|
|
123
|
+
// We could:
|
|
124
|
+
// (a) do some complicated template logic to ensure the declaration is not generated here (possible)
|
|
125
|
+
// (b) import the generated declaration into the runtime (m a y b e) or…
|
|
126
|
+
// (c) generate the declaration anyway, and use a different declaration in the runtime.
|
|
127
|
+
//
|
|
128
|
+
// We chose (c) here as the simplest. In addition, we perform a compile time check that
|
|
129
|
+
// the two versions of `UniffiRustFutureContinuationCallback` are structurally equivalent.
|
|
130
|
+
//
|
|
131
|
+
// If you see the error:
|
|
132
|
+
// ```
|
|
133
|
+
// Type 'true' is not assignable to type 'false'.(2322)
|
|
134
|
+
// ```
|
|
135
|
+
// Then a new version of uniffi has changed the signature of the callback. Most likely, code in
|
|
136
|
+
// `typescript/src/async-rust-call.ts` will need to be changed.
|
|
137
|
+
//
|
|
138
|
+
// If you see the error:
|
|
139
|
+
// ```
|
|
140
|
+
// Cannot find name 'UniffiRustFutureContinuationCallback'. Did you mean 'RuntimeUniffiRustFutureContinuationCallback'?(2552)
|
|
141
|
+
// ```
|
|
142
|
+
// then you may not be using callbacks or promises, and uniffi is now not generating Futures and callbacks.
|
|
143
|
+
// You should not generate this if that is the case.
|
|
144
|
+
//
|
|
145
|
+
// ('You' being the bindings generator maintainer).
|
|
146
|
+
const isRustFutureContinuationCallbackTypeCompatible: UniffiStructuralEquality<
|
|
147
|
+
RuntimeUniffiRustFutureContinuationCallback,
|
|
148
|
+
UniffiRustFutureContinuationCallback
|
|
149
|
+
> = true;
|
|
150
|
+
const isUniffiForeignFutureTypeCompatible: UniffiStructuralEquality<
|
|
151
|
+
RuntimeUniffiForeignFuture,
|
|
152
|
+
UniffiForeignFuture
|
|
153
|
+
> = true;
|
|
@@ -0,0 +1,838 @@
|
|
|
1
|
+
// This file was autogenerated by some hot garbage in the `uniffi-bindgen-react-native` crate.
|
|
2
|
+
// Trust me, you don't want to mess with it!
|
|
3
|
+
|
|
4
|
+
/* tslint:disable */
|
|
5
|
+
/* eslint-disable */
|
|
6
|
+
// @ts-nocheck
|
|
7
|
+
import nativeModule, {
|
|
8
|
+
type UniffiRustFutureContinuationCallback,
|
|
9
|
+
type UniffiForeignFuture,
|
|
10
|
+
type UniffiForeignFutureStructU8,
|
|
11
|
+
type UniffiForeignFutureCompleteU8,
|
|
12
|
+
type UniffiForeignFutureStructI8,
|
|
13
|
+
type UniffiForeignFutureCompleteI8,
|
|
14
|
+
type UniffiForeignFutureStructU16,
|
|
15
|
+
type UniffiForeignFutureCompleteU16,
|
|
16
|
+
type UniffiForeignFutureStructI16,
|
|
17
|
+
type UniffiForeignFutureCompleteI16,
|
|
18
|
+
type UniffiForeignFutureStructU32,
|
|
19
|
+
type UniffiForeignFutureCompleteU32,
|
|
20
|
+
type UniffiForeignFutureStructI32,
|
|
21
|
+
type UniffiForeignFutureCompleteI32,
|
|
22
|
+
type UniffiForeignFutureStructU64,
|
|
23
|
+
type UniffiForeignFutureCompleteU64,
|
|
24
|
+
type UniffiForeignFutureStructI64,
|
|
25
|
+
type UniffiForeignFutureCompleteI64,
|
|
26
|
+
type UniffiForeignFutureStructF32,
|
|
27
|
+
type UniffiForeignFutureCompleteF32,
|
|
28
|
+
type UniffiForeignFutureStructF64,
|
|
29
|
+
type UniffiForeignFutureCompleteF64,
|
|
30
|
+
type UniffiForeignFutureStructPointer,
|
|
31
|
+
type UniffiForeignFutureCompletePointer,
|
|
32
|
+
type UniffiForeignFutureStructRustBuffer,
|
|
33
|
+
type UniffiForeignFutureCompleteRustBuffer,
|
|
34
|
+
type UniffiForeignFutureStructVoid,
|
|
35
|
+
type UniffiForeignFutureCompleteVoid,
|
|
36
|
+
} from "./mopro_umbra_2-ffi";
|
|
37
|
+
import {
|
|
38
|
+
type UniffiByteArray,
|
|
39
|
+
AbstractFfiConverterByteArray,
|
|
40
|
+
FfiConverterArray,
|
|
41
|
+
FfiConverterArrayBuffer,
|
|
42
|
+
FfiConverterBool,
|
|
43
|
+
FfiConverterInt32,
|
|
44
|
+
FfiConverterMap,
|
|
45
|
+
FfiConverterOptional,
|
|
46
|
+
RustBuffer,
|
|
47
|
+
UniffiError,
|
|
48
|
+
UniffiInternalError,
|
|
49
|
+
UniffiRustCaller,
|
|
50
|
+
uniffiCreateFfiConverterString,
|
|
51
|
+
uniffiCreateRecord,
|
|
52
|
+
uniffiTypeNameSymbol,
|
|
53
|
+
variantOrdinalSymbol } from "uniffi-bindgen-react-native";
|
|
54
|
+
|
|
55
|
+
// Get converters from the other files, if any.
|
|
56
|
+
const uniffiCaller = new UniffiRustCaller(() => ({ code: 0 }));
|
|
57
|
+
|
|
58
|
+
const uniffiIsDebug =
|
|
59
|
+
// @ts-ignore -- The process global might not be defined
|
|
60
|
+
typeof process !== "object" ||
|
|
61
|
+
// @ts-ignore -- The process global might not be defined
|
|
62
|
+
process?.env?.NODE_ENV !== "production" ||
|
|
63
|
+
false;
|
|
64
|
+
// Public interface members begin here.
|
|
65
|
+
|
|
66
|
+
export function generateCircomProof(zkeyPath: string, circuitInputs: string, proofLib: ProofLib): CircomProofResult /*throws*/ {
|
|
67
|
+
return FfiConverterTypeCircomProofResult.lift(
|
|
68
|
+
uniffiCaller.rustCallWithError(
|
|
69
|
+
/*liftError:*/ FfiConverterTypeMoproError.lift.bind(FfiConverterTypeMoproError),
|
|
70
|
+
/*caller:*/ (callStatus) => {
|
|
71
|
+
return nativeModule().ubrn_uniffi_mopro_umbra_2_fn_func_generate_circom_proof(
|
|
72
|
+
FfiConverterString.lower(zkeyPath),
|
|
73
|
+
FfiConverterString.lower(circuitInputs),
|
|
74
|
+
FfiConverterTypeProofLib.lower(proofLib),
|
|
75
|
+
callStatus);
|
|
76
|
+
},
|
|
77
|
+
/*liftString:*/ FfiConverterString.lift,
|
|
78
|
+
));
|
|
79
|
+
}
|
|
80
|
+
export function generateHalo2Proof(srsPath: string, pkPath: string, circuitInputs: Map<string, Array<string>>): Halo2ProofResult /*throws*/ {
|
|
81
|
+
return FfiConverterTypeHalo2ProofResult.lift(
|
|
82
|
+
uniffiCaller.rustCallWithError(
|
|
83
|
+
/*liftError:*/ FfiConverterTypeMoproError.lift.bind(FfiConverterTypeMoproError),
|
|
84
|
+
/*caller:*/ (callStatus) => {
|
|
85
|
+
return nativeModule().ubrn_uniffi_mopro_umbra_2_fn_func_generate_halo2_proof(
|
|
86
|
+
FfiConverterString.lower(srsPath),
|
|
87
|
+
FfiConverterString.lower(pkPath),
|
|
88
|
+
FfiConverterMapStringArrayString.lower(circuitInputs),
|
|
89
|
+
callStatus);
|
|
90
|
+
},
|
|
91
|
+
/*liftString:*/ FfiConverterString.lift,
|
|
92
|
+
));
|
|
93
|
+
}
|
|
94
|
+
export function generateNoirProof(circuitPath: string, srsPath: string | undefined, inputs: Array<string>, onChain: boolean, vk: ArrayBuffer, lowMemoryMode: boolean): ArrayBuffer /*throws*/ {
|
|
95
|
+
return FfiConverterArrayBuffer.lift(
|
|
96
|
+
uniffiCaller.rustCallWithError(
|
|
97
|
+
/*liftError:*/ FfiConverterTypeMoproError.lift.bind(FfiConverterTypeMoproError),
|
|
98
|
+
/*caller:*/ (callStatus) => {
|
|
99
|
+
return nativeModule().ubrn_uniffi_mopro_umbra_2_fn_func_generate_noir_proof(
|
|
100
|
+
FfiConverterString.lower(circuitPath),
|
|
101
|
+
FfiConverterOptionalString.lower(srsPath),
|
|
102
|
+
FfiConverterArrayString.lower(inputs),
|
|
103
|
+
FfiConverterBool.lower(onChain),
|
|
104
|
+
FfiConverterArrayBuffer.lower(vk),
|
|
105
|
+
FfiConverterBool.lower(lowMemoryMode),
|
|
106
|
+
callStatus);
|
|
107
|
+
},
|
|
108
|
+
/*liftString:*/ FfiConverterString.lift,
|
|
109
|
+
));
|
|
110
|
+
}
|
|
111
|
+
export function getNoirVerificationKey(circuitPath: string, srsPath: string | undefined, onChain: boolean, lowMemoryMode: boolean): ArrayBuffer /*throws*/ {
|
|
112
|
+
return FfiConverterArrayBuffer.lift(
|
|
113
|
+
uniffiCaller.rustCallWithError(
|
|
114
|
+
/*liftError:*/ FfiConverterTypeMoproError.lift.bind(FfiConverterTypeMoproError),
|
|
115
|
+
/*caller:*/ (callStatus) => {
|
|
116
|
+
return nativeModule().ubrn_uniffi_mopro_umbra_2_fn_func_get_noir_verification_key(
|
|
117
|
+
FfiConverterString.lower(circuitPath),
|
|
118
|
+
FfiConverterOptionalString.lower(srsPath),
|
|
119
|
+
FfiConverterBool.lower(onChain),
|
|
120
|
+
FfiConverterBool.lower(lowMemoryMode),
|
|
121
|
+
callStatus);
|
|
122
|
+
},
|
|
123
|
+
/*liftString:*/ FfiConverterString.lift,
|
|
124
|
+
));
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* You can also customize the bindings by #[uniffi::export]
|
|
128
|
+
* Reference: https://mozilla.github.io/uniffi-rs/latest/proc_macro/index.html
|
|
129
|
+
*/
|
|
130
|
+
export function moproHelloWorld(): string {
|
|
131
|
+
return FfiConverterString.lift(uniffiCaller.rustCall(
|
|
132
|
+
/*caller:*/ (callStatus) => {
|
|
133
|
+
return nativeModule().ubrn_uniffi_mopro_umbra_2_fn_func_mopro_hello_world(
|
|
134
|
+
callStatus);
|
|
135
|
+
},
|
|
136
|
+
/*liftString:*/ FfiConverterString.lift,
|
|
137
|
+
));
|
|
138
|
+
}
|
|
139
|
+
export function verifyCircomProof(zkeyPath: string, proofResult: CircomProofResult, proofLib: ProofLib): boolean /*throws*/ {
|
|
140
|
+
return FfiConverterBool.lift(
|
|
141
|
+
uniffiCaller.rustCallWithError(
|
|
142
|
+
/*liftError:*/ FfiConverterTypeMoproError.lift.bind(FfiConverterTypeMoproError),
|
|
143
|
+
/*caller:*/ (callStatus) => {
|
|
144
|
+
return nativeModule().ubrn_uniffi_mopro_umbra_2_fn_func_verify_circom_proof(
|
|
145
|
+
FfiConverterString.lower(zkeyPath),
|
|
146
|
+
FfiConverterTypeCircomProofResult.lower(proofResult),
|
|
147
|
+
FfiConverterTypeProofLib.lower(proofLib),
|
|
148
|
+
callStatus);
|
|
149
|
+
},
|
|
150
|
+
/*liftString:*/ FfiConverterString.lift,
|
|
151
|
+
));
|
|
152
|
+
}
|
|
153
|
+
export function verifyHalo2Proof(srsPath: string, vkPath: string, proof: ArrayBuffer, publicInput: ArrayBuffer): boolean /*throws*/ {
|
|
154
|
+
return FfiConverterBool.lift(
|
|
155
|
+
uniffiCaller.rustCallWithError(
|
|
156
|
+
/*liftError:*/ FfiConverterTypeMoproError.lift.bind(FfiConverterTypeMoproError),
|
|
157
|
+
/*caller:*/ (callStatus) => {
|
|
158
|
+
return nativeModule().ubrn_uniffi_mopro_umbra_2_fn_func_verify_halo2_proof(
|
|
159
|
+
FfiConverterString.lower(srsPath),
|
|
160
|
+
FfiConverterString.lower(vkPath),
|
|
161
|
+
FfiConverterArrayBuffer.lower(proof),
|
|
162
|
+
FfiConverterArrayBuffer.lower(publicInput),
|
|
163
|
+
callStatus);
|
|
164
|
+
},
|
|
165
|
+
/*liftString:*/ FfiConverterString.lift,
|
|
166
|
+
));
|
|
167
|
+
}
|
|
168
|
+
export function verifyNoirProof(circuitPath: string, proof: ArrayBuffer, onChain: boolean, vk: ArrayBuffer, lowMemoryMode: boolean): boolean /*throws*/ {
|
|
169
|
+
return FfiConverterBool.lift(
|
|
170
|
+
uniffiCaller.rustCallWithError(
|
|
171
|
+
/*liftError:*/ FfiConverterTypeMoproError.lift.bind(FfiConverterTypeMoproError),
|
|
172
|
+
/*caller:*/ (callStatus) => {
|
|
173
|
+
return nativeModule().ubrn_uniffi_mopro_umbra_2_fn_func_verify_noir_proof(
|
|
174
|
+
FfiConverterString.lower(circuitPath),
|
|
175
|
+
FfiConverterArrayBuffer.lower(proof),
|
|
176
|
+
FfiConverterBool.lower(onChain),
|
|
177
|
+
FfiConverterArrayBuffer.lower(vk),
|
|
178
|
+
FfiConverterBool.lower(lowMemoryMode),
|
|
179
|
+
callStatus);
|
|
180
|
+
},
|
|
181
|
+
/*liftString:*/ FfiConverterString.lift,
|
|
182
|
+
));
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
export type CircomProof = {
|
|
193
|
+
a: G1,
|
|
194
|
+
b: G2,
|
|
195
|
+
c: G1,
|
|
196
|
+
protocol: string,
|
|
197
|
+
curve: string
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Generated factory for {@link CircomProof} record objects.
|
|
202
|
+
*/
|
|
203
|
+
export const CircomProof = (() => {
|
|
204
|
+
const defaults = () => ({
|
|
205
|
+
});
|
|
206
|
+
const create = (() => {
|
|
207
|
+
return uniffiCreateRecord<CircomProof, ReturnType<typeof defaults>>(defaults);
|
|
208
|
+
})();
|
|
209
|
+
return Object.freeze({
|
|
210
|
+
/**
|
|
211
|
+
* Create a frozen instance of {@link CircomProof}, with defaults specified
|
|
212
|
+
* in Rust, in the {@link mopro_umbra_2} crate.
|
|
213
|
+
*/
|
|
214
|
+
create,
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Create a frozen instance of {@link CircomProof}, with defaults specified
|
|
218
|
+
* in Rust, in the {@link mopro_umbra_2} crate.
|
|
219
|
+
*/
|
|
220
|
+
new: create,
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Defaults specified in the {@link mopro_umbra_2} crate.
|
|
224
|
+
*/
|
|
225
|
+
defaults: () => Object.freeze(defaults()) as Partial<CircomProof>,
|
|
226
|
+
});
|
|
227
|
+
})();
|
|
228
|
+
|
|
229
|
+
const FfiConverterTypeCircomProof = (() => {
|
|
230
|
+
type TypeName = CircomProof;
|
|
231
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
232
|
+
read(from: RustBuffer): TypeName {
|
|
233
|
+
return {
|
|
234
|
+
a: FfiConverterTypeG1.read(from),
|
|
235
|
+
b: FfiConverterTypeG2.read(from),
|
|
236
|
+
c: FfiConverterTypeG1.read(from),
|
|
237
|
+
protocol: FfiConverterString.read(from),
|
|
238
|
+
curve: FfiConverterString.read(from)
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
242
|
+
FfiConverterTypeG1.write(value.a, into);
|
|
243
|
+
FfiConverterTypeG2.write(value.b, into);
|
|
244
|
+
FfiConverterTypeG1.write(value.c, into);
|
|
245
|
+
FfiConverterString.write(value.protocol, into);
|
|
246
|
+
FfiConverterString.write(value.curve, into);
|
|
247
|
+
}
|
|
248
|
+
allocationSize(value: TypeName): number {
|
|
249
|
+
return FfiConverterTypeG1.allocationSize(value.a) +
|
|
250
|
+
FfiConverterTypeG2.allocationSize(value.b) +
|
|
251
|
+
FfiConverterTypeG1.allocationSize(value.c) +
|
|
252
|
+
FfiConverterString.allocationSize(value.protocol) +
|
|
253
|
+
FfiConverterString.allocationSize(value.curve);
|
|
254
|
+
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
return new FFIConverter();
|
|
258
|
+
})();
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
export type CircomProofResult = {
|
|
262
|
+
proof: CircomProof,
|
|
263
|
+
inputs: Array<string>
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Generated factory for {@link CircomProofResult} record objects.
|
|
268
|
+
*/
|
|
269
|
+
export const CircomProofResult = (() => {
|
|
270
|
+
const defaults = () => ({
|
|
271
|
+
});
|
|
272
|
+
const create = (() => {
|
|
273
|
+
return uniffiCreateRecord<CircomProofResult, ReturnType<typeof defaults>>(defaults);
|
|
274
|
+
})();
|
|
275
|
+
return Object.freeze({
|
|
276
|
+
/**
|
|
277
|
+
* Create a frozen instance of {@link CircomProofResult}, with defaults specified
|
|
278
|
+
* in Rust, in the {@link mopro_umbra_2} crate.
|
|
279
|
+
*/
|
|
280
|
+
create,
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Create a frozen instance of {@link CircomProofResult}, with defaults specified
|
|
284
|
+
* in Rust, in the {@link mopro_umbra_2} crate.
|
|
285
|
+
*/
|
|
286
|
+
new: create,
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Defaults specified in the {@link mopro_umbra_2} crate.
|
|
290
|
+
*/
|
|
291
|
+
defaults: () => Object.freeze(defaults()) as Partial<CircomProofResult>,
|
|
292
|
+
});
|
|
293
|
+
})();
|
|
294
|
+
|
|
295
|
+
const FfiConverterTypeCircomProofResult = (() => {
|
|
296
|
+
type TypeName = CircomProofResult;
|
|
297
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
298
|
+
read(from: RustBuffer): TypeName {
|
|
299
|
+
return {
|
|
300
|
+
proof: FfiConverterTypeCircomProof.read(from),
|
|
301
|
+
inputs: FfiConverterArrayString.read(from)
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
305
|
+
FfiConverterTypeCircomProof.write(value.proof, into);
|
|
306
|
+
FfiConverterArrayString.write(value.inputs, into);
|
|
307
|
+
}
|
|
308
|
+
allocationSize(value: TypeName): number {
|
|
309
|
+
return FfiConverterTypeCircomProof.allocationSize(value.proof) +
|
|
310
|
+
FfiConverterArrayString.allocationSize(value.inputs);
|
|
311
|
+
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
return new FFIConverter();
|
|
315
|
+
})();
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
export type G1 = {
|
|
319
|
+
x: string,
|
|
320
|
+
y: string,
|
|
321
|
+
z: string
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Generated factory for {@link G1} record objects.
|
|
326
|
+
*/
|
|
327
|
+
export const G1 = (() => {
|
|
328
|
+
const defaults = () => ({
|
|
329
|
+
});
|
|
330
|
+
const create = (() => {
|
|
331
|
+
return uniffiCreateRecord<G1, ReturnType<typeof defaults>>(defaults);
|
|
332
|
+
})();
|
|
333
|
+
return Object.freeze({
|
|
334
|
+
/**
|
|
335
|
+
* Create a frozen instance of {@link G1}, with defaults specified
|
|
336
|
+
* in Rust, in the {@link mopro_umbra_2} crate.
|
|
337
|
+
*/
|
|
338
|
+
create,
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Create a frozen instance of {@link G1}, with defaults specified
|
|
342
|
+
* in Rust, in the {@link mopro_umbra_2} crate.
|
|
343
|
+
*/
|
|
344
|
+
new: create,
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Defaults specified in the {@link mopro_umbra_2} crate.
|
|
348
|
+
*/
|
|
349
|
+
defaults: () => Object.freeze(defaults()) as Partial<G1>,
|
|
350
|
+
});
|
|
351
|
+
})();
|
|
352
|
+
|
|
353
|
+
const FfiConverterTypeG1 = (() => {
|
|
354
|
+
type TypeName = G1;
|
|
355
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
356
|
+
read(from: RustBuffer): TypeName {
|
|
357
|
+
return {
|
|
358
|
+
x: FfiConverterString.read(from),
|
|
359
|
+
y: FfiConverterString.read(from),
|
|
360
|
+
z: FfiConverterString.read(from)
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
364
|
+
FfiConverterString.write(value.x, into);
|
|
365
|
+
FfiConverterString.write(value.y, into);
|
|
366
|
+
FfiConverterString.write(value.z, into);
|
|
367
|
+
}
|
|
368
|
+
allocationSize(value: TypeName): number {
|
|
369
|
+
return FfiConverterString.allocationSize(value.x) +
|
|
370
|
+
FfiConverterString.allocationSize(value.y) +
|
|
371
|
+
FfiConverterString.allocationSize(value.z);
|
|
372
|
+
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
return new FFIConverter();
|
|
376
|
+
})();
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
export type G2 = {
|
|
380
|
+
x: Array<string>,
|
|
381
|
+
y: Array<string>,
|
|
382
|
+
z: Array<string>
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* Generated factory for {@link G2} record objects.
|
|
387
|
+
*/
|
|
388
|
+
export const G2 = (() => {
|
|
389
|
+
const defaults = () => ({
|
|
390
|
+
});
|
|
391
|
+
const create = (() => {
|
|
392
|
+
return uniffiCreateRecord<G2, ReturnType<typeof defaults>>(defaults);
|
|
393
|
+
})();
|
|
394
|
+
return Object.freeze({
|
|
395
|
+
/**
|
|
396
|
+
* Create a frozen instance of {@link G2}, with defaults specified
|
|
397
|
+
* in Rust, in the {@link mopro_umbra_2} crate.
|
|
398
|
+
*/
|
|
399
|
+
create,
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* Create a frozen instance of {@link G2}, with defaults specified
|
|
403
|
+
* in Rust, in the {@link mopro_umbra_2} crate.
|
|
404
|
+
*/
|
|
405
|
+
new: create,
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* Defaults specified in the {@link mopro_umbra_2} crate.
|
|
409
|
+
*/
|
|
410
|
+
defaults: () => Object.freeze(defaults()) as Partial<G2>,
|
|
411
|
+
});
|
|
412
|
+
})();
|
|
413
|
+
|
|
414
|
+
const FfiConverterTypeG2 = (() => {
|
|
415
|
+
type TypeName = G2;
|
|
416
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
417
|
+
read(from: RustBuffer): TypeName {
|
|
418
|
+
return {
|
|
419
|
+
x: FfiConverterArrayString.read(from),
|
|
420
|
+
y: FfiConverterArrayString.read(from),
|
|
421
|
+
z: FfiConverterArrayString.read(from)
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
425
|
+
FfiConverterArrayString.write(value.x, into);
|
|
426
|
+
FfiConverterArrayString.write(value.y, into);
|
|
427
|
+
FfiConverterArrayString.write(value.z, into);
|
|
428
|
+
}
|
|
429
|
+
allocationSize(value: TypeName): number {
|
|
430
|
+
return FfiConverterArrayString.allocationSize(value.x) +
|
|
431
|
+
FfiConverterArrayString.allocationSize(value.y) +
|
|
432
|
+
FfiConverterArrayString.allocationSize(value.z);
|
|
433
|
+
|
|
434
|
+
}
|
|
435
|
+
};
|
|
436
|
+
return new FFIConverter();
|
|
437
|
+
})();
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
export type Halo2ProofResult = {
|
|
441
|
+
proof: ArrayBuffer,
|
|
442
|
+
inputs: ArrayBuffer
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* Generated factory for {@link Halo2ProofResult} record objects.
|
|
447
|
+
*/
|
|
448
|
+
export const Halo2ProofResult = (() => {
|
|
449
|
+
const defaults = () => ({
|
|
450
|
+
});
|
|
451
|
+
const create = (() => {
|
|
452
|
+
return uniffiCreateRecord<Halo2ProofResult, ReturnType<typeof defaults>>(defaults);
|
|
453
|
+
})();
|
|
454
|
+
return Object.freeze({
|
|
455
|
+
/**
|
|
456
|
+
* Create a frozen instance of {@link Halo2ProofResult}, with defaults specified
|
|
457
|
+
* in Rust, in the {@link mopro_umbra_2} crate.
|
|
458
|
+
*/
|
|
459
|
+
create,
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* Create a frozen instance of {@link Halo2ProofResult}, with defaults specified
|
|
463
|
+
* in Rust, in the {@link mopro_umbra_2} crate.
|
|
464
|
+
*/
|
|
465
|
+
new: create,
|
|
466
|
+
|
|
467
|
+
/**
|
|
468
|
+
* Defaults specified in the {@link mopro_umbra_2} crate.
|
|
469
|
+
*/
|
|
470
|
+
defaults: () => Object.freeze(defaults()) as Partial<Halo2ProofResult>,
|
|
471
|
+
});
|
|
472
|
+
})();
|
|
473
|
+
|
|
474
|
+
const FfiConverterTypeHalo2ProofResult = (() => {
|
|
475
|
+
type TypeName = Halo2ProofResult;
|
|
476
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
477
|
+
read(from: RustBuffer): TypeName {
|
|
478
|
+
return {
|
|
479
|
+
proof: FfiConverterArrayBuffer.read(from),
|
|
480
|
+
inputs: FfiConverterArrayBuffer.read(from)
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
484
|
+
FfiConverterArrayBuffer.write(value.proof, into);
|
|
485
|
+
FfiConverterArrayBuffer.write(value.inputs, into);
|
|
486
|
+
}
|
|
487
|
+
allocationSize(value: TypeName): number {
|
|
488
|
+
return FfiConverterArrayBuffer.allocationSize(value.proof) +
|
|
489
|
+
FfiConverterArrayBuffer.allocationSize(value.inputs);
|
|
490
|
+
|
|
491
|
+
}
|
|
492
|
+
};
|
|
493
|
+
return new FFIConverter();
|
|
494
|
+
})();
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
const stringConverter = {
|
|
498
|
+
stringToBytes: (s: string) =>
|
|
499
|
+
uniffiCaller.rustCall((status) => nativeModule().ubrn_uniffi_internal_fn_func_ffi__string_to_arraybuffer(s, status)),
|
|
500
|
+
bytesToString: (ab: UniffiByteArray) =>
|
|
501
|
+
uniffiCaller.rustCall((status) => nativeModule().ubrn_uniffi_internal_fn_func_ffi__arraybuffer_to_string(ab, status)),
|
|
502
|
+
stringByteLength: (s: string) =>
|
|
503
|
+
uniffiCaller.rustCall((status) => nativeModule().ubrn_uniffi_internal_fn_func_ffi__string_to_byte_length(s, status)),
|
|
504
|
+
};
|
|
505
|
+
const FfiConverterString = uniffiCreateFfiConverterString(stringConverter);
|
|
506
|
+
|
|
507
|
+
|
|
508
|
+
// Error type: MoproError
|
|
509
|
+
|
|
510
|
+
// Enum: MoproError
|
|
511
|
+
export enum MoproError_Tags {
|
|
512
|
+
CircomError = "CircomError",
|
|
513
|
+
Halo2Error = "Halo2Error",
|
|
514
|
+
NoirError = "NoirError"
|
|
515
|
+
}
|
|
516
|
+
export const MoproError = (() => {
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
type CircomError__interface = {
|
|
520
|
+
tag: MoproError_Tags.CircomError;
|
|
521
|
+
inner: Readonly<
|
|
522
|
+
[string
|
|
523
|
+
]>
|
|
524
|
+
};
|
|
525
|
+
|
|
526
|
+
|
|
527
|
+
class CircomError_ extends UniffiError implements CircomError__interface {
|
|
528
|
+
/**
|
|
529
|
+
* @private
|
|
530
|
+
* This field is private and should not be used, use `tag` instead.
|
|
531
|
+
*/
|
|
532
|
+
readonly [uniffiTypeNameSymbol] = "MoproError";
|
|
533
|
+
readonly tag = MoproError_Tags.CircomError;
|
|
534
|
+
readonly inner: Readonly<
|
|
535
|
+
[string
|
|
536
|
+
]>;
|
|
537
|
+
constructor(v0: string) {
|
|
538
|
+
super("MoproError", "CircomError");
|
|
539
|
+
this.inner = Object.freeze([v0]);
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
static new(v0: string): CircomError_ {
|
|
543
|
+
return new CircomError_(v0);
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
static instanceOf(obj: any): obj is CircomError_ {
|
|
547
|
+
return obj.tag === MoproError_Tags.CircomError;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
|
|
551
|
+
static hasInner(obj: any): obj is CircomError_ {
|
|
552
|
+
return CircomError_.instanceOf(obj);
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
static getInner(obj: CircomError_): Readonly<
|
|
556
|
+
[string
|
|
557
|
+
]> {
|
|
558
|
+
return obj.inner;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
|
|
564
|
+
type Halo2Error__interface = {
|
|
565
|
+
tag: MoproError_Tags.Halo2Error;
|
|
566
|
+
inner: Readonly<
|
|
567
|
+
[string
|
|
568
|
+
]>
|
|
569
|
+
};
|
|
570
|
+
|
|
571
|
+
|
|
572
|
+
class Halo2Error_ extends UniffiError implements Halo2Error__interface {
|
|
573
|
+
/**
|
|
574
|
+
* @private
|
|
575
|
+
* This field is private and should not be used, use `tag` instead.
|
|
576
|
+
*/
|
|
577
|
+
readonly [uniffiTypeNameSymbol] = "MoproError";
|
|
578
|
+
readonly tag = MoproError_Tags.Halo2Error;
|
|
579
|
+
readonly inner: Readonly<
|
|
580
|
+
[string
|
|
581
|
+
]>;
|
|
582
|
+
constructor(v0: string) {
|
|
583
|
+
super("MoproError", "Halo2Error");
|
|
584
|
+
this.inner = Object.freeze([v0]);
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
static new(v0: string): Halo2Error_ {
|
|
588
|
+
return new Halo2Error_(v0);
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
static instanceOf(obj: any): obj is Halo2Error_ {
|
|
592
|
+
return obj.tag === MoproError_Tags.Halo2Error;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
|
|
596
|
+
static hasInner(obj: any): obj is Halo2Error_ {
|
|
597
|
+
return Halo2Error_.instanceOf(obj);
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
static getInner(obj: Halo2Error_): Readonly<
|
|
601
|
+
[string
|
|
602
|
+
]> {
|
|
603
|
+
return obj.inner;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
|
|
609
|
+
type NoirError__interface = {
|
|
610
|
+
tag: MoproError_Tags.NoirError;
|
|
611
|
+
inner: Readonly<
|
|
612
|
+
[string
|
|
613
|
+
]>
|
|
614
|
+
};
|
|
615
|
+
|
|
616
|
+
|
|
617
|
+
class NoirError_ extends UniffiError implements NoirError__interface {
|
|
618
|
+
/**
|
|
619
|
+
* @private
|
|
620
|
+
* This field is private and should not be used, use `tag` instead.
|
|
621
|
+
*/
|
|
622
|
+
readonly [uniffiTypeNameSymbol] = "MoproError";
|
|
623
|
+
readonly tag = MoproError_Tags.NoirError;
|
|
624
|
+
readonly inner: Readonly<
|
|
625
|
+
[string
|
|
626
|
+
]>;
|
|
627
|
+
constructor(v0: string) {
|
|
628
|
+
super("MoproError", "NoirError");
|
|
629
|
+
this.inner = Object.freeze([v0]);
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
static new(v0: string): NoirError_ {
|
|
633
|
+
return new NoirError_(v0);
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
static instanceOf(obj: any): obj is NoirError_ {
|
|
637
|
+
return obj.tag === MoproError_Tags.NoirError;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
|
|
641
|
+
static hasInner(obj: any): obj is NoirError_ {
|
|
642
|
+
return NoirError_.instanceOf(obj);
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
static getInner(obj: NoirError_): Readonly<
|
|
646
|
+
[string
|
|
647
|
+
]> {
|
|
648
|
+
return obj.inner;
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
function instanceOf(obj: any): obj is MoproError {
|
|
654
|
+
return obj[uniffiTypeNameSymbol] === "MoproError";
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
return Object.freeze({
|
|
658
|
+
instanceOf,
|
|
659
|
+
CircomError: CircomError_,
|
|
660
|
+
Halo2Error: Halo2Error_,
|
|
661
|
+
NoirError: NoirError_
|
|
662
|
+
});
|
|
663
|
+
|
|
664
|
+
})();
|
|
665
|
+
|
|
666
|
+
|
|
667
|
+
|
|
668
|
+
export type MoproError = InstanceType<
|
|
669
|
+
typeof MoproError[keyof Omit<typeof MoproError, 'instanceOf'>]
|
|
670
|
+
>;
|
|
671
|
+
|
|
672
|
+
// FfiConverter for enum MoproError
|
|
673
|
+
const FfiConverterTypeMoproError = (() => {
|
|
674
|
+
const ordinalConverter = FfiConverterInt32;
|
|
675
|
+
type TypeName = MoproError;
|
|
676
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
677
|
+
read(from: RustBuffer): TypeName {
|
|
678
|
+
switch (ordinalConverter.read(from)) {
|
|
679
|
+
case 1: return new MoproError.CircomError(FfiConverterString.read(from));
|
|
680
|
+
case 2: return new MoproError.Halo2Error(FfiConverterString.read(from));
|
|
681
|
+
case 3: return new MoproError.NoirError(FfiConverterString.read(from));
|
|
682
|
+
default: throw new UniffiInternalError.UnexpectedEnumCase();
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
686
|
+
switch (value.tag) {
|
|
687
|
+
case MoproError_Tags.CircomError: {
|
|
688
|
+
ordinalConverter.write(1, into);
|
|
689
|
+
const inner = value.inner;
|
|
690
|
+
FfiConverterString.write(inner[0], into);
|
|
691
|
+
return;
|
|
692
|
+
}
|
|
693
|
+
case MoproError_Tags.Halo2Error: {
|
|
694
|
+
ordinalConverter.write(2, into);
|
|
695
|
+
const inner = value.inner;
|
|
696
|
+
FfiConverterString.write(inner[0], into);
|
|
697
|
+
return;
|
|
698
|
+
}
|
|
699
|
+
case MoproError_Tags.NoirError: {
|
|
700
|
+
ordinalConverter.write(3, into);
|
|
701
|
+
const inner = value.inner;
|
|
702
|
+
FfiConverterString.write(inner[0], into);
|
|
703
|
+
return;
|
|
704
|
+
}
|
|
705
|
+
default:
|
|
706
|
+
// Throwing from here means that MoproError_Tags hasn't matched an ordinal.
|
|
707
|
+
throw new UniffiInternalError.UnexpectedEnumCase();
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
allocationSize(value: TypeName): number {
|
|
711
|
+
switch (value.tag) {
|
|
712
|
+
case MoproError_Tags.CircomError: {
|
|
713
|
+
const inner = value.inner;
|
|
714
|
+
let size = ordinalConverter.allocationSize(1);
|
|
715
|
+
size += FfiConverterString.allocationSize(inner[0]);
|
|
716
|
+
return size;
|
|
717
|
+
}
|
|
718
|
+
case MoproError_Tags.Halo2Error: {
|
|
719
|
+
const inner = value.inner;
|
|
720
|
+
let size = ordinalConverter.allocationSize(2);
|
|
721
|
+
size += FfiConverterString.allocationSize(inner[0]);
|
|
722
|
+
return size;
|
|
723
|
+
}
|
|
724
|
+
case MoproError_Tags.NoirError: {
|
|
725
|
+
const inner = value.inner;
|
|
726
|
+
let size = ordinalConverter.allocationSize(3);
|
|
727
|
+
size += FfiConverterString.allocationSize(inner[0]);
|
|
728
|
+
return size;
|
|
729
|
+
}
|
|
730
|
+
default: throw new UniffiInternalError.UnexpectedEnumCase();
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
return new FFIConverter();
|
|
735
|
+
})();
|
|
736
|
+
|
|
737
|
+
|
|
738
|
+
export enum ProofLib {
|
|
739
|
+
Arkworks,
|
|
740
|
+
Rapidsnark
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
const FfiConverterTypeProofLib = (() => {
|
|
744
|
+
const ordinalConverter = FfiConverterInt32;
|
|
745
|
+
type TypeName = ProofLib;
|
|
746
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
747
|
+
read(from: RustBuffer): TypeName {
|
|
748
|
+
switch (ordinalConverter.read(from)) {
|
|
749
|
+
case 1: return ProofLib.Arkworks;
|
|
750
|
+
case 2: return ProofLib.Rapidsnark;
|
|
751
|
+
default: throw new UniffiInternalError.UnexpectedEnumCase();
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
755
|
+
switch (value) {
|
|
756
|
+
case ProofLib.Arkworks: return ordinalConverter.write(1, into);
|
|
757
|
+
case ProofLib.Rapidsnark: return ordinalConverter.write(2, into);
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
allocationSize(value: TypeName): number {
|
|
761
|
+
return ordinalConverter.allocationSize(0);
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
return new FFIConverter();
|
|
765
|
+
})();
|
|
766
|
+
|
|
767
|
+
|
|
768
|
+
|
|
769
|
+
|
|
770
|
+
|
|
771
|
+
// FfiConverter for string | undefined
|
|
772
|
+
const FfiConverterOptionalString = new FfiConverterOptional(FfiConverterString);
|
|
773
|
+
|
|
774
|
+
|
|
775
|
+
// FfiConverter for Array<string>
|
|
776
|
+
const FfiConverterArrayString = new FfiConverterArray(FfiConverterString);
|
|
777
|
+
|
|
778
|
+
|
|
779
|
+
// FfiConverter for Map<string, Array<string>>
|
|
780
|
+
const FfiConverterMapStringArrayString = new FfiConverterMap(FfiConverterString, FfiConverterArrayString);
|
|
781
|
+
|
|
782
|
+
/**
|
|
783
|
+
* This should be called before anything else.
|
|
784
|
+
*
|
|
785
|
+
* It is likely that this is being done for you by the library's `index.ts`.
|
|
786
|
+
*
|
|
787
|
+
* It checks versions of uniffi between when the Rust scaffolding was generated
|
|
788
|
+
* and when the bindings were generated.
|
|
789
|
+
*
|
|
790
|
+
* It also initializes the machinery to enable Rust to talk back to Javascript.
|
|
791
|
+
*/
|
|
792
|
+
function uniffiEnsureInitialized() {
|
|
793
|
+
// Get the bindings contract version from our ComponentInterface
|
|
794
|
+
const bindingsContractVersion = 30;
|
|
795
|
+
// Get the scaffolding contract version by calling the into the dylib
|
|
796
|
+
const scaffoldingContractVersion = nativeModule().ubrn_ffi_mopro_umbra_2_uniffi_contract_version();
|
|
797
|
+
if (bindingsContractVersion !== scaffoldingContractVersion) {
|
|
798
|
+
throw new UniffiInternalError.ContractVersionMismatch(scaffoldingContractVersion, bindingsContractVersion);
|
|
799
|
+
}
|
|
800
|
+
if (nativeModule().ubrn_uniffi_mopro_umbra_2_checksum_func_generate_circom_proof() !== 55464) {
|
|
801
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_mopro_umbra_2_checksum_func_generate_circom_proof");
|
|
802
|
+
}
|
|
803
|
+
if (nativeModule().ubrn_uniffi_mopro_umbra_2_checksum_func_generate_halo2_proof() !== 46845) {
|
|
804
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_mopro_umbra_2_checksum_func_generate_halo2_proof");
|
|
805
|
+
}
|
|
806
|
+
if (nativeModule().ubrn_uniffi_mopro_umbra_2_checksum_func_generate_noir_proof() !== 28401) {
|
|
807
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_mopro_umbra_2_checksum_func_generate_noir_proof");
|
|
808
|
+
}
|
|
809
|
+
if (nativeModule().ubrn_uniffi_mopro_umbra_2_checksum_func_get_noir_verification_key() !== 30991) {
|
|
810
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_mopro_umbra_2_checksum_func_get_noir_verification_key");
|
|
811
|
+
}
|
|
812
|
+
if (nativeModule().ubrn_uniffi_mopro_umbra_2_checksum_func_mopro_hello_world() !== 25559) {
|
|
813
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_mopro_umbra_2_checksum_func_mopro_hello_world");
|
|
814
|
+
}
|
|
815
|
+
if (nativeModule().ubrn_uniffi_mopro_umbra_2_checksum_func_verify_circom_proof() !== 40361) {
|
|
816
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_mopro_umbra_2_checksum_func_verify_circom_proof");
|
|
817
|
+
}
|
|
818
|
+
if (nativeModule().ubrn_uniffi_mopro_umbra_2_checksum_func_verify_halo2_proof() !== 28169) {
|
|
819
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_mopro_umbra_2_checksum_func_verify_halo2_proof");
|
|
820
|
+
}
|
|
821
|
+
if (nativeModule().ubrn_uniffi_mopro_umbra_2_checksum_func_verify_noir_proof() !== 41390) {
|
|
822
|
+
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_mopro_umbra_2_checksum_func_verify_noir_proof");
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
export default Object.freeze({
|
|
828
|
+
initialize: uniffiEnsureInitialized,
|
|
829
|
+
converters: {
|
|
830
|
+
FfiConverterTypeCircomProof,
|
|
831
|
+
FfiConverterTypeCircomProofResult,
|
|
832
|
+
FfiConverterTypeG1,
|
|
833
|
+
FfiConverterTypeG2,
|
|
834
|
+
FfiConverterTypeHalo2ProofResult,
|
|
835
|
+
FfiConverterTypeMoproError,
|
|
836
|
+
FfiConverterTypeProofLib,
|
|
837
|
+
}
|
|
838
|
+
});
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Generated by uniffi-bindgen-react-native
|
|
2
|
+
import installer from './NativeMoproFfi';
|
|
3
|
+
|
|
4
|
+
// Register the rust crate with Hermes
|
|
5
|
+
// - the boolean flag ensures this loads exactly once, even if the JS
|
|
6
|
+
// code is reloaded (e.g. during development with metro).
|
|
7
|
+
let rustInstalled = false;
|
|
8
|
+
if (!rustInstalled) {
|
|
9
|
+
installer.installRustCrate();
|
|
10
|
+
rustInstalled = true;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// Export the generated bindings to the app.
|
|
14
|
+
export * from './generated/mopro_umbra_2';
|
|
15
|
+
|
|
16
|
+
// Now import the bindings so we can:
|
|
17
|
+
// - intialize them
|
|
18
|
+
// - export them as namespaced objects as the default export.
|
|
19
|
+
import * as mopro_umbra_2 from './generated/mopro_umbra_2';
|
|
20
|
+
|
|
21
|
+
// Initialize the generated bindings: mostly checksums, but also callbacks.
|
|
22
|
+
// - the boolean flag ensures this loads exactly once, even if the JS code
|
|
23
|
+
// is reloaded (e.g. during development with metro).
|
|
24
|
+
let initialized = false;
|
|
25
|
+
if (!initialized) {
|
|
26
|
+
mopro_umbra_2.default.initialize();
|
|
27
|
+
initialized = true;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// This provides parity with the index.web.ts version of this file.
|
|
31
|
+
// The web version relies on an asynchronous fetch, which this doesn't
|
|
32
|
+
// need, so we just no-op.
|
|
33
|
+
export async function uniffiInitAsync() {
|
|
34
|
+
// NOOP.
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Export the crates as individually namespaced objects.
|
|
38
|
+
export default {
|
|
39
|
+
mopro_umbra_2,
|
|
40
|
+
};
|
|
41
|
+
|