@succinctlabs/react-native-zcam1 0.2.7 → 0.4.0-alpha.1

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.
Files changed (127) hide show
  1. package/Zcam1Sdk.podspec +2 -2
  2. package/android/CMakeLists.txt +114 -0
  3. package/android/build.gradle +213 -0
  4. package/android/cpp-adapter-proving.cpp +35 -0
  5. package/android/cpp-adapter.cpp +35 -0
  6. package/android/src/main/AndroidManifest.xml +5 -0
  7. package/android/src/main/java/com/succinctlabs/zcam1sdk/Zcam1CaptureModule.kt +156 -0
  8. package/android/src/main/java/com/succinctlabs/zcam1sdk/Zcam1CapturePackage.kt +38 -0
  9. package/android/src/main/java/com/succinctlabs/zcam1sdk/Zcam1ProvingModule.kt +43 -0
  10. package/android/src/main/java/com/succinctlabs/zcam1sdk/Zcam1ProvingPackage.kt +34 -0
  11. package/android/src/main/java/com/succinctlabs/zcam1sdk/Zcam1SdkModule.kt +43 -0
  12. package/android/src/main/java/com/succinctlabs/zcam1sdk/Zcam1SdkPackage.kt +34 -0
  13. package/android/src/main/java/com/succinctlabs/zcam1sdk/camera/CameraUtils.kt +80 -0
  14. package/android/src/main/java/com/succinctlabs/zcam1sdk/camera/Zcam1CameraService.kt +588 -0
  15. package/android/src/main/java/com/succinctlabs/zcam1sdk/camera/Zcam1CameraView.kt +107 -0
  16. package/android/src/main/java/com/succinctlabs/zcam1sdk/camera/Zcam1CameraViewManager.kt +33 -0
  17. package/android/src/main/java/com/succinctlabs/zcam1sdk/camera/Zcam1OrientationManager.kt +73 -0
  18. package/cpp/generated/zcam1_c2pa_utils.cpp +170 -365
  19. package/cpp/generated/zcam1_c2pa_utils.hpp +0 -4
  20. package/cpp/generated/zcam1_certs_utils.cpp +121 -250
  21. package/cpp/generated/zcam1_common.cpp +1871 -0
  22. package/cpp/generated/zcam1_common.hpp +52 -0
  23. package/cpp/generated/zcam1_verify_utils.cpp +138 -265
  24. package/cpp/generated/zcam1_verify_utils.hpp +2 -2
  25. package/cpp/proving/generated/zcam1_common.cpp +1871 -0
  26. package/cpp/proving/generated/zcam1_common.hpp +52 -0
  27. package/cpp/proving/generated/zcam1_proving_utils.cpp +355 -417
  28. package/cpp/proving/generated/zcam1_proving_utils.hpp +13 -17
  29. package/cpp/proving/zcam1-proving.cpp +2 -0
  30. package/cpp/zcam1-sdk.cpp +2 -0
  31. package/lib/module/bindings.js +4 -0
  32. package/lib/module/bindings.js.map +1 -1
  33. package/lib/module/camera.js +71 -13
  34. package/lib/module/camera.js.map +1 -1
  35. package/lib/module/capture.js +115 -38
  36. package/lib/module/capture.js.map +1 -1
  37. package/lib/module/common.js +18 -2
  38. package/lib/module/common.js.map +1 -1
  39. package/lib/module/generated/zcam1_c2pa_utils-ffi.js +4 -0
  40. package/lib/module/generated/zcam1_c2pa_utils-ffi.js.map +1 -1
  41. package/lib/module/generated/zcam1_c2pa_utils.js +117 -9
  42. package/lib/module/generated/zcam1_c2pa_utils.js.map +1 -1
  43. package/lib/module/generated/zcam1_certs_utils-ffi.js +4 -0
  44. package/lib/module/generated/zcam1_certs_utils-ffi.js.map +1 -1
  45. package/lib/module/generated/zcam1_certs_utils.js +6 -2
  46. package/lib/module/generated/zcam1_certs_utils.js.map +1 -1
  47. package/lib/module/generated/zcam1_common-ffi.js +47 -0
  48. package/lib/module/generated/zcam1_common-ffi.js.map +1 -0
  49. package/lib/module/generated/zcam1_common.js +60 -0
  50. package/lib/module/generated/zcam1_common.js.map +1 -0
  51. package/lib/module/generated/zcam1_proving_utils-ffi.js +4 -0
  52. package/lib/module/generated/zcam1_proving_utils-ffi.js.map +1 -1
  53. package/lib/module/generated/zcam1_proving_utils.js +53 -46
  54. package/lib/module/generated/zcam1_proving_utils.js.map +1 -1
  55. package/lib/module/generated/zcam1_verify_utils-ffi.js +4 -0
  56. package/lib/module/generated/zcam1_verify_utils-ffi.js.map +1 -1
  57. package/lib/module/generated/zcam1_verify_utils.js +70 -22
  58. package/lib/module/generated/zcam1_verify_utils.js.map +1 -1
  59. package/lib/module/index.js +1 -1
  60. package/lib/module/index.js.map +1 -1
  61. package/lib/module/proving/NativeZcam1Proving.js +1 -1
  62. package/lib/module/proving/index.js +1 -1
  63. package/lib/module/proving/index.js.map +1 -1
  64. package/lib/module/proving/prove.js +14 -8
  65. package/lib/module/proving/prove.js.map +1 -1
  66. package/lib/module/utils.js +19 -14
  67. package/lib/module/utils.js.map +1 -1
  68. package/lib/module/verify.js +14 -22
  69. package/lib/module/verify.js.map +1 -1
  70. package/lib/typescript/src/bindings.d.ts +3 -0
  71. package/lib/typescript/src/bindings.d.ts.map +1 -1
  72. package/lib/typescript/src/camera.d.ts +15 -0
  73. package/lib/typescript/src/camera.d.ts.map +1 -1
  74. package/lib/typescript/src/capture.d.ts +40 -1
  75. package/lib/typescript/src/capture.d.ts.map +1 -1
  76. package/lib/typescript/src/common.d.ts.map +1 -1
  77. package/lib/typescript/src/generated/zcam1_c2pa_utils-ffi.d.ts +37 -46
  78. package/lib/typescript/src/generated/zcam1_c2pa_utils-ffi.d.ts.map +1 -1
  79. package/lib/typescript/src/generated/zcam1_c2pa_utils.d.ts +110 -8
  80. package/lib/typescript/src/generated/zcam1_c2pa_utils.d.ts.map +1 -1
  81. package/lib/typescript/src/generated/zcam1_certs_utils-ffi.d.ts +27 -32
  82. package/lib/typescript/src/generated/zcam1_certs_utils-ffi.d.ts.map +1 -1
  83. package/lib/typescript/src/generated/zcam1_certs_utils.d.ts.map +1 -1
  84. package/lib/typescript/src/generated/zcam1_common-ffi.d.ts +77 -0
  85. package/lib/typescript/src/generated/zcam1_common-ffi.d.ts.map +1 -0
  86. package/lib/typescript/src/generated/zcam1_common.d.ts +17 -0
  87. package/lib/typescript/src/generated/zcam1_common.d.ts.map +1 -0
  88. package/lib/typescript/src/generated/zcam1_proving_utils-ffi.d.ts +44 -51
  89. package/lib/typescript/src/generated/zcam1_proving_utils-ffi.d.ts.map +1 -1
  90. package/lib/typescript/src/generated/zcam1_proving_utils.d.ts +26 -26
  91. package/lib/typescript/src/generated/zcam1_proving_utils.d.ts.map +1 -1
  92. package/lib/typescript/src/generated/zcam1_verify_utils-ffi.d.ts +29 -34
  93. package/lib/typescript/src/generated/zcam1_verify_utils-ffi.d.ts.map +1 -1
  94. package/lib/typescript/src/generated/zcam1_verify_utils.d.ts +94 -14
  95. package/lib/typescript/src/generated/zcam1_verify_utils.d.ts.map +1 -1
  96. package/lib/typescript/src/index.d.ts +1 -1
  97. package/lib/typescript/src/index.d.ts.map +1 -1
  98. package/lib/typescript/src/proving/NativeZcam1Proving.d.ts +1 -1
  99. package/lib/typescript/src/proving/index.d.ts +1 -1
  100. package/lib/typescript/src/proving/index.d.ts.map +1 -1
  101. package/lib/typescript/src/proving/prove.d.ts +3 -3
  102. package/lib/typescript/src/proving/prove.d.ts.map +1 -1
  103. package/lib/typescript/src/utils.d.ts.map +1 -1
  104. package/lib/typescript/src/verify.d.ts +4 -3
  105. package/lib/typescript/src/verify.d.ts.map +1 -1
  106. package/package.json +13 -6
  107. package/react-native.config.js +11 -0
  108. package/src/bindings.tsx +4 -0
  109. package/src/camera.tsx +116 -11
  110. package/src/capture.tsx +150 -53
  111. package/src/common.tsx +22 -2
  112. package/src/generated/zcam1_c2pa_utils-ffi.ts +42 -56
  113. package/src/generated/zcam1_c2pa_utils.ts +224 -67
  114. package/src/generated/zcam1_certs_utils-ffi.ts +33 -36
  115. package/src/generated/zcam1_certs_utils.ts +27 -24
  116. package/src/generated/zcam1_common-ffi.ts +183 -0
  117. package/src/generated/zcam1_common.ts +116 -0
  118. package/src/generated/zcam1_proving_utils-ffi.ts +54 -67
  119. package/src/generated/zcam1_proving_utils.ts +133 -138
  120. package/src/generated/zcam1_verify_utils-ffi.ts +39 -40
  121. package/src/generated/zcam1_verify_utils.ts +109 -47
  122. package/src/index.ts +1 -1
  123. package/src/proving/NativeZcam1Proving.ts +2 -2
  124. package/src/proving/index.ts +1 -1
  125. package/src/proving/prove.tsx +22 -11
  126. package/src/utils.ts +26 -20
  127. package/src/verify.tsx +25 -42
