React SDKAPI Reference
@trustnxt/protect-react
Classes
| Class | Description |
|---|---|
| AudioEngine | Uses WaveSurfer's RecordPlugin for capture and lamejs for MP3 transcoding. Emits state changes via onChange(), matching the CameraManager pattern. |
| ProtectionQueue | Generic protection queue engine — accepts inputs, processes them through a user-supplied function, and outputs sealed blobs via callbacks. |
| SensorCollector | Framework-agnostic sensor collector. |
Interfaces
| Interface | Description |
|---|---|
| AudioCaptureEvent | - |
| AudioEngineOptions | Configuration for initializing the Audio Engine. |
| AudioRecording | Metadata and blob payload for a completed audio recording. |
| BuildLabelContentOptions | Options for building a LabelContent metadata payload. |
| CameraSettings | - |
| CaptureControls | - |
| CaptureEvent | - |
| CaptureProtectedEvent | Event fired immediately when an image is captured. |
| CaptureResult | Result of a successful photo capture. |
| DeviceInfo | - |
| DeviceOrientation | - |
| ExtendedMediaTrackSettings | Extended media track settings that include non-standard properties exposed by some browsers (Chrome Android, etc.). |
| Features | - |
| GpsData | - |
| InspectAPIResponse | - |
| LabelContent | - |
| LocationProvider | Adapter interface for location providers. |
| NetworkInfo | - |
| PermissionStates | Aggregated permission states for all SDK-relevant APIs. |
| PhotoCapabilities | Capabilities of the active camera hardware. |
| ProtectAssetOptions | - |
| ProtectControls | - |
| ProtectedEvent | Event fired when a capture has been cryptographically sealed. |
| ProtectErrorEvent | Event fired when protection of a capture fails. |
| ProtectionCallbacks | Callbacks fired during protection processing. |
| ProtectionOptions | Configuration for the automatic protection pipeline inside useCapture. |
| ProtectionQueueItem | Snapshot of a single queue item's state. |
| ProtectionQueueOptions | Options for creating a ProtectionQueue. |
| ProtectionState | Aggregate protection state exposed by useCapture. |
| ProtectOptions | Options that control protection behavior (separate from label metadata). |
| ProtectResult | - |
| Rectangle | - |
| SensorCollectorOptions | - |
| SensorSnapshot | Unified snapshot of all device sensors at a given moment in time. |
| StandaloneProtectOptions | Options for standalone asset protection (no React required). |
| StandaloneProtectResult | - |
| UseCaptureAudioOptions | - |
| UseCaptureImageOptions | - |
| UsePermissionsResult | Aggregated permission states for all SDK-relevant APIs. |
| UseProtectOptions | - |
| Vector3D | - |
| ZoomRange | Minimum, maximum, and current step size for digital zoom on the active camera. |
Type Aliases
| Type Alias | Description |
|---|---|
| AudioEngineEvent | Events emitted by the Audio Engine. |
| CellularTechnology | - |
| Facing | Direction the camera is pointing. |
| LocationPermissionStatus | - |
| PermissionState | Individual permission state. |
| PermissionStatus | Camera permission lifecycle state. |
| ProtectionStatus | Processing status of a queued item. |
| ProtectSource | How the asset was acquired — controls the C2PA action assertion. |
| RecordingState | Current lifecycle state of the audio engine. |
| UseCaptureOptions | - |
Variables
| Variable | Description |
|---|---|
| isFirefoxAndroid | Returns true if the current environment is Firefox on Android. |
| isIOS | Returns true if the current environment is an iOS device. |
Functions
| Function | Description |
|---|---|
| blobToDataURL | Convert a Blob to a Base64-encoded Data URL string. |
| buildLabelContent | Build a LabelContent payload from sensor, camera, and tag data. |
| extractCameraSettings | Extract camera settings from a captured image blob + media track settings. |
| getFirefoxAndroidStreamStyle | CSS style object to fix Firefox Android video stream rotation. |
| inspectAsset | Inspect a protected asset's trust label for verification. |
| isMobileUserAgent | Returns true if the current environment is a mobile device browser. |
| protectAsset | Protect an existing asset (image, audio, etc.) without React. |
| queryAllPermissions | Query all SDK-relevant permissions without triggering any prompts. |
| requestAllPermissions | Request all SDK-relevant permissions. Triggers browser prompts for any permission not yet granted. |
| requestCameraPermission | Request camera permission by briefly opening and closing a video stream. Returns the resulting permission state. |
| requestLocationPermission | Request geolocation permission by performing a single position lookup. Returns the resulting permission state. |
| requestMicrophonePermission | Request microphone permission by briefly opening and closing an audio stream. Returns the resulting permission state. |
| requestSensorPermission | Request device sensor permission (iOS 13+). On non-iOS platforms this is a no-op that returns "granted". |
| useCapture | Primary capture hook — supports both image and audio modes. |
| useDeviceOrientation | Tracks the device's physical orientation angle (0, 90, 180, 270). |
| useKeepAwake | Keeps the screen awake using the Web Screen Wake Lock API. |
| usePermissions | Aggregated permission states for camera, microphone, location, and sensors. |
| useProtect | Hook for protecting existing assets (not from camera/audio capture). |