@baerae/zkap-zkp-react-native 0.1.4 → 0.1.6
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/README.md +24 -1
- package/ZkapReactNative.podspec +42 -0
- package/android/CMakeLists.txt +81 -0
- package/android/build.gradle +111 -14
- package/android/cpp-adapter.cpp +43 -0
- package/android/libs/arm64-v8a/libzkap_uniffi_bindings.so +0 -0
- package/android/libs/x86_64/libzkap_uniffi_bindings.so +0 -0
- package/android/proguard-rules.pro +2 -0
- package/android/src/main/AndroidManifest.xml +5 -0
- package/android/src/main/java/com/baerae/zkapreactnative/ZkapReactNativeModule.kt +51 -0
- package/android/src/main/java/com/baerae/zkapreactnative/ZkapReactNativePackage.kt +34 -0
- package/cpp/baerae-zkap-react-native.cpp +17 -0
- package/cpp/baerae-zkap-react-native.h +15 -0
- package/cpp/generated/zkap_uniffi_bindings.cpp +2154 -0
- package/cpp/generated/zkap_uniffi_bindings.hpp +66 -0
- package/ios/ZkapReactNative.h +16 -0
- package/ios/ZkapReactNative.mm +412 -0
- package/ios/ZkapZkp.xcframework/Info.plist +5 -5
- package/ios/ZkapZkp.xcframework/ios-arm64/libzkap_uniffi_bindings.a +0 -0
- package/ios/ZkapZkp.xcframework/ios-arm64_x86_64-simulator/libzkap_uniffi_bindings.a +0 -0
- package/package.json +37 -14
- package/src/NativeZkapReactNative.ts +11 -0
- package/src/generated/zkap_uniffi_bindings-ffi.ts +150 -0
- package/src/generated/zkap_uniffi_bindings.ts +1015 -0
- package/src/index.ts +250 -46
- package/ubrn.config.yaml +13 -0
- package/android/libs/armeabi-v7a/libzkap_uniffi_bindings.so +0 -0
- package/android/src/main/java/expo/modules/zkap/ZkapSdkModule.kt +0 -153
- package/android/src/main/java/uniffi/zkap_uniffi_bindings/zkap_uniffi_bindings.kt +0 -1566
- package/expo-module.config.json +0 -9
- package/ios/ZkapSdkModule.podspec +0 -35
- package/ios/ZkapSdkModule.swift +0 -147
- package/ios/uniffi/zkap_uniffi_bindings.swift +0 -1174
- package/ios/uniffi/zkap_uniffi_bindingsFFI.h +0 -567
- package/ios/uniffi/zkap_uniffi_bindingsFFI.modulemap +0 -7
|
@@ -0,0 +1,150 @@
|
|
|
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 UniffiGcObject,
|
|
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_zkap_uniffi_bindings_fn_func_generate_anchor(config: Uint8Array, secrets: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
|
|
22
|
+
ubrn_uniffi_zkap_uniffi_bindings_fn_func_generate_aud_hash(config: Uint8Array, audList: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
|
|
23
|
+
ubrn_uniffi_zkap_uniffi_bindings_fn_func_generate_hash(messages: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
|
|
24
|
+
ubrn_uniffi_zkap_uniffi_bindings_fn_func_generate_leaf_hash(config: Uint8Array, iss: Uint8Array, pkB64: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
|
|
25
|
+
ubrn_uniffi_zkap_uniffi_bindings_fn_func_prepare_witness_inputs(config: Uint8Array, request: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
|
|
26
|
+
ubrn_uniffi_zkap_uniffi_bindings_fn_func_prove(config: Uint8Array, request: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
|
|
27
|
+
ubrn_uniffi_zkap_uniffi_bindings_fn_func_prove_from_witness_bundle_file(config: Uint8Array, request: Uint8Array, witness: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
|
|
28
|
+
ubrn_uniffi_zkap_uniffi_bindings_fn_func_prove_from_witness_bundles(config: Uint8Array, request: Uint8Array, witness: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
|
|
29
|
+
ubrn_uniffi_zkap_uniffi_bindings_checksum_func_generate_anchor(): number;
|
|
30
|
+
ubrn_uniffi_zkap_uniffi_bindings_checksum_func_generate_aud_hash(): number;
|
|
31
|
+
ubrn_uniffi_zkap_uniffi_bindings_checksum_func_generate_hash(): number;
|
|
32
|
+
ubrn_uniffi_zkap_uniffi_bindings_checksum_func_generate_leaf_hash(): number;
|
|
33
|
+
ubrn_uniffi_zkap_uniffi_bindings_checksum_func_prepare_witness_inputs(): number;
|
|
34
|
+
ubrn_uniffi_zkap_uniffi_bindings_checksum_func_prove(): number;
|
|
35
|
+
ubrn_uniffi_zkap_uniffi_bindings_checksum_func_prove_from_witness_bundle_file(): number;
|
|
36
|
+
ubrn_uniffi_zkap_uniffi_bindings_checksum_func_prove_from_witness_bundles(): number;
|
|
37
|
+
ubrn_ffi_zkap_uniffi_bindings_uniffi_contract_version(): number;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Casting globalThis to any allows us to look for `NativeZkapUniffiBindings`
|
|
41
|
+
// if it was added via JSI.
|
|
42
|
+
//
|
|
43
|
+
// We use a getter here rather than simply `globalThis.NativeZkapUniffiBindings` 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).NativeZkapUniffiBindings;
|
|
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
|
+
export type UniffiForeignFutureDroppedCallback = (handle: bigint) => void;
|
|
51
|
+
type UniffiCallbackInterfaceFree = (handle: bigint) => void;
|
|
52
|
+
type UniffiCallbackInterfaceClone = (handle: bigint) => UniffiResult<void>
|
|
53
|
+
;
|
|
54
|
+
export type UniffiForeignFutureDroppedCallbackStruct = {
|
|
55
|
+
handle: bigint;
|
|
56
|
+
free: UniffiForeignFutureDroppedCallback;
|
|
57
|
+
};
|
|
58
|
+
export type UniffiForeignFutureResultU8 = {
|
|
59
|
+
returnValue: number;
|
|
60
|
+
callStatus: UniffiRustCallStatus;
|
|
61
|
+
};
|
|
62
|
+
export type UniffiForeignFutureCompleteU8 = (callbackData: bigint, result: UniffiForeignFutureResultU8) => void;
|
|
63
|
+
export type UniffiForeignFutureResultI8 = {
|
|
64
|
+
returnValue: number;
|
|
65
|
+
callStatus: UniffiRustCallStatus;
|
|
66
|
+
};
|
|
67
|
+
export type UniffiForeignFutureCompleteI8 = (callbackData: bigint, result: UniffiForeignFutureResultI8) => void;
|
|
68
|
+
export type UniffiForeignFutureResultU16 = {
|
|
69
|
+
returnValue: number;
|
|
70
|
+
callStatus: UniffiRustCallStatus;
|
|
71
|
+
};
|
|
72
|
+
export type UniffiForeignFutureCompleteU16 = (callbackData: bigint, result: UniffiForeignFutureResultU16) => void;
|
|
73
|
+
export type UniffiForeignFutureResultI16 = {
|
|
74
|
+
returnValue: number;
|
|
75
|
+
callStatus: UniffiRustCallStatus;
|
|
76
|
+
};
|
|
77
|
+
export type UniffiForeignFutureCompleteI16 = (callbackData: bigint, result: UniffiForeignFutureResultI16) => void;
|
|
78
|
+
export type UniffiForeignFutureResultU32 = {
|
|
79
|
+
returnValue: number;
|
|
80
|
+
callStatus: UniffiRustCallStatus;
|
|
81
|
+
};
|
|
82
|
+
export type UniffiForeignFutureCompleteU32 = (callbackData: bigint, result: UniffiForeignFutureResultU32) => void;
|
|
83
|
+
export type UniffiForeignFutureResultI32 = {
|
|
84
|
+
returnValue: number;
|
|
85
|
+
callStatus: UniffiRustCallStatus;
|
|
86
|
+
};
|
|
87
|
+
export type UniffiForeignFutureCompleteI32 = (callbackData: bigint, result: UniffiForeignFutureResultI32) => void;
|
|
88
|
+
export type UniffiForeignFutureResultU64 = {
|
|
89
|
+
returnValue: bigint;
|
|
90
|
+
callStatus: UniffiRustCallStatus;
|
|
91
|
+
};
|
|
92
|
+
export type UniffiForeignFutureCompleteU64 = (callbackData: bigint, result: UniffiForeignFutureResultU64) => void;
|
|
93
|
+
export type UniffiForeignFutureResultI64 = {
|
|
94
|
+
returnValue: bigint;
|
|
95
|
+
callStatus: UniffiRustCallStatus;
|
|
96
|
+
};
|
|
97
|
+
export type UniffiForeignFutureCompleteI64 = (callbackData: bigint, result: UniffiForeignFutureResultI64) => void;
|
|
98
|
+
export type UniffiForeignFutureResultF32 = {
|
|
99
|
+
returnValue: number;
|
|
100
|
+
callStatus: UniffiRustCallStatus;
|
|
101
|
+
};
|
|
102
|
+
export type UniffiForeignFutureCompleteF32 = (callbackData: bigint, result: UniffiForeignFutureResultF32) => void;
|
|
103
|
+
export type UniffiForeignFutureResultF64 = {
|
|
104
|
+
returnValue: number;
|
|
105
|
+
callStatus: UniffiRustCallStatus;
|
|
106
|
+
};
|
|
107
|
+
export type UniffiForeignFutureCompleteF64 = (callbackData: bigint, result: UniffiForeignFutureResultF64) => void;
|
|
108
|
+
export type UniffiForeignFutureResultRustBuffer = {
|
|
109
|
+
returnValue: Uint8Array;
|
|
110
|
+
callStatus: UniffiRustCallStatus;
|
|
111
|
+
};
|
|
112
|
+
export type UniffiForeignFutureCompleteRustBuffer = (callbackData: bigint, result: UniffiForeignFutureResultRustBuffer) => void;
|
|
113
|
+
export type UniffiForeignFutureResultVoid = {
|
|
114
|
+
callStatus: UniffiRustCallStatus;
|
|
115
|
+
};
|
|
116
|
+
export type UniffiForeignFutureCompleteVoid = (callbackData: bigint, result: UniffiForeignFutureResultVoid) => void;
|
|
117
|
+
|
|
118
|
+
// UniffiRustFutureContinuationCallback is generated as part of the component interface's
|
|
119
|
+
// ffi_definitions. However, we need it in the runtime.
|
|
120
|
+
// We could:
|
|
121
|
+
// (a) do some complicated template logic to ensure the declaration is not generated here (possible)
|
|
122
|
+
// (b) import the generated declaration into the runtime (m a y b e) or…
|
|
123
|
+
// (c) generate the declaration anyway, and use a different declaration in the runtime.
|
|
124
|
+
//
|
|
125
|
+
// We chose (c) here as the simplest. In addition, we perform a compile time check that
|
|
126
|
+
// the two versions of `UniffiRustFutureContinuationCallback` are structurally equivalent.
|
|
127
|
+
//
|
|
128
|
+
// If you see the error:
|
|
129
|
+
// ```
|
|
130
|
+
// Type 'true' is not assignable to type 'false'.(2322)
|
|
131
|
+
// ```
|
|
132
|
+
// Then a new version of uniffi has changed the signature of the callback. Most likely, code in
|
|
133
|
+
// `typescript/src/async-rust-call.ts` will need to be changed.
|
|
134
|
+
//
|
|
135
|
+
// If you see the error:
|
|
136
|
+
// ```
|
|
137
|
+
// Cannot find name 'UniffiRustFutureContinuationCallback'. Did you mean 'RuntimeUniffiRustFutureContinuationCallback'?(2552)
|
|
138
|
+
// ```
|
|
139
|
+
// then you may not be using callbacks or promises, and uniffi is now not generating Futures and callbacks.
|
|
140
|
+
// You should not generate this if that is the case.
|
|
141
|
+
//
|
|
142
|
+
// ('You' being the bindings generator maintainer).
|
|
143
|
+
const isRustFutureContinuationCallbackTypeCompatible: UniffiStructuralEquality<
|
|
144
|
+
RuntimeUniffiRustFutureContinuationCallback,
|
|
145
|
+
UniffiRustFutureContinuationCallback
|
|
146
|
+
> = true;
|
|
147
|
+
const isUniffiForeignFutureTypeCompatible: UniffiStructuralEquality<
|
|
148
|
+
RuntimeUniffiForeignFuture,
|
|
149
|
+
UniffiForeignFuture
|
|
150
|
+
> = true;
|