TrustNXTTrustNXT
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:

  1. Creates an API client from the API key
  2. Sets up middleware if a secret is provided
  3. Collects sensor data (if not provided and collectSensors !== false)
  4. Seals the asset with a trust label

Parameters

ParameterType
blobBlob
optionsStandaloneProtectOptions

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' },
});

On this page