@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
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { sha1 } from "@noble/hashes/legacy.js";
|
|
4
|
+
import { generate, getPublicKeyFixed } from "@pagopa/io-react-native-crypto";
|
|
5
|
+
import { base64, base64nopad, base64url, base64urlnopad } from "@scure/base";
|
|
6
|
+
const CONTENT_KEY_TAG = "ZCAM1_CONTENT_KEY_TAG";
|
|
7
|
+
// Flexible base64 decoder that handles both standard and url-safe formats, with or without padding.
|
|
8
|
+
// iOS Secure Enclave returns keys in varying formats depending on the iOS version.
|
|
9
|
+
function flexibleBase64Decode(str) {
|
|
10
|
+
const isUrlSafe = str.includes("-") || str.includes("_");
|
|
11
|
+
const hasPadding = str.includes("=");
|
|
12
|
+
if (isUrlSafe) {
|
|
13
|
+
return hasPadding ? base64url.decode(str) : base64urlnopad.decode(str);
|
|
14
|
+
}
|
|
15
|
+
return hasPadding ? base64.decode(str) : base64nopad.decode(str);
|
|
16
|
+
}
|
|
17
|
+
export async function getContentPublicKey() {
|
|
18
|
+
return await getPublicKeyFixed(CONTENT_KEY_TAG).catch(() => {
|
|
19
|
+
return generate(CONTENT_KEY_TAG);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
export function getSecureEnclaveKeyId(publicKey) {
|
|
23
|
+
if (publicKey.kty === "EC") {
|
|
24
|
+
const x = flexibleBase64Decode(publicKey.x);
|
|
25
|
+
const y = flexibleBase64Decode(publicKey.y);
|
|
26
|
+
const out = new Uint8Array(1 + x.length + y.length);
|
|
27
|
+
out[0] = 0x04; // uncompressed point format
|
|
28
|
+
out.set(x, 1);
|
|
29
|
+
out.set(y, 1 + x.length);
|
|
30
|
+
return sha1(out);
|
|
31
|
+
} else {
|
|
32
|
+
throw "Invalid key type";
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["sha1","generate","getPublicKeyFixed","base64","base64nopad","base64url","base64urlnopad","CONTENT_KEY_TAG","flexibleBase64Decode","str","isUrlSafe","includes","hasPadding","decode","getContentPublicKey","catch","getSecureEnclaveKeyId","publicKey","kty","x","y","out","Uint8Array","length","set"],"sourceRoot":"../../src","sources":["common.tsx"],"mappings":";;AAAA,SAASA,IAAI,QAAQ,yBAAyB;AAC9C,SAASC,QAAQ,EAAEC,iBAAiB,QAAwB,gCAAgC;AAC5F,SAAS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AC,EAAE,CAAC,GAAGD,CAAC,CAACI,MAAM,CAAC;IAExB,OAAOvB,IAAI,CAACqB,GAAG,CAAC;EAClB,CAAC,MAAM;IACL,MAAM,kBAAkB;EAC1B;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// This file was autogenerated by some hot garbage in the `uniffi-bindgen-react-native` crate.
|
|
4
|
+
// Trust me, you don't want to mess with it!
|
|
5
|
+
|
|
6
|
+
// Casting globalThis to any allows us to look for `NativeZcam1C2paUtils`
|
|
7
|
+
// if it was added via JSI.
|
|
8
|
+
//
|
|
9
|
+
// We use a getter here rather than simply `globalThis.NativeZcam1C2paUtils` so that
|
|
10
|
+
// if/when the startup sequence isn't just so, an empty value isn't inadvertantly cached.
|
|
11
|
+
const getter = () => globalThis.NativeZcam1C2paUtils;
|
|
12
|
+
export default getter;
|
|
13
|
+
|
|
14
|
+
// Structs and function types for calling back into Typescript from Rust.
|
|
15
|
+
|
|
16
|
+
// UniffiRustFutureContinuationCallback is generated as part of the component interface's
|
|
17
|
+
// ffi_definitions. However, we need it in the runtime.
|
|
18
|
+
// We could:
|
|
19
|
+
// (a) do some complicated template logic to ensure the declaration is not generated here (possible)
|
|
20
|
+
// (b) import the generated declaration into the runtime (m a y b e) or…
|
|
21
|
+
// (c) generate the declaration anyway, and use a different declaration in the runtime.
|
|
22
|
+
//
|
|
23
|
+
// We chose (c) here as the simplest. In addition, we perform a compile time check that
|
|
24
|
+
// the two versions of `UniffiRustFutureContinuationCallback` are structurally equivalent.
|
|
25
|
+
//
|
|
26
|
+
// If you see the error:
|
|
27
|
+
// ```
|
|
28
|
+
// Type 'true' is not assignable to type 'false'.(2322)
|
|
29
|
+
// ```
|
|
30
|
+
// Then a new version of uniffi has changed the signature of the callback. Most likely, code in
|
|
31
|
+
// `typescript/src/async-rust-call.ts` will need to be changed.
|
|
32
|
+
//
|
|
33
|
+
// If you see the error:
|
|
34
|
+
// ```
|
|
35
|
+
// Cannot find name 'UniffiRustFutureContinuationCallback'. Did you mean 'RuntimeUniffiRustFutureContinuationCallback'?(2552)
|
|
36
|
+
// ```
|
|
37
|
+
// then you may not be using callbacks or promises, and uniffi is now not generating Futures and callbacks.
|
|
38
|
+
// You should not generate this if that is the case.
|
|
39
|
+
//
|
|
40
|
+
// ('You' being the bindings generator maintainer).
|
|
41
|
+
const isRustFutureContinuationCallbackTypeCompatible = true;
|
|
42
|
+
const isUniffiForeignFutureTypeCompatible = true;
|
|
43
|
+
//# sourceMappingURL=zcam1_c2pa_utils-ffi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["getter","globalThis","NativeZcam1C2paUtils","isRustFutureContinuationCallbackTypeCompatible","isUniffiForeignFutureTypeCompatible"],"sourceRoot":"../../../src","sources":["generated/zcam1_c2pa_utils-ffi.ts"],"mappings":";;AAAA;AACA;;AA8SA;AACA;AACA;AACA;AACA;AACA,MAAMA,MAAmC,GAAGA,CAAA,KAAOC,UAAU,CAASC,oBAAoB;AAC1F,eAAeF,MAAM;;AAErB;;AAgHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,8CAGL,GAAG,IAAI;AACR,MAAMC,mCAGL,GAAG,IAAI","ignoreList":[]}
|