home
jsjiit is a browser JavaScript wrapper for the JIIT student WebPortal. It logs in, encrypts payloads, and calls StudentPortalAPI so a web app can read attendance, grades, exams, and account data without the portal UI.
This page matches package 0.0.22 in the clone at /tmp/docs-refresh/jsjiit. The README still shows CDN [email protected]. Pin 0.0.22 unless you have checked jsjiit or jsDelivr for a newer publish. JPortal has imported CDN 0.0.27; that build may add things such as useProxy / proxyUrl. Those fields are not in this repo’s src/wrapper.js. Do not assume they exist here.
Install: Getting started. Methods: API reference. Internals: Architecture and design.
What it does#
- Login through
student_loginwithDEFCAPTCHAso you do not solve the image CAPTCHA - Attendance metadata, semester totals, daily subject rows
- Registered subjects and faculty, subject choice print
- Exam events and schedules
- Grade card, SGPA/CGPA, marks PDF download
- Personal info, bank details, password change, hostel allocation, fee summary, pending fines
- Feedback submit via
fill_feedback_form
It is an ES module ("type": "module"). Runtime is the browser: fetch plus window.crypto.subtle. There is no Node-compatible HTTP layer in 0.0.22.
Modules#
src/index.js re-exports the public surface. src/wrapper.js owns HTTP. Domain files own models.
flowchart TB idx["src/index.js"] wrap["src/wrapper.js<br/>WebPortal, WebPortalSession, API, DEFCAPTCHA"] att["src/attendance.js<br/>AttendanceHeader, Semester, AttendanceMeta"] reg["src/registration.js<br/>RegisteredSubject, Registrations"] exam["src/exam.js<br/>ExamEvent"] enc["src/encryption.js<br/>generate_local_name, serialize_payload"] ex["src/exceptions.js"] util["src/utils.js"] fb["src/feedback.js<br/>FeedbackOptions default export"] idx --> wrap idx --> att idx --> reg idx --> exam idx --> enc idx --> ex wrap --> att wrap --> reg wrap --> exam wrap --> enc wrap --> ex enc --> util
FeedbackOptions lives in src/feedback.js and is not re-exported from src/index.js. Call fill_feedback_form with strings such as "EXCELLENT".
WebPortal holds this.session. Authenticated methods hang on WebPortal, not on WebPortalSession. WebPortalSession stores JWT fields and builds headers.
Login and __hit#
sequenceDiagram participant App participant WP as WebPortal participant Enc as encryption.js participant Portal as StudentPortalAPI App->>WP: student_login(user, pass) WP->>Enc: serialize_payload pret token WP->>Portal: POST /token/pretoken-check Portal-->>WP: response WP->>Enc: serialize_payload plus password WP->>Portal: POST /token/generate-token1 Portal-->>WP: regdata plus JWT WP->>WP: session = new WebPortalSession App->>WP: get_attendance_meta WP->>WP: __hit authenticated WP->>Portal: POST with Bearer and LocalName Portal-->>App: AttendanceMeta
After login, most calls go through WebPortal.__hit. Authenticated requests use session.get_headers() (Authorization: Bearer <jwt> and LocalName). Unauthenticated requests still send LocalName from generate_local_name(). __hit does not call deserialize_payload. The portal returns JSON. serialize_payload encrypts many request bodies; some methods send plain JSON.
Models and errors#
| Class | File | Role |
|---|---|---|
AttendanceHeader |
attendance.js |
branchdesc, name, programdesc, stynumber |
Semester |
attendance.js |
registration_code, registration_id from registrationcode / registrationid |
AttendanceMeta |
attendance.js |
headers, semesters, latest_header(), latest_semester() |
RegisteredSubject |
registration.js |
Faculty, credits, subject ids |
Registrations |
registration.js |
total_credits, subjects |
ExamEvent |
exam.js |
Event code, ids, registration_id |
| Error | Base | When |
|---|---|---|
APIError |
Error |
Default __hit failure |
LoginError |
APIError |
Login endpoints |
AccountAPIError |
Error |
change_password |
SessionError |
Error |
Session base |
SessionExpired |
SessionError |
HTTP 401 |
NotLoggedIn |
SessionError |
authenticated() wrapper, session == null |
Package and build#
flowchart LR src["src/*.js"] build["build.mjs esbuild"] min["dist/jsjiit.min.esm.js"] dev["dist/jsjiit.esm.js"] npm["npm package 0.0.22"] cdn["jsDelivr"] src --> build build --> min build --> dev min --> npm dev --> npm npm --> cdn
- Name:
jsjiit, version 0.0.22, license ISC, authorcodeblech main:src/index.jsmodule/browser/exports.importandexports.require:dist/jsjiit.esm.jsfiles:dist,src- Scripts:
build→node build.mjs,prepare→npm run build,docs→jsdoc -c jsdoc.conf.json --verbose - Dev deps only:
[email protected],jsdoc@^4.0.4
Minimal usage#
import { WebPortal } from "https://cdn.jsdelivr.net/npm/[email protected]/dist/jsjiit.min.esm.js";
const portal = new WebPortal();
await portal.student_login("username", "password");
const meta = await portal.get_attendance_meta();
const attendance = await portal.get_attendance(meta.latest_header(), meta.latest_semester());
Put that in <script type="module">. Credentials go to https://webportal.jiit.ac.in:6011/StudentPortalAPI. CORS and mixed-content rules apply.