1.1.1 • Published 12 months ago
@plasho/sdk v1.1.1
Plasho SDK
A React/Next.js SDK for integrating Plasho's ID verification system into your web application.
Installation
npm install @plasho/sdkUsage
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 imagesrequestEmailVerification(data): Request email verificationrequestCameraAccess(): Request camera access
PlashoForm
A React component for collecting user information.
Props
onSubmit: Callback function when form is submittedonError: 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 imagesonError: Optional callback function for handling errors
License
MIT