kyc-sdk-react-native
v1.0.13
Published
A React Native SDK for handling KYC authentication, updates, and password management.
Readme
kyc-sdk-react-native
A React Native SDK for handling KYC authentication, updates, and password management.
Installation
Install the package using npm:
npm i kyc-sdk-react-nativeImporting the Package
Import the package in your React Native project:
import AcidCheck from "kyc-sdk-react-native";Usage
Before using the SDK, make sure to install the required Expo dependencies or their bare React Native equivalents. If you are using Expo, you can install the necessary packages with the following command:
npx expo install expo-battery expo-camera expo-device expo-location expo-screen-orientation expo-secure-store @react-native-async-storage/async-storage react-native-view-shotpackages like expo-battery, expo-camera, expo-device, expo-location, expo-screen-orientation, expo-secure-store, @react-native-async-storage/async-storage, and react-native-view-shot are required for the SDK to function properly. If you are not using Expo, you will need to install the bare React Native equivalents of these packages.
If you are using a bare React Native project, you can install the necessary packages using npm or yarn:
npm install @react-native-async-storage/async-storage expo-battery expo-camera expo-device expo-location expo-screen-orientation expo-secure-store react-native-view-shotor
yarn add @react-native-async-storage/async-storage expo-battery expo-camera expo-device expo-location expo-screen-orientation expo-secure-store react-native-view-shotMake sure to link the native modules if you are not using Expo. For React Native 0.60 and above, autolinking should handle this for you. If you are using an older version, you may need to manually link the packages.
These packages are necessary for the SDK to function properly within your React Native (Expo) project.
Setting Up the Component
import React, { useRef, useState } from "react";
import AcidCheck from "kyc-sdk-react-native";
const MyKYCComponent = () => {
const allRef = useRef<any>(null); // Create a reference
const [initializingData, setInitializingData] = useState({
acid: "", // User identifier
email: "", // User email
url: "", // API endpoint
channel: "", // Communication channel
});
const handleAuthenticate = () => {
if (allRef.current) {
allRef.current.handleAuthenticateKYC(); // Calls authentication function
}
};
const handleUpdate = () => {
if (allRef.current) {
allRef.current.handleUpdateKYC(); // Calls update function
}
};
const handleChangePassword = () => {
if (allRef.current) {
allRef.current.changePassword(); // Calls change password function
}
};
const handleResetPassword = () => {
if (allRef.current) {
allRef.current.resetPassword(); // Calls reset password function
}
};
return (
<View style={{ flex: 1, justifyContent: "center", alignItems: "center" }}>
<AcidCheck ref={allRef} initializingData={initializingData} />
</View>
);
};
export default MyKYCComponent;API Methods
The AcidCheck component provides the following methods that can be accessed via useRef:
handleAuthenticateKYC(): Initiates KYC authentication.handleUpdateKYC(): Updates user KYC information.changePassword(): Triggers a password change process.resetPassword(): Triggers a password reset process.
Props
initializingData (object)
An object containing the following properties:
| Property | Type | Description |
| --------- | ------ | --------------------- |
| acid | string | User identifier |
| email | string | User email |
| url | string | API endpoint |
| channel | string | Communication channel |
License
This package is licensed under MIT.
