iOS SDK ⁠-⁠ Sanitize sensitive data

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")
.sensitive()
import ORTracker

ORTracker.shared.addIgnoredView(view)

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)
    print(json)
  } catch {
    print("Error deserializing JSON: \(error)")
  }
}

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