# SprintCheck SDK for Expo

A React Native Expo SDK for identity verification services including BVN (Bank Verification Number), NIN (National Identification Number), and Facial verification.

## Features

- 🏦 **BVN Verification** - Verify Bank Verification Numbers
- 🆔 **NIN Verification** - Verify National Identification Numbers  
- 👤 **Facial Verification** - Biometric facial verification
- 📱 **Expo Compatible** - Works with Expo managed and bare workflows
- 🔒 **Secure** - End-to-end encryption for sensitive data
- 🚀 **Easy Integration** - Simple API with TypeScript support

## Installation

```bash
npm install sprintcheck-expo
```

or

```bash
yarn add sprintcheck-expo
```

## Configuration

### 1. Prebuild your project

Since this SDK uses native modules, you need to generate the native code:

```bash
expo prebuild
```

### 2. Add this to your MainApplication.kt

```kotlin
import com.sprintcheckrn.SprintCheckPackage

packages.add(SprintCheckPackage())
```

### 3. Run your project

```bash
expo run:android
```


> **Note**: Currently only Android is supported. iOS support coming soon.

## Usage

### Basic Setup

```typescript
import SprintCheck from 'sprintcheck-expo';

// Initialize the SDK
const initializeSDK = async () => {
  const result = await SprintCheck.initialize({
    apiKey: 'your-api-key',
    encryptionKey: 'your-encryption-key'
  });
  
  if (result.success) {
    console.log('SDK initialized successfully');
  } else {
    console.error('Failed to initialize SDK:', result.error);
  }
};
```

### BVN Verification

```typescript
const verifyBVN = async (email: string) => {
  try {
    const result = await SprintCheck.startBvnVerification(email);
    
    if (result.success) {
      console.log('BVN verification started:', result.data);
    } else {
      console.error('BVN verification failed:', result.error);
    }
  } catch (error) {
    console.error('Error:', error);
  }
};
```

### NIN Verification

```typescript
const verifyNIN = async (email: string) => {
  try {
    const result = await SprintCheck.startNinVerification(email);
    
    if (result.success) {
      console.log('NIN verification started:', result.data);
    } else {
      console.error('NIN verification failed:', result.error);
    }
  } catch (error) {
    console.error('Error:', error);
  }
};
```

### Facial Verification

```typescript
const verifyFace = async (email: string) => {
  try {
    const result = await SprintCheck.startFacialVerification(email);
    
    if (result.success) {
      console.log('Facial verification started:', result.data);
    } else {
      console.error('Facial verification failed:', result.error);
    }
  } catch (error) {
    console.error('Error:', error);
  }
};
```

## API Reference

### `initialize(config: SprintCheckConfig): Promise<VerificationResult>`

Initializes the SprintCheck SDK with your API credentials.

**Parameters:**
- `config.apiKey` (string): Your SprintCheck API key
- `config.encryptionKey` (string): Your encryption key

**Returns:** Promise resolving to a `VerificationResult`

### `startBvnVerification(email: string): Promise<VerificationResult>`

Starts the BVN verification process.

**Parameters:**
- `email` (string): User's email address

**Returns:** Promise resolving to a `VerificationResult`

### `startNinVerification(email: string): Promise<VerificationResult>`

Starts the NIN verification process.

**Parameters:**
- `email` (string): User's email address

**Returns:** Promise resolving to a `VerificationResult`

### `startFacialVerification(email: string): Promise<VerificationResult>`

Starts the facial verification process.

**Parameters:**
- `email` (string): User's email address

**Returns:** Promise resolving to a `VerificationResult`

### `getInitializationStatus(): boolean`

Returns the current initialization status of the SDK.

## Types

```typescript
interface SprintCheckConfig {
  apiKey: string;
  encryptionKey: string;
}

interface VerificationResult {
  success: boolean;
  message: string;
  data?: any;
  error?: string;
}
```

## Requirements

- Expo SDK 49+
- React Native 0.70+
- Android API level 24+
- Node.js 16+

## Troubleshooting

### Common Issues

1. **"SprintCheck doesn't seem to be linked" error**
   - Make sure you've run `expo prebuild`
   - Ensure the plugin is properly configured in your app.json
   - Try cleaning and rebuilding: `expo prebuild --clean`

2. **Build errors on Android**
   - Ensure your Android SDK is up to date
   - Check that minSdkVersion is at least 24
   - Try running `cd android && ./gradlew clean`

3. **Plugin not found**
   - Make sure you've installed the package correctly
   - Verify the plugin path in your app.json configuration

### Getting Help

If you encounter issues:

1. Contact support at info@megasprintlimited.com.ng

## License

MIT License - see [LICENSE](LICENSE) file for details.

## Support

- 📧 Email: info@megasprintlimited.com.ng
- 📖 Documentation: [Click here](https://api.sprintcheck.megasprintlimited.com.ng/api/documentation)
