Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

initCapture

Initializes the device by generating hardware-backed keys and App Attest attestation. Call once on app startup.

Usage

import { initCapture } from "@succinctlabs/react-native-zcam1";
 
// iOS: appId is required ("TEAM_ID.BUNDLE_ID")
// Android: appId can be omitted
const captureInfo = await initCapture({
  appId: process.env.EXPO_PUBLIC_APP_ID, // iOS only
  production: false
});

Parameters

settings

Configuration for initialization.

type Settings = {
  appId?: string;     // iOS only: "TEAM_ID.BUNDLE_ID" — not needed on Android
  production: boolean; // false for dev, true for production
}
Field Details:
  • appId (string, iOS only) - The app identifier in TEAM_ID.BUNDLE_ID format (e.g., "NLS5R4YCGX.com.example.myapp"). Required on iOS — omitting it will throw. Find your Team ID in Xcode under Signing & Capabilities or in the Apple Developer portal. On Android, the package name is derived automatically from the app bundle and this field is ignored.
  • production (boolean, required) - false for development, true for production App Attest environment

Returns

Promise<CaptureInfo>

Device information including keys and attestation:

type CaptureInfo = {
  appId: string;
  deviceKeyId: string;          // App Attest device key ID
  contentPublicKey: ECKey;       // Secure Enclave content key
  contentKeyId: Uint8Array;      // Derived content key identifier
  attestation: string;           // App Attest attestation blob
}

Pass this to ZCamera as the captureInfo prop. See CaptureInfo type reference for details.

Example

import { useEffect, useState } from "react";
import { initCapture, type CaptureInfo } from "@succinctlabs/react-native-zcam1";
 
function App() {
  const [captureInfo, setCaptureInfo] = useState<CaptureInfo>();
 
  useEffect(() => {
    initCapture({
      appId: process.env.EXPO_PUBLIC_APP_ID!,
      production: false,
    }).then(setCaptureInfo);
  }, []);
 
  if (!captureInfo) {
    return <Text>Initializing...</Text>;
  }
 
  return <ZCamera captureInfo={captureInfo} />;
}

Notes

  • Generates Secure Enclave keys on first call; subsequent calls load existing keys
  • App Attest only works on physical devices; uses mock values in simulators
  • Safe to call multiple times - keys are persisted in encrypted storage