sentinel-js-sdk
v1.0.0-beta.5
Published
Sentinel JS SDK for proctoring setup, consent, and device checks.
Downloads
9
Readme
Sentinel SDK
AI-driven proctoring solution, built with React, TypeScript, and Vite, that ensures integrity and authenticity for online exams, certification courses, and other proctoring-related activities.
Installation
Install the package using npm or yarn:
# Using npm
npm install sentinel-js-sdk
# Using yarn
yarn add sentinel-js-sdk
# Using pnpm
pnpm add sentinel-js-sdkGetting Started
Prerequisites
Make sure you have Node.js and yarn (or npm/pnpm) installed on your machine.
Usage
1. Initialize SDK
// Get SDK instance
const sdk = TPSentinelSDK.getInstance();
// Initialize with your organization code
sdk.initialize('your-org-code-here');3. Start Proctoring
// Start a proctoring session with default policies
const proctor = await sdk.startProctor('session-123', 'session-token-abc');
// Or with custom policy overrides
const proctor = await sdk.startProctor('session-123', 'session-token-abc', {
enableSnapshot: true,
snapshotInterval: 30,
snapshotResolution: '720p',
anomalyDetectionTypes: ['multi_face', 'no_face', 'tab_switching', 'browser_minimize'],
recordingEnabled: true,
recordingMaxDuration: 3600
});4. Set Checkpoint
// Set a checkpoint within the session
await proctor.setCheckpoint('checkpoint-1');
// Or with custom policy overrides for the checkpoint
await proctor.setCheckpoint('checkpoint-1', {
snapshotInterval: 15,
anomalyDetectionTypes: ['multi_face', 'tab_switching']
});5. Complete Checkpoint
// Complete a checkpoint
await proctor.completeCheckpoint('checkpoint-1');6. Capture Custom Events
// Capture custom events
await proctor.capture('user_interaction', {
action: 'click',
element: 'submit-button'
});7. Stop Proctoring
// Stop the proctoring session
await proctor.stop();API Reference
TPSentinelSDK
getInstance()
Get the singleton instance of the SDK.
initialize(orgCode)
Initialize the SDK with your organization code.
Parameters:
orgCode(string): Your organization code
startProctor(sessionId, sessionToken, overridePolicies?)
Start a proctoring session.
Parameters:
sessionId(string): Unique session identifiersessionToken(string): Session authentication tokenoverridePolicies(ProctoringPolicies, optional): Policy overrides for the session
Returns: Proctor instance
ProctoringPolicies
Configuration object for proctoring behavior:
interface ProctoringPolicies {
// Snapshot Settings
enableSnapshot?: boolean;
snapshotInterval?: number; // seconds
snapshotResolution?: '480p' | '720p' | '1080p';
// Anomaly Detection
anomalyDetectionTypes?: AnomalyType[];
enableAnomalyClip?: boolean;
anomalyClipDuration?: number; // seconds
anomalyClipResolution?: '480p' | '720p' | '1080p';
// Recording Settings
recordingEnabled?: boolean;
recordingMaxDuration?: number; // seconds
recordingResolution?: '480p' | '720p' | '1080p';
// Event tracking
trackNavigationChanges?: boolean;
// Device & Identity
deviceCheckEnabled?: boolean;
idleTimeThreshold?: number; // seconds
identityVerificationType?: string;
identityCheckAttemptLimit?: number;
}AnomalyType
Available anomaly detection types:
type AnomalyType =
| 'multi_face' // Multiple faces detected
| 'no_face' // No face detected
| 'tab_switching' // Tab switching detected
| 'phone_usage' // Phone usage detected
| 'browser_minimize' // Browser window minimized
| 'browser_special_key' // Special keys pressed (F12, Ctrl+Shift+I, etc.)
| 'browser_permission_revocation' // Camera/microphone permissions revoked
| 'screen_share' // Screen sharing detected
| 'looking_away'; // Person looking away from cameraProctor
setCheckpoint(checkpointId, overridePolicies?)
Set a checkpoint within the session.
Parameters:
checkpointId(string): Checkpoint identifieroverridePolicies(ProctoringPolicies, optional): Policy overrides for the checkpoint
completeCheckpoint(checkpointId)
Complete a checkpoint.
Parameters:
checkpointId(string): Checkpoint identifier to complete
capture(eventName, eventData)
Capture a custom event.
Parameters:
eventName(string): Event nameeventData(object): Event data
stop()
Stop the proctoring session.
Default Policies
The SDK comes with sensible default policies:
{
enableSnapshot: true,
snapshotInterval: 30,
snapshotResolution: '720p',
enableAnomalyClip: true,
anomalyClipDuration: 15,
anomalyClipResolution: '720p',
anomalyDetectionTypes: [
'multi_face',
'tab_switching',
'no_face',
'phone_usage',
'browser_minimize',
'browser_special_key',
'browser_permission_revocation',
'screen_share',
'looking_away'
],
deviceCheckEnabled: true,
identityVerificationType: 'face_and_document',
identityCheckAttemptLimit: 3,
idleTimeThreshold: 300,
trackNavigationChanges: true,
recordingEnabled: true,
recordingMaxDuration: 3600,
recordingResolution: '1080p',
}License
This project is licensed under the MIT License - see the LICENSE file for details.
