@succinctlabs/react-native-zcam1 0.2.5
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 +61 -0
- package/Zcam1Sdk.podspec +157 -0
- package/app.plugin.js +11 -0
- package/cpp/generated/zcam1_c2pa_utils.cpp +4091 -0
- package/cpp/generated/zcam1_c2pa_utils.hpp +367 -0
- package/cpp/generated/zcam1_certs_utils.cpp +1799 -0
- package/cpp/generated/zcam1_certs_utils.hpp +72 -0
- package/cpp/generated/zcam1_verify_utils.cpp +1857 -0
- package/cpp/generated/zcam1_verify_utils.hpp +79 -0
- package/cpp/proving/generated/zcam1_proving_utils.cpp +3661 -0
- package/cpp/proving/generated/zcam1_proving_utils.hpp +275 -0
- package/cpp/proving/zcam1-proving.cpp +16 -0
- package/cpp/proving/zcam1-proving.h +15 -0
- package/cpp/zcam1-sdk.cpp +20 -0
- package/cpp/zcam1-sdk.h +15 -0
- package/ios/Zcam1Camera.swift +2945 -0
- package/ios/Zcam1CameraFilmStyle.swift +191 -0
- package/ios/Zcam1CameraViewManager.m +86 -0
- package/ios/Zcam1Capture.h +13 -0
- package/ios/Zcam1Capture.mm +500 -0
- package/ios/Zcam1DepthData.swift +417 -0
- package/ios/Zcam1Sdk.h +16 -0
- package/ios/Zcam1Sdk.mm +66 -0
- package/ios/proving/Zcam1Proving.h +16 -0
- package/ios/proving/Zcam1Proving.mm +66 -0
- package/lib/module/NativeZcam1Capture.js +12 -0
- package/lib/module/NativeZcam1Capture.js.map +1 -0
- package/lib/module/NativeZcam1Sdk.js +7 -0
- package/lib/module/NativeZcam1Sdk.js.map +1 -0
- package/lib/module/bindings.js +51 -0
- package/lib/module/bindings.js.map +1 -0
- package/lib/module/camera.js +522 -0
- package/lib/module/camera.js.map +1 -0
- package/lib/module/capture.js +120 -0
- package/lib/module/capture.js.map +1 -0
- package/lib/module/common.js +35 -0
- package/lib/module/common.js.map +1 -0
- package/lib/module/generated/zcam1_c2pa_utils-ffi.js +43 -0
- package/lib/module/generated/zcam1_c2pa_utils-ffi.js.map +1 -0
- package/lib/module/generated/zcam1_c2pa_utils.js +1202 -0
- package/lib/module/generated/zcam1_c2pa_utils.js.map +1 -0
- package/lib/module/generated/zcam1_certs_utils-ffi.js +43 -0
- package/lib/module/generated/zcam1_certs_utils-ffi.js.map +1 -0
- package/lib/module/generated/zcam1_certs_utils.js +399 -0
- package/lib/module/generated/zcam1_certs_utils.js.map +1 -0
- package/lib/module/generated/zcam1_proving_utils-ffi.js +43 -0
- package/lib/module/generated/zcam1_proving_utils-ffi.js.map +1 -0
- package/lib/module/generated/zcam1_proving_utils.js +515 -0
- package/lib/module/generated/zcam1_proving_utils.js.map +1 -0
- package/lib/module/generated/zcam1_verify_utils-ffi.js +43 -0
- package/lib/module/generated/zcam1_verify_utils-ffi.js.map +1 -0
- package/lib/module/generated/zcam1_verify_utils.js +252 -0
- package/lib/module/generated/zcam1_verify_utils.js.map +1 -0
- package/lib/module/index.js +31 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/picker.js +222 -0
- package/lib/module/picker.js.map +1 -0
- package/lib/module/proving/NativeZcam1Proving.js +7 -0
- package/lib/module/proving/NativeZcam1Proving.js.map +1 -0
- package/lib/module/proving/bindings.js +46 -0
- package/lib/module/proving/bindings.js.map +1 -0
- package/lib/module/proving/index.js +5 -0
- package/lib/module/proving/index.js.map +1 -0
- package/lib/module/proving/prove.js +346 -0
- package/lib/module/proving/prove.js.map +1 -0
- package/lib/module/utils.js +27 -0
- package/lib/module/utils.js.map +1 -0
- package/lib/module/verify.js +82 -0
- package/lib/module/verify.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/NativeZcam1Capture.d.ts +280 -0
- package/lib/typescript/src/NativeZcam1Capture.d.ts.map +1 -0
- package/lib/typescript/src/NativeZcam1Sdk.d.ts +8 -0
- package/lib/typescript/src/NativeZcam1Sdk.d.ts.map +1 -0
- package/lib/typescript/src/bindings.d.ts +14 -0
- package/lib/typescript/src/bindings.d.ts.map +1 -0
- package/lib/typescript/src/camera.d.ts +300 -0
- package/lib/typescript/src/camera.d.ts.map +1 -0
- package/lib/typescript/src/capture.d.ts +59 -0
- package/lib/typescript/src/capture.d.ts.map +1 -0
- package/lib/typescript/src/common.d.ts +10 -0
- package/lib/typescript/src/common.d.ts.map +1 -0
- package/lib/typescript/src/generated/zcam1_c2pa_utils-ffi.d.ts +175 -0
- package/lib/typescript/src/generated/zcam1_c2pa_utils-ffi.d.ts.map +1 -0
- package/lib/typescript/src/generated/zcam1_c2pa_utils.d.ts +811 -0
- package/lib/typescript/src/generated/zcam1_c2pa_utils.d.ts.map +1 -0
- package/lib/typescript/src/generated/zcam1_certs_utils-ffi.d.ts +82 -0
- package/lib/typescript/src/generated/zcam1_certs_utils-ffi.d.ts.map +1 -0
- package/lib/typescript/src/generated/zcam1_certs_utils.d.ts +413 -0
- package/lib/typescript/src/generated/zcam1_certs_utils.d.ts.map +1 -0
- package/lib/typescript/src/generated/zcam1_proving_utils-ffi.d.ts +153 -0
- package/lib/typescript/src/generated/zcam1_proving_utils-ffi.d.ts.map +1 -0
- package/lib/typescript/src/generated/zcam1_proving_utils.d.ts +321 -0
- package/lib/typescript/src/generated/zcam1_proving_utils.d.ts.map +1 -0
- package/lib/typescript/src/generated/zcam1_verify_utils-ffi.d.ts +84 -0
- package/lib/typescript/src/generated/zcam1_verify_utils-ffi.d.ts.map +1 -0
- package/lib/typescript/src/generated/zcam1_verify_utils.d.ts +286 -0
- package/lib/typescript/src/generated/zcam1_verify_utils.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +29 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/picker.d.ts +103 -0
- package/lib/typescript/src/picker.d.ts.map +1 -0
- package/lib/typescript/src/proving/NativeZcam1Proving.d.ts +8 -0
- package/lib/typescript/src/proving/NativeZcam1Proving.d.ts.map +1 -0
- package/lib/typescript/src/proving/bindings.d.ts +8 -0
- package/lib/typescript/src/proving/bindings.d.ts.map +1 -0
- package/lib/typescript/src/proving/index.d.ts +3 -0
- package/lib/typescript/src/proving/index.d.ts.map +1 -0
- package/lib/typescript/src/proving/prove.d.ts +74 -0
- package/lib/typescript/src/proving/prove.d.ts.map +1 -0
- package/lib/typescript/src/utils.d.ts +2 -0
- package/lib/typescript/src/utils.d.ts.map +1 -0
- package/lib/typescript/src/verify.d.ts +45 -0
- package/lib/typescript/src/verify.d.ts.map +1 -0
- package/package.json +118 -0
- package/src/NativeZcam1Capture.ts +335 -0
- package/src/NativeZcam1Sdk.ts +10 -0
- package/src/bindings.tsx +49 -0
- package/src/camera.tsx +705 -0
- package/src/capture.tsx +165 -0
- package/src/common.tsx +46 -0
- package/src/generated/zcam1_c2pa_utils-ffi.ts +456 -0
- package/src/generated/zcam1_c2pa_utils.ts +1866 -0
- package/src/generated/zcam1_certs_utils-ffi.ts +187 -0
- package/src/generated/zcam1_certs_utils.ts +549 -0
- package/src/generated/zcam1_proving_utils-ffi.ts +374 -0
- package/src/generated/zcam1_proving_utils.ts +804 -0
- package/src/generated/zcam1_verify_utils-ffi.ts +196 -0
- package/src/generated/zcam1_verify_utils.ts +372 -0
- package/src/index.ts +73 -0
- package/src/picker.tsx +342 -0
- package/src/proving/NativeZcam1Proving.ts +10 -0
- package/src/proving/bindings.tsx +50 -0
- package/src/proving/index.ts +8 -0
- package/src/proving/prove.tsx +492 -0
- package/src/utils.ts +38 -0
- package/src/verify.tsx +119 -0
- package/turbo.json +27 -0
package/src/capture.tsx
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { generateHardwareKey, getAttestation } from "@pagopa/io-react-native-integrity";
|
|
2
|
+
import EncryptedStorage from "react-native-encrypted-storage";
|
|
3
|
+
|
|
4
|
+
import { type ECKey, getContentPublicKey, getSecureEnclaveKeyId } from "./common";
|
|
5
|
+
export { buildSelfSignedCertificate, SelfSignedCertChain } from "./bindings";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Camera component for capturing photos with secure enclave integration.
|
|
9
|
+
*/
|
|
10
|
+
export {
|
|
11
|
+
type CameraFilmStyle,
|
|
12
|
+
type FilmStyleEffect,
|
|
13
|
+
type FilmStyleRecipe,
|
|
14
|
+
type HighlightShadowConfig,
|
|
15
|
+
type MonochromeConfig,
|
|
16
|
+
type WhiteBalanceConfig,
|
|
17
|
+
ZCamera,
|
|
18
|
+
} from "./camera";
|
|
19
|
+
|
|
20
|
+
import NativeZcam1Capture from "./NativeZcam1Capture";
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Present a native full-screen preview for any file using iOS QLPreviewController.
|
|
24
|
+
* Supports images, videos, PDFs, and other common file types with native playback controls.
|
|
25
|
+
* @param filePath Absolute filesystem path to the file.
|
|
26
|
+
*/
|
|
27
|
+
export async function previewFile(filePath: string): Promise<void> {
|
|
28
|
+
return NativeZcam1Capture.previewFile(filePath);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Flash mode for photo capture.
|
|
33
|
+
*/
|
|
34
|
+
export {
|
|
35
|
+
type AspectRatio,
|
|
36
|
+
type DeviceOrientation,
|
|
37
|
+
type FlashMode,
|
|
38
|
+
type Orientation,
|
|
39
|
+
} from "./NativeZcam1Capture";
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Native video recording results.
|
|
43
|
+
*/
|
|
44
|
+
export type {
|
|
45
|
+
StartNativeVideoRecordingResult,
|
|
46
|
+
StopNativeVideoRecordingResult,
|
|
47
|
+
} from "./NativeZcam1Capture";
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Device registration information including keys, certificate chain, and attestation.
|
|
51
|
+
*/
|
|
52
|
+
export type CaptureInfo = {
|
|
53
|
+
appId: string;
|
|
54
|
+
deviceKeyId: string;
|
|
55
|
+
contentPublicKey: ECKey;
|
|
56
|
+
contentKeyId: Uint8Array;
|
|
57
|
+
attestation: string;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Configuration settings for device initialization and backend communication.
|
|
62
|
+
*/
|
|
63
|
+
export type Settings = {
|
|
64
|
+
appId: string;
|
|
65
|
+
production: boolean;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Represents a captured photo with its original and processed file paths.
|
|
70
|
+
*/
|
|
71
|
+
export class ZPhoto {
|
|
72
|
+
originalPath: string;
|
|
73
|
+
path: string;
|
|
74
|
+
|
|
75
|
+
constructor(originalPath: string, path: string) {
|
|
76
|
+
this.originalPath = originalPath;
|
|
77
|
+
this.path = path;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Initializes the device by generating keys, obtaining certificate chain, and registering with the backend.
|
|
83
|
+
* @param settings - Configuration settings for initialization
|
|
84
|
+
* @returns Device information including keys, certificate chain, and attestation
|
|
85
|
+
*/
|
|
86
|
+
export async function initCapture(settings: Settings): Promise<CaptureInfo> {
|
|
87
|
+
let deviceKeyId = await EncryptedStorage.getItem(`deviceKeyId-${settings.appId}`);
|
|
88
|
+
|
|
89
|
+
const contentPublicKey = await getContentPublicKey();
|
|
90
|
+
|
|
91
|
+
if (contentPublicKey.kty !== "EC") {
|
|
92
|
+
throw "Only EC public keys are supported";
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const contentKeyId = getSecureEnclaveKeyId(contentPublicKey);
|
|
96
|
+
|
|
97
|
+
if (deviceKeyId == null) {
|
|
98
|
+
// Try to generate hardware key, but fall back to mock for simulator
|
|
99
|
+
try {
|
|
100
|
+
deviceKeyId = await generateHardwareKey();
|
|
101
|
+
} catch (error: unknown) {
|
|
102
|
+
// If running in simulator, hardware key generation is not supported
|
|
103
|
+
const err = error as { code?: string; message?: string } | undefined;
|
|
104
|
+
if (err?.code === "-1" || err?.message?.includes("UNSUPPORTED_SERVICE")) {
|
|
105
|
+
console.warn(
|
|
106
|
+
"[ZCAM] Running in simulator - using mock device key. This is for development only.",
|
|
107
|
+
);
|
|
108
|
+
// Generate a mock device key for simulator testing
|
|
109
|
+
deviceKeyId = `SIMULATOR_DEVICE_KEY_${Date.now()}`;
|
|
110
|
+
} else {
|
|
111
|
+
throw error;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
await EncryptedStorage.setItem(`deviceKeyId-${settings.appId}`, deviceKeyId);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (deviceKeyId == null) {
|
|
118
|
+
throw "failed to generate a device key";
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
let attestation = await EncryptedStorage.getItem(`attestation-${deviceKeyId}`);
|
|
122
|
+
|
|
123
|
+
if (attestation == null) {
|
|
124
|
+
attestation = await updateRegistration(deviceKeyId, settings);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return {
|
|
128
|
+
appId: settings.appId,
|
|
129
|
+
deviceKeyId,
|
|
130
|
+
contentPublicKey,
|
|
131
|
+
contentKeyId,
|
|
132
|
+
attestation,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Updates device registration by performing attestation with the backend.
|
|
138
|
+
* @param keyId - The hardware key identifier
|
|
139
|
+
* @param settings - Configuration settings for registration
|
|
140
|
+
* @returns Attestation data and challenge
|
|
141
|
+
*/
|
|
142
|
+
export async function updateRegistration(keyId: string, _settings: Settings): Promise<string> {
|
|
143
|
+
// Try to get real attestation, but fall back to mock for simulator
|
|
144
|
+
let attestation: string;
|
|
145
|
+
try {
|
|
146
|
+
attestation = await getAttestation(keyId, keyId);
|
|
147
|
+
} catch (error: unknown) {
|
|
148
|
+
// If running in simulator, App Attest is not supported
|
|
149
|
+
const err = error as { code?: string; message?: string } | undefined;
|
|
150
|
+
if (err?.code === "-1" || err?.message?.includes("UNSUPPORTED_SERVICE")) {
|
|
151
|
+
console.warn(
|
|
152
|
+
"[ZCAM] Running in simulator - using mock attestation. This is for development only.",
|
|
153
|
+
);
|
|
154
|
+
// Use a mock attestation for simulator testing
|
|
155
|
+
// In production, this would need to be rejected by the backend
|
|
156
|
+
return `SIMULATOR_MOCK_${keyId}_${Date.now()}`;
|
|
157
|
+
} else {
|
|
158
|
+
throw error;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
await EncryptedStorage.setItem(`attestation-${keyId}`, attestation);
|
|
163
|
+
|
|
164
|
+
return attestation;
|
|
165
|
+
}
|
package/src/common.tsx
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { sha1 } from "@noble/hashes/legacy.js";
|
|
2
|
+
import { generate, getPublicKeyFixed, type PublicKey } from "@pagopa/io-react-native-crypto";
|
|
3
|
+
import { base64, base64nopad, base64url, base64urlnopad } from "@scure/base";
|
|
4
|
+
|
|
5
|
+
const CONTENT_KEY_TAG = "ZCAM1_CONTENT_KEY_TAG";
|
|
6
|
+
|
|
7
|
+
export interface ECKey {
|
|
8
|
+
kty: "EC";
|
|
9
|
+
crv: string;
|
|
10
|
+
x: string;
|
|
11
|
+
y: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// Flexible base64 decoder that handles both standard and url-safe formats, with or without padding.
|
|
15
|
+
// iOS Secure Enclave returns keys in varying formats depending on the iOS version.
|
|
16
|
+
function flexibleBase64Decode(str: string): Uint8Array {
|
|
17
|
+
const isUrlSafe = str.includes("-") || str.includes("_");
|
|
18
|
+
const hasPadding = str.includes("=");
|
|
19
|
+
|
|
20
|
+
if (isUrlSafe) {
|
|
21
|
+
return hasPadding ? base64url.decode(str) : base64urlnopad.decode(str);
|
|
22
|
+
}
|
|
23
|
+
return hasPadding ? base64.decode(str) : base64nopad.decode(str);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export async function getContentPublicKey(): Promise<PublicKey> {
|
|
27
|
+
return await getPublicKeyFixed(CONTENT_KEY_TAG).catch(() => {
|
|
28
|
+
return generate(CONTENT_KEY_TAG);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function getSecureEnclaveKeyId(publicKey: ECKey): Uint8Array {
|
|
33
|
+
if (publicKey.kty === "EC") {
|
|
34
|
+
const x = flexibleBase64Decode(publicKey.x);
|
|
35
|
+
const y = flexibleBase64Decode(publicKey.y);
|
|
36
|
+
|
|
37
|
+
const out = new Uint8Array(1 + x.length + y.length);
|
|
38
|
+
out[0] = 0x04; // uncompressed point format
|
|
39
|
+
out.set(x, 1);
|
|
40
|
+
out.set(y, 1 + x.length);
|
|
41
|
+
|
|
42
|
+
return sha1(out);
|
|
43
|
+
} else {
|
|
44
|
+
throw "Invalid key type";
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,456 @@
|
|
|
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
|
+
import {
|
|
5
|
+
type StructuralEquality as UniffiStructuralEquality,
|
|
6
|
+
type UniffiForeignFuture as RuntimeUniffiForeignFuture,
|
|
7
|
+
type UniffiRustCallStatus,
|
|
8
|
+
type UniffiRustArcPtr,
|
|
9
|
+
type UniffiRustFutureContinuationCallback as RuntimeUniffiRustFutureContinuationCallback,
|
|
10
|
+
type UniffiResult,
|
|
11
|
+
} from "uniffi-bindgen-react-native";
|
|
12
|
+
|
|
13
|
+
interface NativeModuleInterface {
|
|
14
|
+
ubrn_uniffi_internal_fn_func_ffi__string_to_byte_length(
|
|
15
|
+
string: string,
|
|
16
|
+
uniffi_out_err: UniffiRustCallStatus,
|
|
17
|
+
): number;
|
|
18
|
+
ubrn_uniffi_internal_fn_func_ffi__string_to_arraybuffer(
|
|
19
|
+
string: string,
|
|
20
|
+
uniffi_out_err: UniffiRustCallStatus,
|
|
21
|
+
): Uint8Array;
|
|
22
|
+
ubrn_uniffi_internal_fn_func_ffi__arraybuffer_to_string(
|
|
23
|
+
buffer: Uint8Array,
|
|
24
|
+
uniffi_out_err: UniffiRustCallStatus,
|
|
25
|
+
): string;
|
|
26
|
+
ubrn_uniffi_zcam1_c2pa_utils_fn_clone_manifest(
|
|
27
|
+
ptr: bigint,
|
|
28
|
+
uniffi_out_err: UniffiRustCallStatus,
|
|
29
|
+
): bigint;
|
|
30
|
+
ubrn_uniffi_zcam1_c2pa_utils_fn_free_manifest(
|
|
31
|
+
ptr: bigint,
|
|
32
|
+
uniffi_out_err: UniffiRustCallStatus,
|
|
33
|
+
): void;
|
|
34
|
+
ubrn_uniffi_zcam1_c2pa_utils_fn_method_manifest_bindings(
|
|
35
|
+
ptr: bigint,
|
|
36
|
+
uniffi_out_err: UniffiRustCallStatus,
|
|
37
|
+
): Uint8Array;
|
|
38
|
+
ubrn_uniffi_zcam1_c2pa_utils_fn_method_manifest_capture_metadata_action(
|
|
39
|
+
ptr: bigint,
|
|
40
|
+
uniffi_out_err: UniffiRustCallStatus,
|
|
41
|
+
): Uint8Array;
|
|
42
|
+
ubrn_uniffi_zcam1_c2pa_utils_fn_method_manifest_proof(
|
|
43
|
+
ptr: bigint,
|
|
44
|
+
uniffi_out_err: UniffiRustCallStatus,
|
|
45
|
+
): Uint8Array;
|
|
46
|
+
ubrn_uniffi_zcam1_c2pa_utils_fn_clone_manifesteditor(
|
|
47
|
+
ptr: bigint,
|
|
48
|
+
uniffi_out_err: UniffiRustCallStatus,
|
|
49
|
+
): bigint;
|
|
50
|
+
ubrn_uniffi_zcam1_c2pa_utils_fn_free_manifesteditor(
|
|
51
|
+
ptr: bigint,
|
|
52
|
+
uniffi_out_err: UniffiRustCallStatus,
|
|
53
|
+
): void;
|
|
54
|
+
ubrn_uniffi_zcam1_c2pa_utils_fn_constructor_manifesteditor_from_manifest(
|
|
55
|
+
path: Uint8Array,
|
|
56
|
+
keyTag: Uint8Array,
|
|
57
|
+
certs: Uint8Array,
|
|
58
|
+
uniffi_out_err: UniffiRustCallStatus,
|
|
59
|
+
): bigint;
|
|
60
|
+
ubrn_uniffi_zcam1_c2pa_utils_fn_constructor_manifesteditor_new(
|
|
61
|
+
path: Uint8Array,
|
|
62
|
+
keyTag: Uint8Array,
|
|
63
|
+
certs: Uint8Array,
|
|
64
|
+
uniffi_out_err: UniffiRustCallStatus,
|
|
65
|
+
): bigint;
|
|
66
|
+
ubrn_uniffi_zcam1_c2pa_utils_fn_method_manifesteditor_add_assertion(
|
|
67
|
+
ptr: bigint,
|
|
68
|
+
label: Uint8Array,
|
|
69
|
+
data: Uint8Array,
|
|
70
|
+
uniffi_out_err: UniffiRustCallStatus,
|
|
71
|
+
): void;
|
|
72
|
+
ubrn_uniffi_zcam1_c2pa_utils_fn_method_manifesteditor_add_photo_metadata_action(
|
|
73
|
+
ptr: bigint,
|
|
74
|
+
parameters: Uint8Array,
|
|
75
|
+
when: Uint8Array,
|
|
76
|
+
uniffi_out_err: UniffiRustCallStatus,
|
|
77
|
+
): Uint8Array;
|
|
78
|
+
ubrn_uniffi_zcam1_c2pa_utils_fn_method_manifesteditor_add_title(
|
|
79
|
+
ptr: bigint,
|
|
80
|
+
title: Uint8Array,
|
|
81
|
+
uniffi_out_err: UniffiRustCallStatus,
|
|
82
|
+
): void;
|
|
83
|
+
ubrn_uniffi_zcam1_c2pa_utils_fn_method_manifesteditor_add_video_metadata_action(
|
|
84
|
+
ptr: bigint,
|
|
85
|
+
parameters: Uint8Array,
|
|
86
|
+
when: Uint8Array,
|
|
87
|
+
uniffi_out_err: UniffiRustCallStatus,
|
|
88
|
+
): Uint8Array;
|
|
89
|
+
ubrn_uniffi_zcam1_c2pa_utils_fn_method_manifesteditor_embed_manifest_to_file(
|
|
90
|
+
ptr: bigint,
|
|
91
|
+
destination: Uint8Array,
|
|
92
|
+
format: Uint8Array,
|
|
93
|
+
): bigint;
|
|
94
|
+
ubrn_uniffi_zcam1_c2pa_utils_fn_method_manifesteditor_remove_assertion(
|
|
95
|
+
ptr: bigint,
|
|
96
|
+
label: Uint8Array,
|
|
97
|
+
uniffi_out_err: UniffiRustCallStatus,
|
|
98
|
+
): number;
|
|
99
|
+
ubrn_uniffi_zcam1_c2pa_utils_fn_clone_manifeststore(
|
|
100
|
+
ptr: bigint,
|
|
101
|
+
uniffi_out_err: UniffiRustCallStatus,
|
|
102
|
+
): bigint;
|
|
103
|
+
ubrn_uniffi_zcam1_c2pa_utils_fn_free_manifeststore(
|
|
104
|
+
ptr: bigint,
|
|
105
|
+
uniffi_out_err: UniffiRustCallStatus,
|
|
106
|
+
): void;
|
|
107
|
+
ubrn_uniffi_zcam1_c2pa_utils_fn_method_manifeststore_active_manifest(
|
|
108
|
+
ptr: bigint,
|
|
109
|
+
uniffi_out_err: UniffiRustCallStatus,
|
|
110
|
+
): bigint;
|
|
111
|
+
ubrn_uniffi_zcam1_c2pa_utils_fn_func_authenticity_status(path: Uint8Array): bigint;
|
|
112
|
+
ubrn_uniffi_zcam1_c2pa_utils_fn_func_compute_hash(
|
|
113
|
+
path: Uint8Array,
|
|
114
|
+
uniffi_out_err: UniffiRustCallStatus,
|
|
115
|
+
): Uint8Array;
|
|
116
|
+
ubrn_uniffi_zcam1_c2pa_utils_fn_func_compute_hash_from_buffer(
|
|
117
|
+
buffer: Uint8Array,
|
|
118
|
+
format: Uint8Array,
|
|
119
|
+
uniffi_out_err: UniffiRustCallStatus,
|
|
120
|
+
): Uint8Array;
|
|
121
|
+
ubrn_uniffi_zcam1_c2pa_utils_fn_func_extract_manifest(
|
|
122
|
+
path: Uint8Array,
|
|
123
|
+
uniffi_out_err: UniffiRustCallStatus,
|
|
124
|
+
): bigint;
|
|
125
|
+
ubrn_uniffi_zcam1_c2pa_utils_fn_func_format_from_path(
|
|
126
|
+
path: Uint8Array,
|
|
127
|
+
uniffi_out_err: UniffiRustCallStatus,
|
|
128
|
+
): Uint8Array;
|
|
129
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_poll_u8(
|
|
130
|
+
handle: bigint,
|
|
131
|
+
callback: UniffiRustFutureContinuationCallback,
|
|
132
|
+
callbackData: bigint,
|
|
133
|
+
): void;
|
|
134
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_cancel_u8(handle: bigint): void;
|
|
135
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_free_u8(handle: bigint): void;
|
|
136
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_complete_u8(
|
|
137
|
+
handle: bigint,
|
|
138
|
+
uniffi_out_err: UniffiRustCallStatus,
|
|
139
|
+
): number;
|
|
140
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_poll_i8(
|
|
141
|
+
handle: bigint,
|
|
142
|
+
callback: UniffiRustFutureContinuationCallback,
|
|
143
|
+
callbackData: bigint,
|
|
144
|
+
): void;
|
|
145
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_cancel_i8(handle: bigint): void;
|
|
146
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_free_i8(handle: bigint): void;
|
|
147
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_complete_i8(
|
|
148
|
+
handle: bigint,
|
|
149
|
+
uniffi_out_err: UniffiRustCallStatus,
|
|
150
|
+
): number;
|
|
151
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_poll_u16(
|
|
152
|
+
handle: bigint,
|
|
153
|
+
callback: UniffiRustFutureContinuationCallback,
|
|
154
|
+
callbackData: bigint,
|
|
155
|
+
): void;
|
|
156
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_cancel_u16(handle: bigint): void;
|
|
157
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_free_u16(handle: bigint): void;
|
|
158
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_complete_u16(
|
|
159
|
+
handle: bigint,
|
|
160
|
+
uniffi_out_err: UniffiRustCallStatus,
|
|
161
|
+
): number;
|
|
162
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_poll_i16(
|
|
163
|
+
handle: bigint,
|
|
164
|
+
callback: UniffiRustFutureContinuationCallback,
|
|
165
|
+
callbackData: bigint,
|
|
166
|
+
): void;
|
|
167
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_cancel_i16(handle: bigint): void;
|
|
168
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_free_i16(handle: bigint): void;
|
|
169
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_complete_i16(
|
|
170
|
+
handle: bigint,
|
|
171
|
+
uniffi_out_err: UniffiRustCallStatus,
|
|
172
|
+
): number;
|
|
173
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_poll_u32(
|
|
174
|
+
handle: bigint,
|
|
175
|
+
callback: UniffiRustFutureContinuationCallback,
|
|
176
|
+
callbackData: bigint,
|
|
177
|
+
): void;
|
|
178
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_cancel_u32(handle: bigint): void;
|
|
179
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_free_u32(handle: bigint): void;
|
|
180
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_complete_u32(
|
|
181
|
+
handle: bigint,
|
|
182
|
+
uniffi_out_err: UniffiRustCallStatus,
|
|
183
|
+
): number;
|
|
184
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_poll_i32(
|
|
185
|
+
handle: bigint,
|
|
186
|
+
callback: UniffiRustFutureContinuationCallback,
|
|
187
|
+
callbackData: bigint,
|
|
188
|
+
): void;
|
|
189
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_cancel_i32(handle: bigint): void;
|
|
190
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_free_i32(handle: bigint): void;
|
|
191
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_complete_i32(
|
|
192
|
+
handle: bigint,
|
|
193
|
+
uniffi_out_err: UniffiRustCallStatus,
|
|
194
|
+
): number;
|
|
195
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_poll_u64(
|
|
196
|
+
handle: bigint,
|
|
197
|
+
callback: UniffiRustFutureContinuationCallback,
|
|
198
|
+
callbackData: bigint,
|
|
199
|
+
): void;
|
|
200
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_cancel_u64(handle: bigint): void;
|
|
201
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_free_u64(handle: bigint): void;
|
|
202
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_complete_u64(
|
|
203
|
+
handle: bigint,
|
|
204
|
+
uniffi_out_err: UniffiRustCallStatus,
|
|
205
|
+
): bigint;
|
|
206
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_poll_i64(
|
|
207
|
+
handle: bigint,
|
|
208
|
+
callback: UniffiRustFutureContinuationCallback,
|
|
209
|
+
callbackData: bigint,
|
|
210
|
+
): void;
|
|
211
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_cancel_i64(handle: bigint): void;
|
|
212
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_free_i64(handle: bigint): void;
|
|
213
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_complete_i64(
|
|
214
|
+
handle: bigint,
|
|
215
|
+
uniffi_out_err: UniffiRustCallStatus,
|
|
216
|
+
): bigint;
|
|
217
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_poll_f32(
|
|
218
|
+
handle: bigint,
|
|
219
|
+
callback: UniffiRustFutureContinuationCallback,
|
|
220
|
+
callbackData: bigint,
|
|
221
|
+
): void;
|
|
222
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_cancel_f32(handle: bigint): void;
|
|
223
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_free_f32(handle: bigint): void;
|
|
224
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_complete_f32(
|
|
225
|
+
handle: bigint,
|
|
226
|
+
uniffi_out_err: UniffiRustCallStatus,
|
|
227
|
+
): number;
|
|
228
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_poll_f64(
|
|
229
|
+
handle: bigint,
|
|
230
|
+
callback: UniffiRustFutureContinuationCallback,
|
|
231
|
+
callbackData: bigint,
|
|
232
|
+
): void;
|
|
233
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_cancel_f64(handle: bigint): void;
|
|
234
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_free_f64(handle: bigint): void;
|
|
235
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_complete_f64(
|
|
236
|
+
handle: bigint,
|
|
237
|
+
uniffi_out_err: UniffiRustCallStatus,
|
|
238
|
+
): number;
|
|
239
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_poll_pointer(
|
|
240
|
+
handle: bigint,
|
|
241
|
+
callback: UniffiRustFutureContinuationCallback,
|
|
242
|
+
callbackData: bigint,
|
|
243
|
+
): void;
|
|
244
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_cancel_pointer(handle: bigint): void;
|
|
245
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_free_pointer(handle: bigint): void;
|
|
246
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_complete_pointer(
|
|
247
|
+
handle: bigint,
|
|
248
|
+
uniffi_out_err: UniffiRustCallStatus,
|
|
249
|
+
): bigint;
|
|
250
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_poll_rust_buffer(
|
|
251
|
+
handle: bigint,
|
|
252
|
+
callback: UniffiRustFutureContinuationCallback,
|
|
253
|
+
callbackData: bigint,
|
|
254
|
+
): void;
|
|
255
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_cancel_rust_buffer(handle: bigint): void;
|
|
256
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_free_rust_buffer(handle: bigint): void;
|
|
257
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_complete_rust_buffer(
|
|
258
|
+
handle: bigint,
|
|
259
|
+
uniffi_out_err: UniffiRustCallStatus,
|
|
260
|
+
): Uint8Array;
|
|
261
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_poll_void(
|
|
262
|
+
handle: bigint,
|
|
263
|
+
callback: UniffiRustFutureContinuationCallback,
|
|
264
|
+
callbackData: bigint,
|
|
265
|
+
): void;
|
|
266
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_cancel_void(handle: bigint): void;
|
|
267
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_free_void(handle: bigint): void;
|
|
268
|
+
ubrn_ffi_zcam1_c2pa_utils_rust_future_complete_void(
|
|
269
|
+
handle: bigint,
|
|
270
|
+
uniffi_out_err: UniffiRustCallStatus,
|
|
271
|
+
): void;
|
|
272
|
+
ubrn_uniffi_zcam1_c2pa_utils_checksum_func_authenticity_status(): number;
|
|
273
|
+
ubrn_uniffi_zcam1_c2pa_utils_checksum_func_compute_hash(): number;
|
|
274
|
+
ubrn_uniffi_zcam1_c2pa_utils_checksum_func_compute_hash_from_buffer(): number;
|
|
275
|
+
ubrn_uniffi_zcam1_c2pa_utils_checksum_func_extract_manifest(): number;
|
|
276
|
+
ubrn_uniffi_zcam1_c2pa_utils_checksum_func_format_from_path(): number;
|
|
277
|
+
ubrn_uniffi_zcam1_c2pa_utils_checksum_method_manifest_bindings(): number;
|
|
278
|
+
ubrn_uniffi_zcam1_c2pa_utils_checksum_method_manifest_capture_metadata_action(): number;
|
|
279
|
+
ubrn_uniffi_zcam1_c2pa_utils_checksum_method_manifest_proof(): number;
|
|
280
|
+
ubrn_uniffi_zcam1_c2pa_utils_checksum_method_manifesteditor_add_assertion(): number;
|
|
281
|
+
ubrn_uniffi_zcam1_c2pa_utils_checksum_method_manifesteditor_add_photo_metadata_action(): number;
|
|
282
|
+
ubrn_uniffi_zcam1_c2pa_utils_checksum_method_manifesteditor_add_title(): number;
|
|
283
|
+
ubrn_uniffi_zcam1_c2pa_utils_checksum_method_manifesteditor_add_video_metadata_action(): number;
|
|
284
|
+
ubrn_uniffi_zcam1_c2pa_utils_checksum_method_manifesteditor_embed_manifest_to_file(): number;
|
|
285
|
+
ubrn_uniffi_zcam1_c2pa_utils_checksum_method_manifesteditor_remove_assertion(): number;
|
|
286
|
+
ubrn_uniffi_zcam1_c2pa_utils_checksum_method_manifeststore_active_manifest(): number;
|
|
287
|
+
ubrn_uniffi_zcam1_c2pa_utils_checksum_constructor_manifesteditor_from_manifest(): number;
|
|
288
|
+
ubrn_uniffi_zcam1_c2pa_utils_checksum_constructor_manifesteditor_new(): number;
|
|
289
|
+
ubrn_ffi_zcam1_c2pa_utils_uniffi_contract_version(): number;
|
|
290
|
+
ubrn_uniffi_internal_fn_method_manifest_ffi__bless_pointer(
|
|
291
|
+
pointer: bigint,
|
|
292
|
+
uniffi_out_err: UniffiRustCallStatus,
|
|
293
|
+
): UniffiRustArcPtr;
|
|
294
|
+
ubrn_uniffi_internal_fn_method_manifesteditor_ffi__bless_pointer(
|
|
295
|
+
pointer: bigint,
|
|
296
|
+
uniffi_out_err: UniffiRustCallStatus,
|
|
297
|
+
): UniffiRustArcPtr;
|
|
298
|
+
ubrn_uniffi_internal_fn_method_manifeststore_ffi__bless_pointer(
|
|
299
|
+
pointer: bigint,
|
|
300
|
+
uniffi_out_err: UniffiRustCallStatus,
|
|
301
|
+
): UniffiRustArcPtr;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
// Casting globalThis to any allows us to look for `NativeZcam1C2paUtils`
|
|
305
|
+
// if it was added via JSI.
|
|
306
|
+
//
|
|
307
|
+
// We use a getter here rather than simply `globalThis.NativeZcam1C2paUtils` so that
|
|
308
|
+
// if/when the startup sequence isn't just so, an empty value isn't inadvertantly cached.
|
|
309
|
+
const getter: () => NativeModuleInterface = () => (globalThis as any).NativeZcam1C2paUtils;
|
|
310
|
+
export default getter;
|
|
311
|
+
|
|
312
|
+
// Structs and function types for calling back into Typescript from Rust.
|
|
313
|
+
export type UniffiRustFutureContinuationCallback = (data: bigint, pollResult: number) => void;
|
|
314
|
+
type UniffiForeignFutureFree = (handle: bigint) => void;
|
|
315
|
+
type UniffiCallbackInterfaceFree = (handle: bigint) => void;
|
|
316
|
+
export type UniffiForeignFuture = {
|
|
317
|
+
handle: bigint;
|
|
318
|
+
free: UniffiForeignFutureFree;
|
|
319
|
+
};
|
|
320
|
+
export type UniffiForeignFutureStructU8 = {
|
|
321
|
+
returnValue: number;
|
|
322
|
+
callStatus: UniffiRustCallStatus;
|
|
323
|
+
};
|
|
324
|
+
export type UniffiForeignFutureCompleteU8 = (
|
|
325
|
+
callbackData: bigint,
|
|
326
|
+
result: UniffiForeignFutureStructU8,
|
|
327
|
+
) => void;
|
|
328
|
+
export type UniffiForeignFutureStructI8 = {
|
|
329
|
+
returnValue: number;
|
|
330
|
+
callStatus: UniffiRustCallStatus;
|
|
331
|
+
};
|
|
332
|
+
export type UniffiForeignFutureCompleteI8 = (
|
|
333
|
+
callbackData: bigint,
|
|
334
|
+
result: UniffiForeignFutureStructI8,
|
|
335
|
+
) => void;
|
|
336
|
+
export type UniffiForeignFutureStructU16 = {
|
|
337
|
+
returnValue: number;
|
|
338
|
+
callStatus: UniffiRustCallStatus;
|
|
339
|
+
};
|
|
340
|
+
export type UniffiForeignFutureCompleteU16 = (
|
|
341
|
+
callbackData: bigint,
|
|
342
|
+
result: UniffiForeignFutureStructU16,
|
|
343
|
+
) => void;
|
|
344
|
+
export type UniffiForeignFutureStructI16 = {
|
|
345
|
+
returnValue: number;
|
|
346
|
+
callStatus: UniffiRustCallStatus;
|
|
347
|
+
};
|
|
348
|
+
export type UniffiForeignFutureCompleteI16 = (
|
|
349
|
+
callbackData: bigint,
|
|
350
|
+
result: UniffiForeignFutureStructI16,
|
|
351
|
+
) => void;
|
|
352
|
+
export type UniffiForeignFutureStructU32 = {
|
|
353
|
+
returnValue: number;
|
|
354
|
+
callStatus: UniffiRustCallStatus;
|
|
355
|
+
};
|
|
356
|
+
export type UniffiForeignFutureCompleteU32 = (
|
|
357
|
+
callbackData: bigint,
|
|
358
|
+
result: UniffiForeignFutureStructU32,
|
|
359
|
+
) => void;
|
|
360
|
+
export type UniffiForeignFutureStructI32 = {
|
|
361
|
+
returnValue: number;
|
|
362
|
+
callStatus: UniffiRustCallStatus;
|
|
363
|
+
};
|
|
364
|
+
export type UniffiForeignFutureCompleteI32 = (
|
|
365
|
+
callbackData: bigint,
|
|
366
|
+
result: UniffiForeignFutureStructI32,
|
|
367
|
+
) => void;
|
|
368
|
+
export type UniffiForeignFutureStructU64 = {
|
|
369
|
+
returnValue: bigint;
|
|
370
|
+
callStatus: UniffiRustCallStatus;
|
|
371
|
+
};
|
|
372
|
+
export type UniffiForeignFutureCompleteU64 = (
|
|
373
|
+
callbackData: bigint,
|
|
374
|
+
result: UniffiForeignFutureStructU64,
|
|
375
|
+
) => void;
|
|
376
|
+
export type UniffiForeignFutureStructI64 = {
|
|
377
|
+
returnValue: bigint;
|
|
378
|
+
callStatus: UniffiRustCallStatus;
|
|
379
|
+
};
|
|
380
|
+
export type UniffiForeignFutureCompleteI64 = (
|
|
381
|
+
callbackData: bigint,
|
|
382
|
+
result: UniffiForeignFutureStructI64,
|
|
383
|
+
) => void;
|
|
384
|
+
export type UniffiForeignFutureStructF32 = {
|
|
385
|
+
returnValue: number;
|
|
386
|
+
callStatus: UniffiRustCallStatus;
|
|
387
|
+
};
|
|
388
|
+
export type UniffiForeignFutureCompleteF32 = (
|
|
389
|
+
callbackData: bigint,
|
|
390
|
+
result: UniffiForeignFutureStructF32,
|
|
391
|
+
) => void;
|
|
392
|
+
export type UniffiForeignFutureStructF64 = {
|
|
393
|
+
returnValue: number;
|
|
394
|
+
callStatus: UniffiRustCallStatus;
|
|
395
|
+
};
|
|
396
|
+
export type UniffiForeignFutureCompleteF64 = (
|
|
397
|
+
callbackData: bigint,
|
|
398
|
+
result: UniffiForeignFutureStructF64,
|
|
399
|
+
) => void;
|
|
400
|
+
export type UniffiForeignFutureStructPointer = {
|
|
401
|
+
returnValue: bigint;
|
|
402
|
+
callStatus: UniffiRustCallStatus;
|
|
403
|
+
};
|
|
404
|
+
export type UniffiForeignFutureCompletePointer = (
|
|
405
|
+
callbackData: bigint,
|
|
406
|
+
result: UniffiForeignFutureStructPointer,
|
|
407
|
+
) => void;
|
|
408
|
+
export type UniffiForeignFutureStructRustBuffer = {
|
|
409
|
+
returnValue: Uint8Array;
|
|
410
|
+
callStatus: UniffiRustCallStatus;
|
|
411
|
+
};
|
|
412
|
+
export type UniffiForeignFutureCompleteRustBuffer = (
|
|
413
|
+
callbackData: bigint,
|
|
414
|
+
result: UniffiForeignFutureStructRustBuffer,
|
|
415
|
+
) => void;
|
|
416
|
+
export type UniffiForeignFutureStructVoid = {
|
|
417
|
+
callStatus: UniffiRustCallStatus;
|
|
418
|
+
};
|
|
419
|
+
export type UniffiForeignFutureCompleteVoid = (
|
|
420
|
+
callbackData: bigint,
|
|
421
|
+
result: UniffiForeignFutureStructVoid,
|
|
422
|
+
) => void;
|
|
423
|
+
|
|
424
|
+
// UniffiRustFutureContinuationCallback is generated as part of the component interface's
|
|
425
|
+
// ffi_definitions. However, we need it in the runtime.
|
|
426
|
+
// We could:
|
|
427
|
+
// (a) do some complicated template logic to ensure the declaration is not generated here (possible)
|
|
428
|
+
// (b) import the generated declaration into the runtime (m a y b e) or…
|
|
429
|
+
// (c) generate the declaration anyway, and use a different declaration in the runtime.
|
|
430
|
+
//
|
|
431
|
+
// We chose (c) here as the simplest. In addition, we perform a compile time check that
|
|
432
|
+
// the two versions of `UniffiRustFutureContinuationCallback` are structurally equivalent.
|
|
433
|
+
//
|
|
434
|
+
// If you see the error:
|
|
435
|
+
// ```
|
|
436
|
+
// Type 'true' is not assignable to type 'false'.(2322)
|
|
437
|
+
// ```
|
|
438
|
+
// Then a new version of uniffi has changed the signature of the callback. Most likely, code in
|
|
439
|
+
// `typescript/src/async-rust-call.ts` will need to be changed.
|
|
440
|
+
//
|
|
441
|
+
// If you see the error:
|
|
442
|
+
// ```
|
|
443
|
+
// Cannot find name 'UniffiRustFutureContinuationCallback'. Did you mean 'RuntimeUniffiRustFutureContinuationCallback'?(2552)
|
|
444
|
+
// ```
|
|
445
|
+
// then you may not be using callbacks or promises, and uniffi is now not generating Futures and callbacks.
|
|
446
|
+
// You should not generate this if that is the case.
|
|
447
|
+
//
|
|
448
|
+
// ('You' being the bindings generator maintainer).
|
|
449
|
+
const isRustFutureContinuationCallbackTypeCompatible: UniffiStructuralEquality<
|
|
450
|
+
RuntimeUniffiRustFutureContinuationCallback,
|
|
451
|
+
UniffiRustFutureContinuationCallback
|
|
452
|
+
> = true;
|
|
453
|
+
const isUniffiForeignFutureTypeCompatible: UniffiStructuralEquality<
|
|
454
|
+
RuntimeUniffiForeignFuture,
|
|
455
|
+
UniffiForeignFuture
|
|
456
|
+
> = true;
|