@@ -1,11 +1,15 @@
1
1
  // This file was autogenerated by some hot garbage in the `uniffi-bindgen-react-native` crate.
2
2
  // Trust me, you don't want to mess with it!
3
3
 
4
+ /* tslint:disable */
5
+ /* eslint-disable */
6
+ // @ts-nocheck
7
+
4
8
  import {
5
9
  type StructuralEquality as UniffiStructuralEquality,
6
10
  type UniffiForeignFuture as RuntimeUniffiForeignFuture,
7
11
  type UniffiRustCallStatus,
8
- type UniffiRustArcPtr,
12
+ type UniffiGcObject,
9
13
  type UniffiRustFutureContinuationCallback as RuntimeUniffiRustFutureContinuationCallback,
10
14
  type UniffiResult,
11
15
  } from "uniffi-bindgen-react-native";
@@ -30,14 +34,16 @@ interface NativeModuleInterface {
30
34
  production: number,
31
35
  uniffi_out_err: UniffiRustCallStatus,
32
36
  ): number;
33
- ubrn_uniffi_zcam1_verify_utils_fn_func_verify_groth16(
37
+ ubrn_uniffi_zcam1_verify_utils_fn_func_verify_proof_from_manifest(
34
38
  proof: Uint8Array,
35
- publicInputs: Uint8Array,
36
- sp1VkHash: Uint8Array,
39
+ vkHash: Uint8Array,
40
+ photoHash: Uint8Array,
41
+ appId: Uint8Array,
42
+ platform: Uint8Array,
37
43
  uniffi_out_err: UniffiRustCallStatus,
38
44
  ): number;
39
45
  ubrn_uniffi_zcam1_verify_utils_checksum_func_verify_bindings_from_manifest(): number;
40
- ubrn_uniffi_zcam1_verify_utils_checksum_func_verify_groth16(): number;
46
+ ubrn_uniffi_zcam1_verify_utils_checksum_func_verify_proof_from_manifest(): number;
41
47
  ubrn_ffi_zcam1_verify_utils_uniffi_contract_version(): number;
42
48
  }
