Skip to main content
import { useCallback, useState } from 'react';
import { Transcrypts, type VerificationResult } from 'transcrypts';

const transcrypts = new Transcrypts({ apiKey: 'your-api-key' });

export function VerifyButton() {
  const [result, setResult] = useState<VerificationResult | null>(null);
  const [loading, setLoading] = useState(false);

  const handleVerify = useCallback(async () => {
    setLoading(true);
    try {
      const res = await transcrypts.verify({ ssn: '123-45-6789' });
      setResult(res);
    } catch (err) {
      console.error('Verification error:', err);
    } finally {
      setLoading(false);
    }
  }, []);

  return (
    <div>
      <button onClick={handleVerify} disabled={loading}>
        {loading ? 'Verifying...' : 'Verify Employment'}
      </button>
      {result?.verified && <p>Verified successfully.</p>}
    </div>
  );
}