React SDKAPI ReferenceFunctions
protectAsset()
function protectAsset(blob, options): Promise<StandaloneProtectResult>;Protect an existing asset (image, audio, etc.) without React.
This is a standalone function that performs the full protection pipeline:
- Creates an API client from the API key
- Sets up middleware if a secret is provided
- Collects sensor data (if not provided and
collectSensors !== false) - Seals the asset with a trust label
Parameters
| Parameter | Type |
|---|---|
blob | Blob |
options | StandaloneProtectOptions |
Returns
Promise<StandaloneProtectResult>
Example
import { protectAsset } from '@trustnxt/protect-react';
const file = document.querySelector('input[type=file]').files[0];
const { protectedBlob } = await protectAsset(file, {
apiKey: 'tnxt_live_...',
tags: { source: 'upload' },
});