|
1 | 1 | --- |
2 | | -title: Using Custom Redact for Session Replay |
| 2 | +title: Using Custom Masking for Session Replay |
3 | 3 | sidebar_order: 5501 |
4 | 4 | notSupported: |
5 | | -description: "Learn how to redact parts of your app's data in Session Replay." |
| 5 | +description: "Learn how to mask parts of your app's data in Session Replay." |
6 | 6 | --- |
7 | 7 |
|
8 | 8 | <Alert> |
9 | 9 |
|
10 | | -If you custom redact your Session Replays, you may accidentally expose sensitive customer data. Be sure to double-check what you choose to expose. |
| 10 | +If you choose to use custom masking in your Session Replays, you may accidentally expose sensitive customer data. Be sure to double-check what you choose to expose. |
11 | 11 |
|
12 | 12 | </Alert> |
13 | 13 |
|
14 | | -By default, our Session Replay SDK masks all text content, images, and user input. This helps ensure that no sensitive data will be exposed. You can also manually choose which parts of your app's data to redact by using the different options listed below. |
| 14 | +By default, our Session Replay SDK masks all text content, images, and user input. This helps ensure that no sensitive data will be exposed. You can also manually choose which parts of your app's data you want to mask by using the different options listed below. |
15 | 15 |
|
16 | 16 |
|
17 | | -## Redact by View Class |
| 17 | +## Mask by View Class |
18 | 18 |
|
19 | | -You can choose which type of view you want to redact or ignore by using the `redactViewClasses` or `ignoreViewClasses` options. |
| 19 | +You can choose which type of view you want to mask or ignore by using the `maskedViewClasses` or `unmaskedViewClasses` options. |
20 | 20 |
|
21 | | -Let's say you have a custom view that you want to redact and a `UILabel` subclass (which normally would be redacted) that you want to ignore. You can set the options like this: |
| 21 | +Let's say you have a custom view that you want to mask and a `UILabel` subclass (which normally would be masked) that you doesn't want to mask. You can set the options like this: |
22 | 22 |
|
23 | 23 | ```swift |
24 | | - options.experimental.sessionReplay.redactViewClasses = [MyCustomView.self] |
25 | | - options.experimental.sessionReplay.ignoreViewClasses = [MyCustomLabel.self] |
| 24 | + options.experimental.sessionReplay.maskedViewClasses = [MyCustomView.self] |
| 25 | + options.experimental.sessionReplay.unmaskedViewClasses = [MyCustomLabel.self] |
26 | 26 | ``` |
27 | 27 |
|
28 | | -## Redact by View Instance |
| 28 | +## Mask by View Instance |
29 | 29 |
|
30 | | -You can also choose to redact or ignore a specific view instance by using the [replay API](/api/replays/) or view extensions like this: |
| 30 | +You can also choose to mask or unmask a specific view instance by using the [replay API](/api/replays/) or view extensions like this: |
31 | 31 |
|
32 | 32 | ```swift |
33 | | - SentrySDK.replay.redactView(view: view) |
34 | | - SentrySDK.replay.ignoreView(view: label) |
| 33 | + SentrySDK.replay.maskView(view: view) |
| 34 | + SentrySDK.replay.unmaskView(view: label) |
35 | 35 | ``` |
36 | 36 | or |
37 | 37 |
|
38 | 38 | ```swift |
39 | | - view.sentryReplayRedact() |
40 | | - label.sentryReplayIgnore() |
| 39 | + view.sentryReplayMask() |
| 40 | + label.sentryReplayUnmask() |
41 | 41 | ``` |
42 | 42 |
|
43 | 43 | ## SwiftUI |
44 | 44 |
|
45 | | -Because of the way SwiftUI is transformed into UIKit, it will often be over-redacted. A modifier like `background` uses the same element as an `Image`. |
46 | | -In order to control the SwiftUI redact process, you first need to disable the default redaction options: |
| 45 | +Because of the way SwiftUI is transformed into UIKit, it will often be over-masked. A modifier like `background` uses the same element as an `Image`. |
| 46 | +In order to control the SwiftUI masking process, you need to use the `sentryReplayUnmask` and/or `sentryReplayMask` modifiers. |
47 | 47 |
|
| 48 | +In this example we want to show the message, but not the user name. |
48 | 49 | ```swift |
49 | | - options.experimental.sessionReplay.redactAllText = false |
50 | | - options.experimental.sessionReplay.redactAllImages = false |
| 50 | + @Binding var user: String |
| 51 | + |
| 52 | + var body: some View { |
| 53 | + VStack { |
| 54 | + Text("Hello") |
| 55 | + .sentryReplayUnmask() |
| 56 | + Text("\(user)") |
| 57 | + } |
| 58 | + } |
51 | 59 | ``` |
52 | 60 |
|
53 | | -Then you can manually choose which `View` you want to redact with the `replayRedact` modifier: |
| 61 | +In this example, we need to unmask the VStack because its background element will be masked by default. |
| 62 | +To hide the username, we need to mask it. |
| 63 | + |
| 64 | +```swift |
| 65 | + @Binding var user: String |
54 | 66 |
|
55 | | -```swift |
56 | | - var body: some View { |
57 | | - Text("Hello, World!") |
58 | | - .sentryReplayRedact() |
| 67 | + var body: some View { |
| 68 | + VStack { |
| 69 | + Text("Hello") |
| 70 | + Text("\(user)") |
| 71 | + .sentrtReplayMask() |
59 | 72 | } |
| 73 | + .background(.blue) |
| 74 | + .sentryReplayUnmask() |
| 75 | + } |
60 | 76 | ``` |
61 | 77 |
|
62 | | -<Note> |
63 | | -Disabling the default redaction options will expose all text and images in the session replay. |
64 | | -Make sure to redact them manually. |
65 | | -</Note> |
| 78 | +<Alert> |
| 79 | + |
| 80 | +Before publising an App with Session Replay enabled, make sure to test it thoroughly to ensure that no sensitive data is exposed. |
66 | 81 |
|
| 82 | +</Alert> |
0 commit comments