1.1.1 • Published 12 months ago

@plasho/sdk v1.1.1

Weekly downloads
-
License
MIT
Repository
-
Last release
12 months ago

Plasho SDK

A React/Next.js SDK for integrating Plasho's ID verification system into your web application.

Installation

npm install @plasho/sdk

Usage

import { PlashoSDK, PlashoForm, PlashoCamera } from '@plasho/sdk';

// Initialize the SDK
const plasho = new PlashoSDK({
  apiKey: 'your-api-key',
});

// In your React component
function VerificationComponent() {
  const handleSubmit = async (data) => {
    try {
      // Request email verification
      await plasho.requestEmailVerification(data);
    } catch (error) {
      console.error('Verification failed:', error);
    }
  };

  const handleImagesCapture = async (images: string[]) => {
    try {
      // Verify ID using captured images
      const result = await plasho.verifyId(images);
      console.log('Verification successful:', result);
    } catch (error) {
      console.error('Verification failed:', error);
    }
  };

  return (
    <div>
      <PlashoForm
        onSubmit={handleSubmit}
        onError={(error) => console.error(error)}
      />
      <PlashoCamera
        onImagesCapture={handleImagesCapture}
        onError={(error) => console.error(error)}
      />
    </div>
  );
}

Features

  • User information collection form
  • Camera access for ID verification
  • Automatic image capture and base64 conversion
  • Email verification
  • API integration with Plasho services

API Reference

PlashoSDK

Constructor

const plasho = new PlashoSDK({
  apiKey: string
});

Methods

  • verifyId(images: string[]): Verify user ID using two base64-encoded images
  • requestEmailVerification(data): Request email verification
  • requestCameraAccess(): Request camera access

PlashoForm

A React component for collecting user information.

Props

  • onSubmit: Callback function when form is submitted
  • onError: Optional callback function for handling errors

PlashoCamera

A React component for capturing images from the user's camera.

Props

  • onImagesCapture: Callback function that receives an array of two base64-encoded images
  • onError: Optional callback function for handling errors

License

MIT

1.1.1

12 months ago

1.0.2

12 months ago

1.0.0

12 months ago