Sanitize Data (iOS)

Sanitized views will be blurred out in the resulting replay. You can add any UI component and it will be automatically removed (to preserve memory) as soon as its not on screen.

Simply add .sensitive() modifier to desired component.

import ORTracker

Text("Very important sensitive text")
import ORTracker


SDK exports ORSanitizedView which you can use to wrap your sensitive components with to blur them out.

import OR from '@openreplay/react-native'

// ... your app UI

    <SensitiveComponent />

// ...

Two keys are exported to automatically trim the request/response data: ignoredKeys for body and ignoredHeaders for headers. Both, request and response will be sanitized, but body will only be affected if its a valid JSON.

Simply assign a list of strings that you would like to sanitize:

let networkListener = NetworkListener()
networkListener.ignoredHeaders = ["mySecretToken"]
networkListener.ignoredKeys = ["password"]

It is also possible to change the response data before passing it to the listener:

// ... request

var sanitizedData
if let data = data {
  do {
    let json = try JSONSerialization.jsonObject(with: data, options: [])
    sanitizedData = customSanitizeFunction(data)
  } catch {
    print("Error deserializing JSON: \(error)")

networkListener.finish(response: response, data: sanitizedData)