
Security News
npm βisβ Package Hijacked in Expanding Supply Chain Attack
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.
genuine-verify-sdk
Advanced tools
Privacy-first human verification widget using React, Next.js, and TensorFlow.js
A privacy-first, real-time human verification widget (anti-bot) for React apps. Uses TensorFlow.js and BlazeFace for gesture-based verificationβno CAPTCHAs, no user friction.
npm install genuine-verify-sdk
# or
yarn add genuine-verify-sdk
Peer dependencies:
import { GenuineWidgetEmbeddable } from 'genuine-verify-sdk';
function MyApp() {
const handleTokenIssued = (payload: {
token: string;
metadata: {
issuedAt: string;
expiresAt: string;
gestureType: string;
};
}) => {
// Send token to your backend or validate client-side
console.log('Token:', payload.token);
console.log('Metadata:', payload.metadata);
};
return (
<GenuineWidgetEmbeddable
onTokenIssued={handleTokenIssued}
tokenTTL={300}
debug={true}
/>
);
}
The widget provides real-time visual feedback during verification:
import { GenuineWidgetEmbeddable } from 'genuine-verify-sdk';
function MyApp() {
const handleTokenIssued = (payload: {
token: string;
metadata: {
issuedAt: string;
expiresAt: string;
gestureType: string;
};
}) => {
// Send token to your backend or validate client-side
console.log('Token:', payload.token);
console.log('Metadata:', payload.metadata);
};
return (
<GenuineWidgetEmbeddable
onTokenIssued={handleTokenIssued}
tokenTTL={300}
debug={true}
/>
);
}
Prop | Type | Default | Description |
---|---|---|---|
onTokenIssued | (payload: { token: string; metadata: { issuedAt: string; expiresAt: string; gestureType: string; } }) => void | β | Required. Called when token is issued with metadata |
onFailure | (context: FailureContext) => void | β | Called when gesture detection fails after max attempts |
maxAttempts | number | 3 | Maximum attempts before triggering fallback |
fallback | React.ComponentType<{ failureContext: FailureContext; triggerRetry: () => void }> | β | Custom fallback component to render on failure |
tokenTTL | number | 300 | Token time-to-live (seconds) |
debug | boolean | false | Show debug panel |
headTiltThreshold | number | 15 | Head tilt angle threshold (degrees) |
persist | boolean | true | Persist token in sessionStorage |
trigger | 'auto' | 'manual' | 'auto' | When to start detection |
onStartRef | (startFn: () => void) => void | β | Get manual start function |
onError | (error: Error) => void | β | Error callback |
All utilities are available as named exports:
import {
verifyToken,
createPresenceToken,
getStoredToken,
storeToken,
clearStoredToken,
isStoredTokenValid,
createMockToken
} from 'genuine-verify-sdk';
const result = await verifyToken(token);
if (result.valid) {
// Token is valid!
} else {
// Token is invalid or expired
}
Check human verification status with real-time updates:
import { useVerificationStatus } from 'genuine-verify-sdk'
function MyApp() {
const { isVerified, token, expiresIn, timeRemaining, clearToken } = useVerificationStatus()
return (
<div>
{isVerified ? (
<div>
<p>β
Human verified! Expires in {timeRemaining}</p>
<button onClick={clearToken}>Clear Verification</button>
</div>
) : (
<p>β Human not verified</p>
)}
</div>
)
}
Hook Features:
The SDK automatically handles gesture failures and edge cases.
Reasons for fallback include:
gesture_timeout
: User didnβt complete gesture in timecamera_error
: Camera blocked or inaccessiblemodel_error
: Face detection failedmax_attempts_reached
: Too many failed triesunknown
: Unexpected errorDevelopers can pass an onFailure
callback to capture detailed failure context.
You can provide a custom fallback component via the fallback
prop.
If no fallback is provided, the SDK shows a default UI with retry.
Fallbacks also expose a triggerRetry()
helper to restart verification.
Usage Example:
<GenuineWidgetEmbeddable
onTokenIssued={handleToken}
onFailure={handleFailure}
maxAttempts={3}
fallback={MyCustomFallback}
/>
Control when verification starts with flexible trigger modes:
import { GenuineWidgetEmbeddable, useGenuineTrigger } from 'genuine-verify-sdk'
function MyApp() {
const [startFunction, setStartFunction] = useState(null)
// Auto-start (default)
return (
<GenuineWidgetEmbeddable
onTokenIssued={handleTokenIssued}
trigger="auto"
/>
)
// Manual button
return (
<GenuineWidgetEmbeddable
onTokenIssued={handleTokenIssued}
trigger="manual"
/>
)
// Programmatic control
return (
<GenuineWidgetEmbeddable
onTokenIssued={handleTokenIssued}
trigger="manualStart"
onStartRef={setStartFunction}
/>
)
}
Advanced Programmatic Control:
import { useGenuineTrigger } from 'genuine-verify-sdk'
function MyApp() {
const [startFunction, setStartFunction] = useState(null)
const [isDetectionActive, setIsDetectionActive] = useState(false)
const [isModelReady, setIsModelReady] = useState(false)
const triggerControls = useGenuineTrigger(
startFunction,
null, // stopFn
null, // resetFn
isDetectionActive,
isModelReady,
{
onStart: () => setIsDetectionActive(true),
onStop: () => setIsDetectionActive(false)
}
)
const handleFormSubmit = (e) => {
e.preventDefault()
triggerControls.startDetection() // Trigger on form submit
}
return (
<form onSubmit={handleFormSubmit}>
<GenuineWidgetEmbeddable
onTokenIssued={handleTokenIssued}
trigger="manualStart"
onStartRef={setStartFunction}
/>
<button type="submit">Submit Form</button>
</form>
)
}
Trigger Features:
POST /api/verify-human
Authorization: Bearer <token>
{ "token": "<token>" }
Returns:
{
"valid": true,
"reason": null,
"gestureType": "headTilt",
"expiresIn": 299,
"issuedAt": "2025-01-06T20:00:00.000Z"
}
import { GenuineWidgetEmbeddable, verifyToken } from 'genuine-verify-sdk';
function Demo() {
const [status, setStatus] = useState<string | null>(null);
const handleTokenIssued = async (payload: {
token: string;
metadata: {
issuedAt: string;
expiresAt: string;
gestureType: string;
};
}) => {
const result = await verifyToken(payload.token);
setStatus(result.valid ? 'β
Valid' : 'β Invalid');
};
return (
<>
<GenuineWidgetEmbeddable onTokenIssued={handleTokenIssued} />
{status && <div>{status}</div>}
</>
);
}
GenuineWidgetEmbeddable
(main widget)verifyToken
, `FAQs
Privacy-first human verification widget using React, Next.js, and TensorFlow.js
The npm package genuine-verify-sdk receives a total of 332 weekly downloads. As such, genuine-verify-sdk popularity was classified as not popular.
We found that genuine-verify-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.Β It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.
Security News
A critical flaw in the popular npm form-data package could allow HTTP parameter pollution, affecting millions of projects until patched versions are adopted.
Security News
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.