exam-proctor-sdk
v1.1.2
Published
A Node.js SDK for integrating exam proctoring features(Registration + verification) into your applications.
Downloads
504
Maintainers
Readme
exam-proctor-sdk
Lightweight Express middleware for in-page exam proctoring — no iframes, no sidecars, no separate processes.
How It Works
exam-proctor-sdk mounts directly into your existing Express app as middleware.
It handles registration, session verification, and client-side proctoring inside
your app's same-origin flow without iframes or a sidecar service.
Your Express App
└── app.use(examProctor.middleware(config))
├── GET /proctor/register
├── GET /proctor/verify
├── GET /proctor/api/session-token
└── GET /proctor/proctor-bundle.js ← injected client SDKInstall
npm install exam-proctor-sdkQuick Start
const express = require('express');
const examProctor = require('exam-proctor-sdk');
const app = express();
// 1. Mount the middleware
app.use(examProctor.middleware({
// your config here
}));
// 2. Inject the config tag and bundle in your HTML response
app.get('/exam', (req, res) => {
res.send(`
<html>
<head>
${examProctor.configScriptTag({ /* config */ })}
</head>
<body>
<script src="/proctor/proctor-bundle.js"></script>
<!-- your exam UI here -->
</body>
</html>
`);
});
app.listen(3000);Exam Flow
/ → /proctor/register → /proctor/verify → /exam → /result- Student lands on
/and is redirected to/proctor/register - After registration, identity is verified at
/proctor/verify - On success, student proceeds to
/exam - On submit, session ends and student sees
/result
Server API
These are exported directly from require('exam-proctor-sdk'):
| Export | Type | Description |
|---|---|---|
| middleware(config) | function | Express middleware — mounts all /proctor/* routes into your app |
| configScriptTag(config) | function | Returns an inline <script> tag with runtime config for the client |
| registerUrl() | function | Returns the registration route path (/proctor/register) |
| verifyUrl(sessionId) | function | Returns the verification route path for a given session |
Client API
Once /proctor/proctor-bundle.js is loaded in the browser, the global ExamProctor object is available:
// Start proctoring for a student session
ExamProctor.start(sessionId, studentName);
// Stop proctoring (call on exam submit or timeout)
ExamProctor.stop();
// Get current proctoring mode
ExamProctor.getMode(); // → 'full' | 'basic' | 'tab-only' | 'stopped'Model Loading
Detection models are loaded from CDN by default:
https://cdn.jsdelivr.net/gh/Murali55-09/violation-detect@models-cdn/Self-hosting: Place model files locally and point to them via your middleware(config) options. Local models in exam-proctor-sdk/models/* are supported as a fallback for air-gapped or offline environments.
Headers
The SDK expects your Express app to serve pages with the following headers for full browser API access (camera, cross-origin isolation):
Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Embedder-Policy: require-corp
Cross-Origin-Resource-Policy: same-originRequirements
- Node.js >= 18
- Express >= 4
License
MIT
