TrustNXTTrustNXT
React SDKAPI Reference

@trustnxt/protect-react

Classes

ClassDescription
AudioEngineUses WaveSurfer's RecordPlugin for capture and lamejs for MP3 transcoding. Emits state changes via onChange(), matching the CameraManager pattern.
ProtectionQueueGeneric protection queue engine — accepts inputs, processes them through a user-supplied function, and outputs sealed blobs via callbacks.
SensorCollectorFramework-agnostic sensor collector.

Interfaces

InterfaceDescription
AudioCaptureEvent-
AudioEngineOptionsConfiguration for initializing the Audio Engine.
AudioRecordingMetadata and blob payload for a completed audio recording.
BuildLabelContentOptionsOptions for building a LabelContent metadata payload.
CameraSettings-
CaptureControls-
CaptureEvent-
CaptureProtectedEventEvent fired immediately when an image is captured.
CaptureResultResult of a successful photo capture.
DeviceInfo-
DeviceOrientation-
ExtendedMediaTrackSettingsExtended media track settings that include non-standard properties exposed by some browsers (Chrome Android, etc.).
Features-
GpsData-
InspectAPIResponse-
LabelContent-
LocationProviderAdapter interface for location providers.
NetworkInfo-
PermissionStatesAggregated permission states for all SDK-relevant APIs.
PhotoCapabilitiesCapabilities of the active camera hardware.
ProtectAssetOptions-
ProtectControls-
ProtectedEventEvent fired when a capture has been cryptographically sealed.
ProtectErrorEventEvent fired when protection of a capture fails.
ProtectionCallbacksCallbacks fired during protection processing.
ProtectionOptionsConfiguration for the automatic protection pipeline inside useCapture.
ProtectionQueueItemSnapshot of a single queue item's state.
ProtectionQueueOptionsOptions for creating a ProtectionQueue.
ProtectionStateAggregate protection state exposed by useCapture.
ProtectOptionsOptions that control protection behavior (separate from label metadata).
ProtectResult-
Rectangle-
SensorCollectorOptions-
SensorSnapshotUnified snapshot of all device sensors at a given moment in time.
StandaloneProtectOptionsOptions for standalone asset protection (no React required).
StandaloneProtectResult-
UseCaptureAudioOptions-
UseCaptureImageOptions-
UsePermissionsResultAggregated permission states for all SDK-relevant APIs.
UseProtectOptions-
Vector3D-
ZoomRangeMinimum, maximum, and current step size for digital zoom on the active camera.

Type Aliases

Type AliasDescription
AudioEngineEventEvents emitted by the Audio Engine.
CellularTechnology-
FacingDirection the camera is pointing.
LocationPermissionStatus-
PermissionStateIndividual permission state.
PermissionStatusCamera permission lifecycle state.
ProtectionStatusProcessing status of a queued item.
ProtectSourceHow the asset was acquired — controls the C2PA action assertion.
RecordingStateCurrent lifecycle state of the audio engine.
UseCaptureOptions-

Variables

VariableDescription
isFirefoxAndroidReturns true if the current environment is Firefox on Android.
isIOSReturns true if the current environment is an iOS device.

Functions

FunctionDescription
blobToDataURLConvert a Blob to a Base64-encoded Data URL string.
buildLabelContentBuild a LabelContent payload from sensor, camera, and tag data.
extractCameraSettingsExtract camera settings from a captured image blob + media track settings.
getFirefoxAndroidStreamStyleCSS style object to fix Firefox Android video stream rotation.
inspectAssetInspect a protected asset's trust label for verification.
isMobileUserAgentReturns true if the current environment is a mobile device browser.
protectAssetProtect an existing asset (image, audio, etc.) without React.
queryAllPermissionsQuery all SDK-relevant permissions without triggering any prompts.
requestAllPermissionsRequest all SDK-relevant permissions. Triggers browser prompts for any permission not yet granted.
requestCameraPermissionRequest camera permission by briefly opening and closing a video stream. Returns the resulting permission state.
requestLocationPermissionRequest geolocation permission by performing a single position lookup. Returns the resulting permission state.
requestMicrophonePermissionRequest microphone permission by briefly opening and closing an audio stream. Returns the resulting permission state.
requestSensorPermissionRequest device sensor permission (iOS 13+). On non-iOS platforms this is a no-op that returns "granted".
useCapturePrimary capture hook — supports both image and audio modes.
useDeviceOrientationTracks the device's physical orientation angle (0, 90, 180, 270).
useKeepAwakeKeeps the screen awake using the Web Screen Wake Lock API.
usePermissionsAggregated permission states for camera, microphone, location, and sensors.
useProtectHook for protecting existing assets (not from camera/audio capture).

On this page