Security Best Practices

The Inkrypt Videos React Native SDK is a bridge around the native iOS and Android SDKs. All security protections are provided by the underlying native layer. This guide summarises what those protections are and what your React Native app must handle correctly.

For full detail on any topic, refer to the native guides:


Overview

AreaWho Is Responsible
FairPlay license enforcement (iOS)SDK - automatic
Screen recording / capture prevention (iOS)SDK via FairPlay - automatic
Screen capture blocking via FLAG_SECURE (Android)SDK - automatic in release builds
Developer mode detection (Android)SDK - automatic; bypass in dev with tolerateDeveloperMode
OTP generation and deliveryYour backend
Keeping OTPs out of source code and logsYour app

OTP Handling

An OTP authorises playback of a specific video. It must come from your backend, not your app binary.

Generate OTPs on Your Backend

// Correct: fetch a fresh OTP from your backend at playback time
const loadVideo = async (videoId: string) => {
  const otp = await MyBackend.fetchOtp(videoId);
  setParams({ videoId, otp, autoPlay: true });
};
// Incorrect: OTP hardcoded in source
setParams({
  videoId: 'abc123',
  otp: 'HARDCODED_OTP', // never do this
});

Keep OTPs Short-Lived

Request the OTP immediately before presenting the player. Do not persist it to AsyncStorage or device storage between sessions.

Never Log OTPs

// Incorrect: OTP appears in logs
console.log(`Starting playback: videoId=${params?.videoId} otp=${params?.otp}`);

// Correct: log only non-sensitive identifiers
console.log(`Starting playback: videoId=${params?.videoId}`);

Apply the same caution to crash reporters (e.g. Sentry, Crashlytics). Redact OTPs before they are attached to any report.


Android-Specific Protections

Screen Capture Blocking

The Android SDK applies FLAG_SECURE automatically in release builds. No code changes are needed in your React Native app. Debug builds leave the flag off so you can freely screenshot during development.

Developer Mode Detection

The SDK blocks playback when Android Developer Options or USB Debugging is enabled. During development, suppress this check with tolerateDeveloperMode:

setParams({
  videoId,
  otp,
  tolerateDeveloperMode: true, // dev/debug builds only — never ship this
});

Never set tolerateDeveloperMode={true} in production. It disables a security gate that protects your content.


iOS-Specific Protections

FairPlay DRM

The iOS SDK uses FairPlay DRM. Protection is hardware-bound and does not function in the iOS Simulator or in Android emulators. Always test DRM-protected playback on a physical device.

FairPlay enforces the following automatically, no code is required from your app:

ProtectionEnforced By
Screen recording preventioniOS / FairPlay
AirPlay mirroring restrictionsiOS / FairPlay
Screenshot blocking during playbackiOS / FairPlay
HDMI output restrictionsiOS / FairPlay

Related Guides