43
49
 
@@ -51,114 +57,107 @@ export default getter;
51
57
 
52
58
  // Structs and function types for calling back into Typescript from Rust.
53
59
  export type UniffiRustFutureContinuationCallback = (data: bigint, pollResult: number) => void;
54
- type UniffiForeignFutureFree = (handle: bigint) => void;
60
+ export type UniffiForeignFutureDroppedCallback = (handle: bigint) => void;
55
61
  type UniffiCallbackInterfaceFree = (handle: bigint) => void;
56
- export type UniffiForeignFuture = {
62
+ type UniffiCallbackInterfaceClone = (handle: bigint) => UniffiResult<void>;
63
+ export type UniffiForeignFutureDroppedCallbackStruct = {
57
64
  handle: bigint;
58
- free: UniffiForeignFutureFree;
65
+ free: UniffiForeignFutureDroppedCallback;
59
66
  };
60
- export type UniffiForeignFutureStructU8 = {
67
+ export type UniffiForeignFutureResultU8 = {
61
68
  returnValue: number;
62
69
  callStatus: UniffiRustCallStatus;
63
70
  };
64
71
  export type UniffiForeignFutureCompleteU8 = (
65
72
  callbackData: bigint,
66
- result: UniffiForeignFutureStructU8,
73
+ result: UniffiForeignFutureResultU8,
67
74
  ) => void;
68
- export type UniffiForeignFutureStructI8 = {
75
+ export type UniffiForeignFutureResultI8 = {
69
76
  returnValue: number;
70
77
  callStatus: UniffiRustCallStatus;
71
78
  };
72
79
  export type UniffiForeignFutureCompleteI8 = (
73
80
  callbackData: bigint,
74
- result: UniffiForeignFutureStructI8,
81
+ result: UniffiForeignFutureResultI8,
75
82
  ) => void;
76
- export type UniffiForeignFutureStructU16 = {
83
+ export type UniffiForeignFutureResultU16 = {
77
84
  returnValue: number;
78
85
  callStatus: UniffiRustCallStatus;
79
86
  };
80
87
  export type UniffiForeignFutureCompleteU16 = (
81
88
  callbackData: bigint,
82
- result: UniffiForeignFutureStructU16,
89
+ result: UniffiForeignFutureResultU16,
83
90
  ) => void;
84
- export type UniffiForeignFutureStructI16 = {
91
+ export type UniffiForeignFutureResultI16 = {
85
92
  returnValue: number;
86
93
  callStatus: UniffiRustCallStatus;
87
94
  };
88
95
  export type UniffiForeignFutureCompleteI16 = (
89
96
  callbackData: bigint,
90
- result: UniffiForeignFutureStructI16,
97
+ result: UniffiForeignFutureResultI16,
91
98
  ) => void;
92
- export type UniffiForeignFutureStructU32 = {
99
+ export type UniffiForeignFutureResultU32 = {
93
100
  returnValue: number;
94
101
  callStatus: UniffiRustCallStatus;
95
102
  };
96
103
  export type UniffiForeignFutureCompleteU32 = (
97
104
  callbackData: bigint,
98
- result: UniffiForeignFutureStructU32,
105
+ result: UniffiForeignFutureResultU32,
99
106
  ) => void;
100
- export type UniffiForeignFutureStructI32 = {
107
+ export type UniffiForeignFutureResultI32 = {
101
108
  returnValue: number;
102
109
  callStatus: UniffiRustCallStatus;
103
110
  };
104
111
  export type UniffiForeignFutureCompleteI32 = (
105
112
  callbackData: bigint,
106
- result: UniffiForeignFutureStructI32,
113
+ result: UniffiForeignFutureResultI32,
107
114
  ) => void;
108
- export type UniffiForeignFutureStructU64 = {
115
+ export type UniffiForeignFutureResultU64 = {
109
116
  returnValue: bigint;
110
117
  callStatus: UniffiRustCallStatus;
111
118
  };
112
119
  export type UniffiForeignFutureCompleteU64 = (
113
120
  callbackData: bigint,
114
- result: UniffiForeignFutureStructU64,
121
+ result: UniffiForeignFutureResultU64,
115
122
  ) => void;
116
- export type UniffiForeignFutureStructI64 = {
123
+ export type UniffiForeignFutureResultI64 = {
117
124
  returnValue: bigint;
118
125
  callStatus: UniffiRustCallStatus;
119
126
  };
120
127
  export type UniffiForeignFutureCompleteI64 = (
121
128
  callbackData: bigint,
122
- result: UniffiForeignFutureStructI64,
129
+ result: UniffiForeignFutureResultI64,
123
130
  ) => void;
124
- export type UniffiForeignFutureStructF32 = {
131
+ export type UniffiForeignFutureResultF32 = {
125
132
  returnValue: number;
126
133
  callStatus: UniffiRustCallStatus;
127
134
  };
128
135
  export type UniffiForeignFutureCompleteF32 = (
129
136
  callbackData: bigint,
130
- result: UniffiForeignFutureStructF32,
137
+ result: UniffiForeignFutureResultF32,
131
138
  ) => void;
132
- export type UniffiForeignFutureStructF64 = {
139
+ export type UniffiForeignFutureResultF64 = {
133
140
  returnValue: number;
134
141
  callStatus: UniffiRustCallStatus;
135
142
  };
136
143
  export type UniffiForeignFutureCompleteF64 = (
137
144
  callbackData: bigint,
138
- result: UniffiForeignFutureStructF64,
139
- ) => void;
140
- export type UniffiForeignFutureStructPointer = {
141
- returnValue: bigint;
142
- callStatus: UniffiRustCallStatus;
143
- };
144
- export type UniffiForeignFutureCompletePointer = (
145
- callbackData: bigint,
146
- result: UniffiForeignFutureStructPointer,
145
+ result: UniffiForeignFutureResultF64,
147
146
  ) => void;
148
- export type UniffiForeignFutureStructRustBuffer = {
147
+ export type UniffiForeignFutureResultRustBuffer = {
149
148
  returnValue: Uint8Array;
150
149
  callStatus: UniffiRustCallStatus;
151
150
  };
152
151
  export type UniffiForeignFutureCompleteRustBuffer = (
153
152
  callbackData: bigint,
154
- result: UniffiForeignFutureStructRustBuffer,
153
+ result: UniffiForeignFutureResultRustBuffer,
155
154
  ) => void;
156
- export type UniffiForeignFutureStructVoid = {
155
+ export type UniffiForeignFutureResultVoid = {
157
156
  callStatus: UniffiRustCallStatus;
158
157
  };
159
158
  export type UniffiForeignFutureCompleteVoid = (
160
159
  callbackData: bigint,
161
- result: UniffiForeignFutureStructVoid,
160
+ result: UniffiForeignFutureResultVoid,
162
161
  ) => void;
163
162
 
164
163
  // UniffiRustFutureContinuationCallback is generated as part of the component interface's
@@ -1,33 +1,36 @@
1
1
  // This file was autogenerated by some hot garbage in the `uniffi-bindgen-react-native` crate.
2
2
  // Trust me, you don't want to mess with it!
3
+
4
+ /* tslint:disable */
5
+ /* eslint-disable */
6
+ // @ts-nocheck
3
7
  import nativeModule, {
4
8
  type UniffiRustFutureContinuationCallback,
5
- type UniffiForeignFuture,
6
- type UniffiForeignFutureStructU8,
9
+ type UniffiForeignFutureDroppedCallback,
10
+ type UniffiForeignFutureDroppedCallbackStruct,
11
+ type UniffiForeignFutureResultU8,
7
12
  type UniffiForeignFutureCompleteU8,
8
- type UniffiForeignFutureStructI8,
13
+ type UniffiForeignFutureResultI8,
9
14
  type UniffiForeignFutureCompleteI8,
10
- type UniffiForeignFutureStructU16,
15
+ type UniffiForeignFutureResultU16,
11
16
  type UniffiForeignFutureCompleteU16,
12
- type UniffiForeignFutureStructI16,
17
+ type UniffiForeignFutureResultI16,
13
18
  type UniffiForeignFutureCompleteI16,
14
- type UniffiForeignFutureStructU32,
19
+ type UniffiForeignFutureResultU32,
15
20
  type UniffiForeignFutureCompleteU32,
16
- type UniffiForeignFutureStructI32,
21
+ type UniffiForeignFutureResultI32,
17
22
  type UniffiForeignFutureCompleteI32,
18
- type UniffiForeignFutureStructU64,
23
+ type UniffiForeignFutureResultU64,
19
24
  type UniffiForeignFutureCompleteU64,
20
- type UniffiForeignFutureStructI64,
25
+ type UniffiForeignFutureResultI64,
21
26
  type UniffiForeignFutureCompleteI64,
22
- type UniffiForeignFutureStructF32,
27
+ type UniffiForeignFutureResultF32,
23
28
  type UniffiForeignFutureCompleteF32,
24
- type UniffiForeignFutureStructF64,
29
+ type UniffiForeignFutureResultF64,
25
30
  type UniffiForeignFutureCompleteF64,
26
- type UniffiForeignFutureStructPointer,
27
- type UniffiForeignFutureCompletePointer,
28
- type UniffiForeignFutureStructRustBuffer,
31
+ type UniffiForeignFutureResultRustBuffer,
29
32
  type UniffiForeignFutureCompleteRustBuffer,
30
- type UniffiForeignFutureStructVoid,
33
+ type UniffiForeignFutureResultVoid,
31
34
  type UniffiForeignFutureCompleteVoid,
32
35
  } from "./zcam1_verify_utils-ffi";
33
36
  import { type DeviceBindings } from "./zcam1_c2pa_utils";
@@ -59,6 +62,9 @@ const uniffiIsDebug =
59
62
  false;
60
63
  // Public interface members begin here.
61
64
 
65
+ /**
66
+ * Verify Apple App Attest bindings from a C2PA manifest.
67
+ */
62
68
  export function verifyBindingsFromManifest(
63
69
  bindings: DeviceBindings,
64
70
  normalizedMetadata: string,
@@ -81,24 +87,23 @@ export function verifyBindingsFromManifest(
81
87
  ),
82
88
  );
83
89
  }
84
- /**
85
- * Wrapper around [`sp1_verifier::Groth16Verifier::verify`].
86
- *
87
- * We hardcode the Groth16 VK bytes to only verify SP1 proofs.
88
- */
89
- export function verifyGroth16(
90
+ export function verifyProofFromManifest(
90
91
  proof: ArrayBuffer,
91
- publicInputs: ArrayBuffer,
92
- sp1VkHash: string,
92
+ vkHash: string,
93
+ photoHash: ArrayBuffer,
94
+ appId: string,
95
+ platform: string,
93
96
  ): boolean /*throws*/ {
94
97
  return FfiConverterBool.lift(
95
98
  uniffiCaller.rustCallWithError(
96
99
  /*liftError:*/ FfiConverterTypeVerifyError.lift.bind(FfiConverterTypeVerifyError),
97
100
  /*caller:*/ (callStatus) => {
98
- return nativeModule().ubrn_uniffi_zcam1_verify_utils_fn_func_verify_groth16(
101
+ return nativeModule().ubrn_uniffi_zcam1_verify_utils_fn_func_verify_proof_from_manifest(
99
102
  FfiConverterArrayBuffer.lower(proof),
100
- FfiConverterArrayBuffer.lower(publicInputs),
101
- FfiConverterString.lower(sp1VkHash),
103
+ FfiConverterString.lower(vkHash),
104
+ FfiConverterArrayBuffer.lower(photoHash),
105
+ FfiConverterString.lower(appId),
106
+ FfiConverterString.lower(platform),
102
107
  callStatus,
103
108
  );
104
109
  },
@@ -127,10 +132,12 @@ const FfiConverterString = uniffiCreateFfiConverterString(stringConverter);
127
132
  export enum VerifyError_Tags {
128
133
  C2pa = "C2pa",
129
134
  AppAttest = "AppAttest",
135
+ AndroidAttestation = "AndroidAttestation",
130
136
  Base64 = "Base64",
131
137
  Io = "Io",
132
138
  Groth16 = "Groth16",
133
139
  ProofNotFound = "ProofNotFound",
140
+ PlatformNotSupported = "PlatformNotSupported",
134
141
  }
135
142
  export const VerifyError = (() => {
136
143
  class C2pa extends UniffiError {
@@ -145,7 +152,7 @@ export const VerifyError = (() => {
145
152
  */
146
153
  readonly [variantOrdinalSymbol] = 1;
147
154
 
148
- public readonly tag = VerifyError_Tags.C2pa;
155
+ readonly tag = VerifyError_Tags.C2pa;
149
156
 
150
157
  constructor(message: string) {
151
158
  super("VerifyError", "C2pa", message);
@@ -167,7 +174,7 @@ export const VerifyError = (() => {
167
174
  */
168
175
  readonly [variantOrdinalSymbol] = 2;
169
176
 
170
- public readonly tag = VerifyError_Tags.AppAttest;
177
+ readonly tag = VerifyError_Tags.AppAttest;
171
178
 
172
179
  constructor(message: string) {
173
180
  super("VerifyError", "AppAttest", message);
@@ -177,7 +184,7 @@ export const VerifyError = (() => {
177
184
  return instanceOf(e) && (e as any)[variantOrdinalSymbol] === 2;
178
185
  }
179
186
  }
180
- class Base64 extends UniffiError {
187
+ class AndroidAttestation extends UniffiError {
181
188
  /**
182
189
  * @private
183
190
  * This field is private and should not be used.
@@ -189,14 +196,36 @@ export const VerifyError = (() => {
189
196
  */
190
197
  readonly [variantOrdinalSymbol] = 3;
191
198
 
192
- public readonly tag = VerifyError_Tags.Base64;
199
+ readonly tag = VerifyError_Tags.AndroidAttestation;
200
+
201
+ constructor(message: string) {
202
+ super("VerifyError", "AndroidAttestation", message);
203
+ }
204
+
205
+ static instanceOf(e: any): e is AndroidAttestation {
206
+ return instanceOf(e) && (e as any)[variantOrdinalSymbol] === 3;
207
+ }
208
+ }
209
+ class Base64 extends UniffiError {
210
+ /**
211
+ * @private
212
+ * This field is private and should not be used.
213
+ */
214
+ readonly [uniffiTypeNameSymbol]: string = "VerifyError";
215
+ /**
216
+ * @private
217
+ * This field is private and should not be used.
218
+ */
219
+ readonly [variantOrdinalSymbol] = 4;
220
+
221
+ readonly tag = VerifyError_Tags.Base64;
193
222
 
194
223
  constructor(message: string) {
195
224
  super("VerifyError", "Base64", message);
196
225
  }
197
226
 
198
227
  static instanceOf(e: any): e is Base64 {
199
- return instanceOf(e) && (e as any)[variantOrdinalSymbol] === 3;
228
+ return instanceOf(e) && (e as any)[variantOrdinalSymbol] === 4;
200
229
  }
201
230
  }
202
231
  class Io extends UniffiError {
@@ -209,16 +238,16 @@ export const VerifyError = (() => {
209
238
  * @private
210
239
  * This field is private and should not be used.
211
240
  */
212
- readonly [variantOrdinalSymbol] = 4;
241
+ readonly [variantOrdinalSymbol] = 5;
213
242
 
214
- public readonly tag = VerifyError_Tags.Io;
243
+ readonly tag = VerifyError_Tags.Io;
215
244
 
216
245
  constructor(message: string) {
217
246
  super("VerifyError", "Io", message);
218
247
  }
219
248
 
220
249
  static instanceOf(e: any): e is Io {
221
- return instanceOf(e) && (e as any)[variantOrdinalSymbol] === 4;
250
+ return instanceOf(e) && (e as any)[variantOrdinalSymbol] === 5;
222
251
  }
223
252
  }
224
253
  class Groth16 extends UniffiError {
@@ -231,16 +260,16 @@ export const VerifyError = (() => {
231
260
  * @private
232
261
  * This field is private and should not be used.
233
262
  */
234
- readonly [variantOrdinalSymbol] = 5;
263
+ readonly [variantOrdinalSymbol] = 6;
235
264
 
236
- public readonly tag = VerifyError_Tags.Groth16;
265
+ readonly tag = VerifyError_Tags.Groth16;
237
266
 
238
267
  constructor(message: string) {
239
268
  super("VerifyError", "Groth16", message);
240
269
  }
241
270
 
242
271
  static instanceOf(e: any): e is Groth16 {
243
- return instanceOf(e) && (e as any)[variantOrdinalSymbol] === 5;
272
+ return instanceOf(e) && (e as any)[variantOrdinalSymbol] === 6;
244
273
  }
245
274
  }
246
275
  class ProofNotFound extends UniffiError {
@@ -253,16 +282,38 @@ export const VerifyError = (() => {
253
282
  * @private
254
283
  * This field is private and should not be used.
255
284
  */
256
- readonly [variantOrdinalSymbol] = 6;
285
+ readonly [variantOrdinalSymbol] = 7;
257
286
 
258
- public readonly tag = VerifyError_Tags.ProofNotFound;
287
+ readonly tag = VerifyError_Tags.ProofNotFound;
259
288
 
260
289
  constructor(message: string) {
261
290
  super("VerifyError", "ProofNotFound", message);
262
291
  }
263
292
 
264
293
  static instanceOf(e: any): e is ProofNotFound {
265
- return instanceOf(e) && (e as any)[variantOrdinalSymbol] === 6;
294
+ return instanceOf(e) && (e as any)[variantOrdinalSymbol] === 7;
295
+ }
296
+ }
297
+ class PlatformNotSupported extends UniffiError {
298
+ /**
299
+ * @private
300
+ * This field is private and should not be used.
301
+ */
302
+ readonly [uniffiTypeNameSymbol]: string = "VerifyError";
303
+ /**
304
+ * @private
305
+ * This field is private and should not be used.
306
+ */
307
+ readonly [variantOrdinalSymbol] = 8;
308
+
309
+ readonly tag = VerifyError_Tags.PlatformNotSupported;
310
+
311
+ constructor(message: string) {
312
+ super("VerifyError", "PlatformNotSupported", message);
313
+ }
314
+
315
+ static instanceOf(e: any): e is PlatformNotSupported {
316
+ return instanceOf(e) && (e as any)[variantOrdinalSymbol] === 8;
266
317
  }
267
318
  }
268
319
 
@@ -273,10 +324,12 @@ export const VerifyError = (() => {
273
324
  return {
274
325
  C2pa,
275
326
  AppAttest,
327
+ AndroidAttestation,
276
328
  Base64,
277
329
  Io,
278
330
  Groth16,
279
331
  ProofNotFound,
332
+ PlatformNotSupported,
280
333
  instanceOf,
281
334
  };
282
335
  })();
@@ -300,17 +353,23 @@ const FfiConverterTypeVerifyError = (() => {
300
353
  return new VerifyError.AppAttest(FfiConverterString.read(from));
301
354
 
302
355
  case 3:
303
- return new VerifyError.Base64(FfiConverterString.read(from));
356
+ return new VerifyError.AndroidAttestation(FfiConverterString.read(from));
304
357
 
305
358
  case 4:
306
- return new VerifyError.Io(FfiConverterString.read(from));
359
+ return new VerifyError.Base64(FfiConverterString.read(from));
307
360
 
308
361
  case 5:
309
- return new VerifyError.Groth16(FfiConverterString.read(from));
362
+ return new VerifyError.Io(FfiConverterString.read(from));
310
363
 
311
364
  case 6:
365
+ return new VerifyError.Groth16(FfiConverterString.read(from));
366
+
367
+ case 7:
312
368
  return new VerifyError.ProofNotFound(FfiConverterString.read(from));
313
369
 
370
+ case 8:
371
+ return new VerifyError.PlatformNotSupported(FfiConverterString.read(from));
372
+
314
373
  default:
315
374
  throw new UniffiInternalError.UnexpectedEnumCase();
316
375
  }
@@ -339,7 +398,7 @@ const FfiConverterTypeVerifyError = (() => {
339
398
  */
340
399
  function uniffiEnsureInitialized() {
341
400
  // Get the bindings contract version from our ComponentInterface
342
- const bindingsContractVersion = 29;
401
+ const bindingsContractVersion = 30;
343
402
  // Get the scaffolding contract version by calling the into the dylib
344
403
  const scaffoldingContractVersion =
345
404
  nativeModule().ubrn_ffi_zcam1_verify_utils_uniffi_contract_version();
@@ -351,15 +410,18 @@ function uniffiEnsureInitialized() {
351
410
  }
352
411
  if (
353
412
  nativeModule().ubrn_uniffi_zcam1_verify_utils_checksum_func_verify_bindings_from_manifest() !==
354
- 62750
413
+ 22888
355
414
  ) {
356
415
  throw new UniffiInternalError.ApiChecksumMismatch(
357
416
  "uniffi_zcam1_verify_utils_checksum_func_verify_bindings_from_manifest",
358
417
  );
359
418
  }
360
- if (nativeModule().ubrn_uniffi_zcam1_verify_utils_checksum_func_verify_groth16() !== 13082) {
419
+ if (
420
+ nativeModule().ubrn_uniffi_zcam1_verify_utils_checksum_func_verify_proof_from_manifest() !==
421
+ 49444
422
+ ) {
361
423
  throw new UniffiInternalError.ApiChecksumMismatch(
362
- "uniffi_zcam1_verify_utils_checksum_func_verify_groth16",
424
+ "uniffi_zcam1_verify_utils_checksum_func_verify_proof_from_manifest",
363
425
  );
364
426
  }
365
427
  }
package/src/index.ts CHANGED
@@ -47,7 +47,7 @@ export type {
47
47
  } from "./camera";
48
48
  export { ZCamera } from "./camera";
49
49
  export type { CaptureInfo, DeviceOrientation } from "./capture";
50
- export { initCapture, previewFile } from "./capture";
50
+ export { initCapture, previewFile, requestCameraPermission, requestLocationPermission, updateRegistration } from "./capture";
51
51
 
52
52
  /**
53
53
  * Core cryptographic key types and secure enclave utilities.
@@ -1,6 +1,6 @@
1
1
  // Generated by uniffi-bindgen-react-native
2
- import type { TurboModule } from "react-native";
3
- import { TurboModuleRegistry } from "react-native";
2
+ import type { TurboModule } from 'react-native';
3
+ import { TurboModuleRegistry } from 'react-native';
4
4
 
5
5
  export interface Spec extends TurboModule {
6
6
  installRustCrate(): boolean;
@@ -1,4 +1,4 @@
1
- export { FulfillmentStatus, IosProvingClient } from "./bindings";
1
+ export { FulfillmentStatus } from "./bindings";
2
2
  export {
3
3
  ProverNetworkMode,
4
4
  ProverProvider,
@@ -8,6 +8,8 @@ import React, {
8
8
  useRef,
9
9
  useState,
10
10
  } from "react";
11
+ import { Platform } from "react-native";
12
+ import { isEmulator } from "react-native-device-info";
11
13
  import { Dirs, Util } from "react-native-file-access";
12
14
 
13
15
  import {
@@ -22,10 +24,10 @@ import { stripFileProtocol } from "../utils";
22
24
  import {
23
25
  FulfillmentStatus,
24
26
  type Initialized,
25
- IosProvingClient,
26
- type IosProvingClientInterface,
27
27
  ProofRequestStatus,
28
28
  ProverNetworkMode,
29
+ ProvingClient as ProvingClientInner,
30
+ type ProvingClientInterface,
29
31
  } from "./bindings";
30
32
 
31
33
  export { ProverNetworkMode } from "./bindings";
@@ -57,7 +59,7 @@ async function createProvingClient(
57
59
  onProofRequest?: (requestId: string, photoPath: string) => void,
58
60
  ): Promise<ProvingClient> {
59
61
  let certChainPem: string;
60
- let client: IosProvingClientInterface;
62
+ let client: ProvingClientInterface;
61
63
  const contentPublicKey = await getContentPublicKey();
62
64
 
63
65
  if (contentPublicKey.kty !== "EC") {
@@ -76,9 +78,9 @@ async function createProvingClient(
76
78
 
77
79
  if (settings.privateKey) {
78
80
  const proverNetworkMode = settings.proverNetworkMode ?? ProverNetworkMode.Mainnet;
79
- client = new IosProvingClient(settings.privateKey, onInitialized, proverNetworkMode);
81
+ client = new ProvingClientInner(settings.privateKey, onInitialized, proverNetworkMode);
80
82
  } else {
81
- client = IosProvingClient.mock(onInitialized);
83
+ client = ProvingClientInner.simulator(onInitialized);
82
84
  }
83
85
 
84
86
  return new ProvingClient(client, contentKeyId, certChainPem, settings.production, onProofRequest);
@@ -379,14 +381,14 @@ export function useProofRequestStatus(requestId: string | null): ProofRequestCon
379
381
  }
380
382
 
381
383
  export class ProvingClient {
382
- client: IosProvingClientInterface;
384
+ client: ProvingClientInterface;
383
385
  contentKeyId: Uint8Array;
384
386
  certChainPem: string;
385
387
  production: boolean;
386
388
  onProofRequest?: (requestId: string, photoPath: string) => void;
387
389
 
388
390
  constructor(
389
- client: IosProvingClientInterface,
391
+ client: ProvingClientInterface,
390
392
  contentKeyId: Uint8Array,
391
393
  certChainPem: string,
392
394
  production: boolean,
@@ -414,9 +416,7 @@ export class ProvingClient {
414
416
  throw new Error(`Unsupported file format: ${originalPath}`);
415
417
  }
416
418
 
417
- const requestId = await this.client.requestProof(originalPath, format, {
418
- appAttestProduction: this.production,
419
- });
419
+ const requestId = await this.client.requestProof(originalPath, format, this.production);
420
420
 
421
421
  if (this.onProofRequest) {
422
422
  this.onProofRequest(requestId, originalPath);
@@ -440,14 +440,24 @@ export class ProvingClient {
440
440
  originalPath = stripFileProtocol(originalPath);
441
441
  const format = formatFromPath(originalPath);
442
442
  const ext = Util.extname(originalPath);
443
+ const isSimulator = await isEmulator();
443
444
 
444
445
  if (format === undefined) {
445
446
  throw new Error(`Unsupported file format: ${originalPath}`);
446
447
  }
447
448
 
449
+ // On Android, pass the KeyStore alias so Rust signs via JNI.
450
+ // On iOS, pass the contentKeyId (SHA1 of public key) so Rust signs via Secure Enclave.
451
+ const keyTag =
452
+ Platform.OS === "android"
453
+ ? new TextEncoder().encode(
454
+ isSimulator ? "ZCAM1_MOCK_CONTENT_KEY_TAG" : "ZCAM1_CONTENT_KEY_TAG",
455
+ )
456
+ : this.contentKeyId;
457
+
448
458
  const manifestEditor = ManifestEditor.fromManifest(
449
459
  originalPath,
450
- this.contentKeyId.buffer as ArrayBuffer,
460
+ keyTag.buffer as ArrayBuffer,
451
461
  this.certChainPem,
452
462
  );
453
463
 
@@ -459,6 +469,7 @@ export class ProvingClient {
459
469
  JSON.stringify({
460
470
  data: base64.encode(new Uint8Array(proof)),
461
471
  vk_hash: vkHash,
472
+ platform: Platform.OS,
462
473
  }),
463
474
  );
464
475