@humansecurity/react-native-sdk
v1.0.3
Published
A React Native wrapper for the Human Security SDK providing a React Native interface to enable seamless integration and access to bot defender and account defender features.
Downloads
36
Readme
@humansecurity/react-native-sdk
A React Native wrapper for the Human Security SDK providing a React Native interface to enable seamless integration and access to bot defender and account defender features.
Installation
From your terminal, run:
npm install @humansecurity/react-native-sdkFor iOS, don’t forget to install pods:
cd ios && pod install && cd ..Usage Example
import HumanSecurity from '@humansecurity/react-native-sdk';
//Display the version in a text to confirm integration:
<Text>HumanSecurity SDK Version: {HumanSecurity.sdkVersion()}</Text>
API Documentation
The full Documentation and usage examples can be found at our official site.
The current API:
sdkVersion(): string;
startWithAppId(appId: string, policy?: { [key: string]: string }): Promise<void>;
startWithAppIds(appIds: string[], policy?: { [key: string]: string }): Promise<void>;
vid(appId: string): string | null;
// BD functionality
headersForURLRequest(appId?: string): { [key: string]: string };
handleResponse(response: string): Promise<number>;
canHandleResponse(response: string): boolean;
challengeReferenceId(): string;
setCustomParameters(parameters: { [key: string]: string }, appId?: string): Promise<void>;
// Bot Defender Delegates Events
onBotDefenderEvent: EventEmitter<BotDefenderEvent>;
// Adding AD functions
setUserId(userId: string | null, appId?: string): Promise<void>;
registerOutgoingUrlRequest(url: string, appId?: string): Promise<void>;
setAdditionalData(parameters: { [key: string]: string },appId?: string): Promise<void>;
Where BotDefenderEvent is defined as:
BotDefenderEvent {
event:
| 'botDefenderRequestBlocked'
| 'botDefenderChallengeSolved'
| 'botDefenderChallengeCancelled'
| 'botDefenderChallengeRendered'
| 'botDefenderChallengeRenderFailed'
| 'botDefenderDidUpdateHeaders';
appId: string;
headers?: { [key: string]: string };
}Old Installation of bare React Native projects
For bare React Native workflow projects that require the SDK on both the native platforms and in JavaScript, please refer to our [documentation](https://docs.humansecurity.com/applications-and-accounts/docs/react-native-integration-legacy
