This guide covers security best practices for integrating the Inkrypt Videos SDK, including OTP handling, credential hygiene, and what the SDK's DRM layer protects automatically.
Overview
The Inkrypt Videos SDK is built around FairPlay DRM, which provides hardware-enforced content protection on iOS devices. That protection only holds if the credentials flowing into the SDK are handled correctly on the app side.
| Area | Who Is Responsible |
|---|---|
| FairPlay license enforcement | SDK (automatic) |
| Screen recording / capture prevention | SDK via FairPlay (automatic) |
| OTP generation and delivery | Your backend |
| Keeping OTPs out of source code and logs | Your app |
OTP Handling
An OTP (One-Time Password) is the short-lived credential that authorises playback of a specific video. It is the most sensitive value the SDK receives.
Generate OTPs on Your Backend
Never generate OTPs on-device or embed them in your app binary. OTPs must come from a server you control, delivered over HTTPS to the authenticated user.
// Correct: fetch a fresh OTP from your backend at playback time
func loadVideo(videoId: String) async {
let otp = try await MyBackend.fetchOTP(for: videoId)
await MainActor.run {
params.update(videoId: videoId, otp: otp)
}
}
// Incorrect: OTP hardcoded in source
let params = InkPlayerParams(
videoId: "abc123",
otp: "HARDCODED_OTP" // never do this
)
Keep OTPs Short-Lived
Request the OTP from your backend as close to playback as possible, ideally in the same step that presents the player view. The longer an OTP sits in memory or in transit, the larger the window for it to be intercepted or replayed.
Why this matters
OTPs are single-use credentials. If an unexpired OTP leaks, a third party could use it to request a FairPlay license for the protected video on their own device.
Never Log OTPs
Logging frameworks, crash reporters, and analytics pipelines can inadvertently capture OTPs if you pass them directly into log calls.
// Incorrect: OTP appears in logs
print("Loading video with params: \(params)")
// Correct: log only non-sensitive identifiers
print("Loading video: \(params.videoId ?? "unknown")")
Apply the same caution to error reporting tools (e.g., Crashlytics, Sentry). Filter or redact OTPs before they are attached to crash reports.
Credential Storage
OTPs should not be persisted between sessions. They are short-lived by design, and storing them creates an unnecessary attack surface.
| Storage Location | Verdict | Reason |
|---|---|---|
In-memory only (e.g., @State, @StateObject) | Recommended | Cleared when the app is backgrounded or terminated |
UserDefaults | Avoid | Persists to disk; accessible without encryption on unprotected devices |
| Keychain | Avoid for OTPs | Intended for long-lived secrets; overkill and misleading for short-lived tokens |
| Log files / crash reports | Never | Plaintext on disk; often uploaded to third-party services |
DRM and FairPlay
Physical Devices Only
FairPlay DRM is hardware-bound. It does not function on the iOS Simulator. Always test DRM-protected playback on a physical device.
Attempting to play DRM content in the Simulator will produce an error, see the Errors Guide for details.
What FairPlay Protects Automatically
When the SDK acquires a FairPlay license, iOS enforces the following at the OS level, no extra code is required from your app:
| Protection | Enforced By |
|---|---|
| Screen recording prevention | iOS / FairPlay |
| AirPlay mirroring restrictions | iOS / FairPlay |
| Screenshot blocking during playback | iOS / FairPlay |
| HDMI output restrictions | iOS / FairPlay |
Note
These protections apply only while a FairPlay license is active. If your app allows downloading or caching of content outside the SDK, those protections do not automatically extend to the cached files.
Logging and Error Reporting
The SDK surfaces errors through the onError callback. When forwarding these to your logging or monitoring pipeline, follow these guidelines:
onError: { errorCode, errorMessage in
// Safe: log error signal without sensitive params
MyAnalytics.shared.logEvent("player_error", properties: [
"code": errorCode as Any,
"message": errorMessage as Any
// Do NOT include the OTP or full InkPlayerParams here
])
}
See the Errors Guide for the full list of error messages and what they mean.