@succinctlabs/react-native-zcam1 0.3.0 → 0.4.0-alpha.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.
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";
@@ -42,114 +46,107 @@ export default getter;
42
46
 
43
47
  // Structs and function types for calling back into Typescript from Rust.
44
48
  export type UniffiRustFutureContinuationCallback = (data: bigint, pollResult: number) => void;
45
- type UniffiForeignFutureFree = (handle: bigint) => void;
49
+ export type UniffiForeignFutureDroppedCallback = (handle: bigint) => void;
46
50
  type UniffiCallbackInterfaceFree = (handle: bigint) => void;
47
- export type UniffiForeignFuture = {
51
+ type UniffiCallbackInterfaceClone = (handle: bigint) => UniffiResult<void>;
52
+ export type UniffiForeignFutureDroppedCallbackStruct = {
48
53
  handle: bigint;
49
- free: UniffiForeignFutureFree;
54
+ free: UniffiForeignFutureDroppedCallback;
50
55
  };
51
- export type UniffiForeignFutureStructU8 = {
56
+ export type UniffiForeignFutureResultU8 = {
52
57
  returnValue: number;
53
58
  callStatus: UniffiRustCallStatus;
54
59
  };
55
60
  export type UniffiForeignFutureCompleteU8 = (
56
61
  callbackData: bigint,
57
- result: UniffiForeignFutureStructU8,
62
+ result: UniffiForeignFutureResultU8,
58
63
  ) => void;
59
- export type UniffiForeignFutureStructI8 = {
64
+ export type UniffiForeignFutureResultI8 = {
60
65
  returnValue: number;
61
66
  callStatus: UniffiRustCallStatus;
62
67
  };
63
68
  export type UniffiForeignFutureCompleteI8 = (
64
69
  callbackData: bigint,
65
- result: UniffiForeignFutureStructI8,
70
+ result: UniffiForeignFutureResultI8,
66
71
  ) => void;
67
- export type UniffiForeignFutureStructU16 = {
72
+ export type UniffiForeignFutureResultU16 = {
68
73
  returnValue: number;
69
74
  callStatus: UniffiRustCallStatus;
70
75
  };
71
76
  export type UniffiForeignFutureCompleteU16 = (
72
77
  callbackData: bigint,
73
- result: UniffiForeignFutureStructU16,
78
+ result: UniffiForeignFutureResultU16,
74
79
  ) => void;
75
- export type UniffiForeignFutureStructI16 = {
80
+ export type UniffiForeignFutureResultI16 = {
76
81
  returnValue: number;
77
82
  callStatus: UniffiRustCallStatus;
78
83
  };
79
84
  export type UniffiForeignFutureCompleteI16 = (
80
85
  callbackData: bigint,
81
- result: UniffiForeignFutureStructI16,
86
+ result: UniffiForeignFutureResultI16,
82
87
  ) => void;
83
- export type UniffiForeignFutureStructU32 = {
88
+ export type UniffiForeignFutureResultU32 = {
84
89
  returnValue: number;
85
90
  callStatus: UniffiRustCallStatus;
86
91
  };
87
92
  export type UniffiForeignFutureCompleteU32 = (
88
93
  callbackData: bigint,
89
- result: UniffiForeignFutureStructU32,
94
+ result: UniffiForeignFutureResultU32,
90
95
  ) => void;
91
- export type UniffiForeignFutureStructI32 = {
96
+ export type UniffiForeignFutureResultI32 = {
92
97
  returnValue: number;
93
98
  callStatus: UniffiRustCallStatus;
94
99
  };
95
100
  export type UniffiForeignFutureCompleteI32 = (
96
101
  callbackData: bigint,
97
- result: UniffiForeignFutureStructI32,
102
+ result: UniffiForeignFutureResultI32,
98
103
  ) => void;
99
- export type UniffiForeignFutureStructU64 = {
104
+ export type UniffiForeignFutureResultU64 = {
100
105
  returnValue: bigint;
101
106
  callStatus: UniffiRustCallStatus;
102
107
  };
103
108
  export type UniffiForeignFutureCompleteU64 = (
104
109
  callbackData: bigint,
105
- result: UniffiForeignFutureStructU64,
110
+ result: UniffiForeignFutureResultU64,
106
111
  ) => void;
107
- export type UniffiForeignFutureStructI64 = {
112
+ export type UniffiForeignFutureResultI64 = {
108
113
  returnValue: bigint;
109
114
  callStatus: UniffiRustCallStatus;
110
115
  };
111
116
  export type UniffiForeignFutureCompleteI64 = (
112
117
  callbackData: bigint,
113
- result: UniffiForeignFutureStructI64,
118
+ result: UniffiForeignFutureResultI64,
114
119
  ) => void;
115
- export type UniffiForeignFutureStructF32 = {
120
+ export type UniffiForeignFutureResultF32 = {
116
121
  returnValue: number;
117
122
  callStatus: UniffiRustCallStatus;
118
123
  };
119
124
  export type UniffiForeignFutureCompleteF32 = (
120
125
  callbackData: bigint,
121
- result: UniffiForeignFutureStructF32,
126
+ result: UniffiForeignFutureResultF32,
122
127
  ) => void;
123
- export type UniffiForeignFutureStructF64 = {
128
+ export type UniffiForeignFutureResultF64 = {
124
129
  returnValue: number;
125
130
  callStatus: UniffiRustCallStatus;
126
131
  };
127
132
  export type UniffiForeignFutureCompleteF64 = (
128
133
  callbackData: bigint,
129
- result: UniffiForeignFutureStructF64,
130
- ) => void;
131
- export type UniffiForeignFutureStructPointer = {
132
- returnValue: bigint;
133
- callStatus: UniffiRustCallStatus;
134
- };
135
- export type UniffiForeignFutureCompletePointer = (
136
- callbackData: bigint,
137
- result: UniffiForeignFutureStructPointer,
134
+ result: UniffiForeignFutureResultF64,
138
135
  ) => void;
139
- export type UniffiForeignFutureStructRustBuffer = {
136
+ export type UniffiForeignFutureResultRustBuffer = {
140
137
  returnValue: Uint8Array;
141
138
  callStatus: UniffiRustCallStatus;
142
139
  };
143
140
  export type UniffiForeignFutureCompleteRustBuffer = (
144
141
  callbackData: bigint,
145
- result: UniffiForeignFutureStructRustBuffer,
142
+ result: UniffiForeignFutureResultRustBuffer,
146
143
  ) => void;
147
- export type UniffiForeignFutureStructVoid = {
144
+ export type UniffiForeignFutureResultVoid = {
148
145
  callStatus: UniffiRustCallStatus;
149
146
  };
150
147
  export type UniffiForeignFutureCompleteVoid = (
151
148
  callbackData: bigint,
152
- result: UniffiForeignFutureStructVoid,
149
+ result: UniffiForeignFutureResultVoid,
153
150
  ) => void;
154
151
 
155
152
  // 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_certs_utils-ffi";
33
36
  import {
@@ -293,7 +296,7 @@ export const CertsError = (() => {
293
296
  */
294
297
  readonly [variantOrdinalSymbol] = 1;
295
298
 
296
- public readonly tag = CertsError_Tags.Json;
299
+ readonly tag = CertsError_Tags.Json;
297
300
 
298
301
  constructor(message: string) {
299
302
  super("CertsError", "Json", message);
@@ -315,7 +318,7 @@ export const CertsError = (() => {
315
318
  */
316
319
  readonly [variantOrdinalSymbol] = 2;
317
320
 
318
- public readonly tag = CertsError_Tags.RcGen;
321
+ readonly tag = CertsError_Tags.RcGen;
319
322
 
320
323
  constructor(message: string) {
321
324
  super("CertsError", "RcGen", message);
@@ -337,7 +340,7 @@ export const CertsError = (() => {
337
340
  */
338
341
  readonly [variantOrdinalSymbol] = 3;
339
342
 
340
- public readonly tag = CertsError_Tags.Der;
343
+ readonly tag = CertsError_Tags.Der;
341
344
 
342
345
  constructor(message: string) {
343
346
  super("CertsError", "Der", message);
@@ -359,7 +362,7 @@ export const CertsError = (() => {
359
362
  */
360
363
  readonly [variantOrdinalSymbol] = 4;
361
364
 
362
- public readonly tag = CertsError_Tags.Spki;
365
+ readonly tag = CertsError_Tags.Spki;
363
366
 
364
367
  constructor(message: string) {
365
368
  super("CertsError", "Spki", message);
@@ -381,7 +384,7 @@ export const CertsError = (() => {
381
384
  */
382
385
  readonly [variantOrdinalSymbol] = 5;
383
386
 
384
- public readonly tag = CertsError_Tags.Pkcs8;
387
+ readonly tag = CertsError_Tags.Pkcs8;
385
388
 
386
389
  constructor(message: string) {
387
390
  super("CertsError", "Pkcs8", message);
@@ -403,7 +406,7 @@ export const CertsError = (() => {
403
406
  */
404
407
  readonly [variantOrdinalSymbol] = 6;
405
408
 
406
- public readonly tag = CertsError_Tags.EllipticCurve;
409
+ readonly tag = CertsError_Tags.EllipticCurve;
407
410
 
408
411
  constructor(message: string) {
409
412
  super("CertsError", "EllipticCurve", message);
@@ -425,7 +428,7 @@ export const CertsError = (() => {
425
428
  */
426
429
  readonly [variantOrdinalSymbol] = 7;
427
430
 
428
- public readonly tag = CertsError_Tags.X509Cert;
431
+ readonly tag = CertsError_Tags.X509Cert;
429
432
 
430
433
  constructor(message: string) {
431
434
  super("CertsError", "X509Cert", message);
@@ -518,7 +521,7 @@ const FfiConverterOptionalTypeSelfSignedCertChain = new FfiConverterOptional(
518
521
  */
519
522
  function uniffiEnsureInitialized() {
520
523
  // Get the bindings contract version from our ComponentInterface
521
- const bindingsContractVersion = 29;
524
+ const bindingsContractVersion = 30;
522
525
  // Get the scaffolding contract version by calling the into the dylib
523
526
  const scaffoldingContractVersion =
524
527
  nativeModule().ubrn_ffi_zcam1_certs_utils_uniffi_contract_version();
@@ -530,7 +533,7 @@ function uniffiEnsureInitialized() {
530
533
  }
531
534
  if (
532
535
  nativeModule().ubrn_uniffi_zcam1_certs_utils_checksum_func_build_self_signed_certificate() !==
533
- 5154
536
+ 14288
534
537
  ) {
535
538
  throw new UniffiInternalError.ApiChecksumMismatch(
536
539
  "uniffi_zcam1_certs_utils_checksum_func_build_self_signed_certificate",
@@ -0,0 +1,183 @@
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(
19
+ string: string,
20
+ uniffi_out_err: UniffiRustCallStatus,
21
+ ): number;
22
+ ubrn_uniffi_internal_fn_func_ffi__string_to_arraybuffer(
23
+ string: string,
24
+ uniffi_out_err: UniffiRustCallStatus,
25
+ ): Uint8Array;
26
+ ubrn_uniffi_internal_fn_func_ffi__arraybuffer_to_string(
27
+ buffer: Uint8Array,
28
+ uniffi_out_err: UniffiRustCallStatus,
29
+ ): string;
30
+ ubrn_uniffi_zcam1_common_fn_func_root_certs(
31
+ platform: Uint8Array,
32
+ uniffi_out_err: UniffiRustCallStatus,
33
+ ): Uint8Array;
34
+ ubrn_uniffi_zcam1_common_checksum_func_root_certs(): number;
35
+ ubrn_ffi_zcam1_common_uniffi_contract_version(): number;
36
+ }
37
+
38
+ // Casting globalThis to any allows us to look for `NativeZcam1Common`
39
+ // if it was added via JSI.
40
+ //
41
+ // We use a getter here rather than simply `globalThis.NativeZcam1Common` so that
42
+ // if/when the startup sequence isn't just so, an empty value isn't inadvertantly cached.
43
+ const getter: () => NativeModuleInterface = () => (globalThis as any).NativeZcam1Common;
44
+ export default getter;
45
+
46
+ // Structs and function types for calling back into Typescript from Rust.
47
+ export type UniffiRustFutureContinuationCallback = (data: bigint, pollResult: number) => void;
48
+ export type UniffiForeignFutureDroppedCallback = (handle: bigint) => void;
49
+ type UniffiCallbackInterfaceFree = (handle: bigint) => void;
50
+ type UniffiCallbackInterfaceClone = (handle: bigint) => UniffiResult<void>;
51
+ export type UniffiForeignFutureDroppedCallbackStruct = {
52
+ handle: bigint;
53
+ free: UniffiForeignFutureDroppedCallback;
54
+ };
55
+ export type UniffiForeignFutureResultU8 = {
56
+ returnValue: number;
57
+ callStatus: UniffiRustCallStatus;
58
+ };
59
+ export type UniffiForeignFutureCompleteU8 = (
60
+ callbackData: bigint,
61
+ result: UniffiForeignFutureResultU8,
62
+ ) => void;
63
+ export type UniffiForeignFutureResultI8 = {
64
+ returnValue: number;
65
+ callStatus: UniffiRustCallStatus;
66
+ };
67
+ export type UniffiForeignFutureCompleteI8 = (
68
+ callbackData: bigint,
69
+ result: UniffiForeignFutureResultI8,
70
+ ) => void;
71
+ export type UniffiForeignFutureResultU16 = {
72
+ returnValue: number;
73
+ callStatus: UniffiRustCallStatus;
74
+ };
75
+ export type UniffiForeignFutureCompleteU16 = (
76
+ callbackData: bigint,
77
+ result: UniffiForeignFutureResultU16,
78
+ ) => void;
79
+ export type UniffiForeignFutureResultI16 = {
80
+ returnValue: number;
81
+ callStatus: UniffiRustCallStatus;
82
+ };
83
+ export type UniffiForeignFutureCompleteI16 = (
84
+ callbackData: bigint,
85
+ result: UniffiForeignFutureResultI16,
86
+ ) => void;
87
+ export type UniffiForeignFutureResultU32 = {
88
+ returnValue: number;
89
+ callStatus: UniffiRustCallStatus;
90
+ };
91
+ export type UniffiForeignFutureCompleteU32 = (
92
+ callbackData: bigint,
93
+ result: UniffiForeignFutureResultU32,
94
+ ) => void;
95
+ export type UniffiForeignFutureResultI32 = {
96
+ returnValue: number;
97
+ callStatus: UniffiRustCallStatus;
98
+ };
99
+ export type UniffiForeignFutureCompleteI32 = (
100
+ callbackData: bigint,
101
+ result: UniffiForeignFutureResultI32,
102
+ ) => void;
103
+ export type UniffiForeignFutureResultU64 = {
104
+ returnValue: bigint;
105
+ callStatus: UniffiRustCallStatus;
106
+ };
107
+ export type UniffiForeignFutureCompleteU64 = (
108
+ callbackData: bigint,
109
+ result: UniffiForeignFutureResultU64,
110
+ ) => void;
111
+ export type UniffiForeignFutureResultI64 = {
112
+ returnValue: bigint;
113
+ callStatus: UniffiRustCallStatus;
114
+ };
115
+ export type UniffiForeignFutureCompleteI64 = (
116
+ callbackData: bigint,
117
+ result: UniffiForeignFutureResultI64,
118
+ ) => void;
119
+ export type UniffiForeignFutureResultF32 = {
120
+ returnValue: number;
121
+ callStatus: UniffiRustCallStatus;
122
+ };
123
+ export type UniffiForeignFutureCompleteF32 = (
124
+ callbackData: bigint,
125
+ result: UniffiForeignFutureResultF32,
126
+ ) => void;
127
+ export type UniffiForeignFutureResultF64 = {
128
+ returnValue: number;
129
+ callStatus: UniffiRustCallStatus;
130
+ };
131
+ export type UniffiForeignFutureCompleteF64 = (
132
+ callbackData: bigint,
133
+ result: UniffiForeignFutureResultF64,
134
+ ) => void;
135
+ export type UniffiForeignFutureResultRustBuffer = {
136
+ returnValue: Uint8Array;
137
+ callStatus: UniffiRustCallStatus;
138
+ };
139
+ export type UniffiForeignFutureCompleteRustBuffer = (
140
+ callbackData: bigint,
141
+ result: UniffiForeignFutureResultRustBuffer,
142
+ ) => void;
143
+ export type UniffiForeignFutureResultVoid = {
144
+ callStatus: UniffiRustCallStatus;
145
+ };
146
+ export type UniffiForeignFutureCompleteVoid = (
147
+ callbackData: bigint,
148
+ result: UniffiForeignFutureResultVoid,
149
+ ) => void;
150
+
151
+ // UniffiRustFutureContinuationCallback is generated as part of the component interface's
152
+ // ffi_definitions. However, we need it in the runtime.
153
+ // We could:
154
+ // (a) do some complicated template logic to ensure the declaration is not generated here (possible)
155
+ // (b) import the generated declaration into the runtime (m a y b e) or…
156
+ // (c) generate the declaration anyway, and use a different declaration in the runtime.
157
+ //
158
+ // We chose (c) here as the simplest. In addition, we perform a compile time check that
159
+ // the two versions of `UniffiRustFutureContinuationCallback` are structurally equivalent.
160
+ //
161
+ // If you see the error:
162
+ // ```
163
+ // Type 'true' is not assignable to type 'false'.(2322)
164
+ // ```
165
+ // Then a new version of uniffi has changed the signature of the callback. Most likely, code in
166
+ // `typescript/src/async-rust-call.ts` will need to be changed.
167
+ //
168
+ // If you see the error:
169
+ // ```
170
+ // Cannot find name 'UniffiRustFutureContinuationCallback'. Did you mean 'RuntimeUniffiRustFutureContinuationCallback'?(2552)
171
+ // ```
172
+ // then you may not be using callbacks or promises, and uniffi is now not generating Futures and callbacks.
173
+ // You should not generate this if that is the case.
174
+ //
175
+ // ('You' being the bindings generator maintainer).
176
+ const isRustFutureContinuationCallbackTypeCompatible: UniffiStructuralEquality<
177
+ RuntimeUniffiRustFutureContinuationCallback,
178
+ UniffiRustFutureContinuationCallback
179
+ > = true;
180
+ const isUniffiForeignFutureTypeCompatible: UniffiStructuralEquality<
181
+ RuntimeUniffiForeignFuture,
182
+ UniffiForeignFuture
183
+ > = true;
@@ -0,0 +1,116 @@
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 UniffiForeignFutureDroppedCallback,
10
+ type UniffiForeignFutureDroppedCallbackStruct,
11
+ type UniffiForeignFutureResultU8,
12
+ type UniffiForeignFutureCompleteU8,
13
+ type UniffiForeignFutureResultI8,
14
+ type UniffiForeignFutureCompleteI8,
15
+ type UniffiForeignFutureResultU16,
16
+ type UniffiForeignFutureCompleteU16,
17
+ type UniffiForeignFutureResultI16,
18
+ type UniffiForeignFutureCompleteI16,
19
+ type UniffiForeignFutureResultU32,
20
+ type UniffiForeignFutureCompleteU32,
21
+ type UniffiForeignFutureResultI32,
22
+ type UniffiForeignFutureCompleteI32,
23
+ type UniffiForeignFutureResultU64,
24
+ type UniffiForeignFutureCompleteU64,
25
+ type UniffiForeignFutureResultI64,
26
+ type UniffiForeignFutureCompleteI64,
27
+ type UniffiForeignFutureResultF32,
28
+ type UniffiForeignFutureCompleteF32,
29
+ type UniffiForeignFutureResultF64,
30
+ type UniffiForeignFutureCompleteF64,
31
+ type UniffiForeignFutureResultRustBuffer,
32
+ type UniffiForeignFutureCompleteRustBuffer,
33
+ type UniffiForeignFutureResultVoid,
34
+ type UniffiForeignFutureCompleteVoid,
35
+ } from "./zcam1_common-ffi";
36
+ import {
37
+ type UniffiByteArray,
38
+ FfiConverterArrayBuffer,
39
+ RustBuffer,
40
+ UniffiInternalError,
41
+ UniffiRustCaller,
42
+ uniffiCreateFfiConverterString,
43
+ } from "uniffi-bindgen-react-native";
44
+
45
+ // Get converters from the other files, if any.
46
+ const uniffiCaller = new UniffiRustCaller(() => ({ code: 0 }));
47
+
48
+ const uniffiIsDebug =
49
+ // @ts-ignore -- The process global might not be defined
50
+ typeof process !== "object" ||
51
+ // @ts-ignore -- The process global might not be defined
52
+ process?.env?.NODE_ENV !== "production" ||
53
+ false;
54
+ // Public interface members begin here.
55
+
56
+ export function rootCerts(platform: string): ArrayBuffer {
57
+ return FfiConverterArrayBuffer.lift(
58
+ uniffiCaller.rustCall(
59
+ /*caller:*/ (callStatus) => {
60
+ return nativeModule().ubrn_uniffi_zcam1_common_fn_func_root_certs(
61
+ FfiConverterString.lower(platform),
62
+ callStatus,
63
+ );
64
+ },
65
+ /*liftString:*/ FfiConverterString.lift,
66
+ ),
67
+ );
68
+ }
69
+
70
+ const stringConverter = {
71
+ stringToBytes: (s: string) =>
72
+ uniffiCaller.rustCall((status) =>
73
+ nativeModule().ubrn_uniffi_internal_fn_func_ffi__string_to_arraybuffer(s, status),
74
+ ),
75
+ bytesToString: (ab: UniffiByteArray) =>
76
+ uniffiCaller.rustCall((status) =>
77
+ nativeModule().ubrn_uniffi_internal_fn_func_ffi__arraybuffer_to_string(ab, status),
78
+ ),
79
+ stringByteLength: (s: string) =>
80
+ uniffiCaller.rustCall((status) =>
81
+ nativeModule().ubrn_uniffi_internal_fn_func_ffi__string_to_byte_length(s, status),
82
+ ),
83
+ };
84
+ const FfiConverterString = uniffiCreateFfiConverterString(stringConverter);
85
+
86
+ /**
87
+ * This should be called before anything else.
88
+ *
89
+ * It is likely that this is being done for you by the library's `index.ts`.
90
+ *
91
+ * It checks versions of uniffi between when the Rust scaffolding was generated
92
+ * and when the bindings were generated.
93
+ *
94
+ * It also initializes the machinery to enable Rust to talk back to Javascript.
95
+ */
96
+ function uniffiEnsureInitialized() {
97
+ // Get the bindings contract version from our ComponentInterface
98
+ const bindingsContractVersion = 30;
99
+ // Get the scaffolding contract version by calling the into the dylib
100
+ const scaffoldingContractVersion = nativeModule().ubrn_ffi_zcam1_common_uniffi_contract_version();
101
+ if (bindingsContractVersion !== scaffoldingContractVersion) {
102
+ throw new UniffiInternalError.ContractVersionMismatch(
103
+ scaffoldingContractVersion,
104
+ bindingsContractVersion,
105
+ );
106
+ }
107
+ if (nativeModule().ubrn_uniffi_zcam1_common_checksum_func_root_certs() !== 16802) {
108
+ throw new UniffiInternalError.ApiChecksumMismatch(
109
+ "uniffi_zcam1_common_checksum_func_root_certs",
110
+ );
111
+ }
112
+ }
113
+
114
+ export default Object.freeze({
115
+ initialize: uniffiEnsureInitialized,
116
+ });