Sensitive Screens¶
Part of the Human Scoring use case.
Pause capture while sensitive input is on screen, such as a password, a card number or a one-time code. While paused, the SDK records nothing. The session continues, and capture picks up where it left off when you resume.
When to use it¶
- A login or PIN screen is open
- A payment form is open
- Any screen your privacy policy says is not recorded
Prerequisites¶
- The SDK is installed and initialized. See the Quick Start.
Usage¶
Pause and resume¶
import * as Dea from '@dea/react-native';
await Dea.pause();
// … sensitive screen …
await Dea.resume();
- Calls run in the order you make them. Await
pause()before showing the sensitive content if it must not be captured at all. - Always pair
pause()withresume(). Time spent paused adds no actions, so a session left paused never becomes sufficient and its classification staysinsufficient. resume()does not override consent: if the user has not agreed, nothing is recorded after resuming either.
Note:
pause()andresume()do not nest. Oneresume()restarts capture however many timespause()was called, so two parts of your app that pause on their own interfere: the first one to resume restarts capture while the other still shows sensitive content. Give pausing one owner, or count the pauses yourself and callresume()only when the count is back to zero.
Examples¶
Pause for as long as a screen is shown¶
import {useEffect} from 'react';
import {TextInput, View} from 'react-native';
import * as Dea from '@dea/react-native';
export function PaymentScreen() {
useEffect(() => {
Dea.pause().catch(() => {});
return () => {
Dea.resume().catch(() => {});
};
}, []);
return (
<View>
<TextInput placeholder="Card number" keyboardType="number-pad" />
<TextInput placeholder="CVC" secureTextEntry />
</View>
);
}
Pause while the screen is focused (React Navigation)¶
With a navigator, a screen stays mounted when another is pushed on top of it. Pause on focus instead:
import {useCallback} from 'react';
import {useFocusEffect} from '@react-navigation/native';
import * as Dea from '@dea/react-native';
export function usePauseDea() {
useFocusEffect(
useCallback(() => {
Dea.pause().catch(() => {});
return () => {
Dea.resume().catch(() => {});
};
}, []),
);
}
Pause while a password field has focus¶
import {TextInput} from 'react-native';
import * as Dea from '@dea/react-native';
export function PasswordField() {
return (
<TextInput
placeholder="Password"
secureTextEntry
onFocus={() => Dea.pause().catch(() => {})}
onBlur={() => Dea.resume().catch(() => {})}
/>
);
}
API¶
| Member | Returns | Description |
|---|---|---|
pause() |
Promise<void> |
Stops recording. The session is kept |
resume() |
Promise<void> |
Starts recording again |