Development ​
Layout ​
fxmanifest.lua
shared/lib/ 00_core (NpPw namespace, bridge selection, validators), 01_locale,
02_strength (crack-time model), 03_generate (PIN / password / phrase / pattern)
shared/config.lua Config.*
shared/np_admin_settings.lua permission nodes + settings editable in np_admin
shared/locales/ en / de (Lua strings; web strings live in TypeScript)
bridge/np_admin.lua vendored np_admin lib (npAdmin.*), works without np_admin
bridge/framework/client/ 0_common 1_qbx 2_qb 3_esx 9_standalone
bridge/framework/server/ 0_common 1_qbx 2_qb 3_esx 9_standalone
bridge/inventory/server/ 0_common 1_np 2_ox 3_qb 9_none
server/ 00_server 01_db 02_crypto 03_rpc 04_locks 05_keychain 06_prompt 07_create
08_vaults 09_otp 10_crack 11_items 12_phone 13_integrations 14_doors
20_exports 30_commands
client/ 00_state 01_nui 02_rpc 03_prompt 04_create 05_crack 06_world 07_menu
08_warrant 10_api
sql/np_passwords.sql schema (also run at start with Config.AutoCreateTables)
web/ NUI: React 18 + Vite 5 + TypeScript strict + zustand
index.html = prompts / generator / crack / toasts / warrant,
phone.html = np_phone Passwords app, src/components = np-pw.js web components
design/ Nimbus UI tokens and CSS (shared copy, never edited)
tests/ plain-Lua harness + run.sh
Files are numbered so the glob order in fxmanifest.lua is deterministic. Code resolves NpPw.X when it is called,
never at file load. All SQL lives in server/01_db.lua, so the tests swap it for an in-memory store.
server/02_crypto.lua is pure Lua (SHA-256, HMAC, keystream encryption, base64) and needs no native.
30_commands.lua loads last and boots the server once every module exists.
The strength model exists twice, in shared/lib/02_strength.lua and web/src/lib/strength.ts. Both are tested
against the same vectors (PIN 1234 → 10 s weak, 4821 → 5000 s good, 482197 strong, hunter2 strong,
grove-taco-lamp-42 strong, pattern 1259 → 812 s good), so the generator's hint and the server always agree.
Build ​
cd web
npm ci
npm run build # FiveM guard check + tsc --noEmit + vite build + the components build
npm test # vitest
npm run dev # browser mock with a dev bar
npm run screenshots # mock build into dist-mock, then headless Chrome → web/screenshots/*.png
npm run build writes web/dist/index.html, web/dist/phone.html and web/dist/components/np-pw.js (a second Vite
build with vite.components.config.ts, one ES module without dependencies).
It first runs scripts/check-fivem-guard.mjs. index.html and phone.html set html.nb-fivem before the first
paint, and the CSS turns backdrop-filter off under it and uses a denser glass tint instead. In FiveM a blurred
surface renders as a black box over the game. The guard fails the build when CSS uses backdrop-filter but the
html.nb-fivem rule or the code that sets the class is missing.
The vitest suites cover the strength model, the generator and rule checks, key mapping, the prompt and create stores, the web components (the secret never reaches an attribute, property or event), the phone app logic, and a CSS lint for the silver line on gradient + border surfaces.
Browser mock ​
npm run dev runs the UI without FiveM, with mock data and a dev bar. URL parameters pick a screen:
| Page | Parameter | Values |
|---|---|---|
index.html |
screen |
pin, login, password, phrase, pattern, otp, create, crack, wrong, locked, unlocked, surf, toast, warrant |
phone.html |
screen |
home, doors, logins, detail, codes, security, shared, vault, deleted, change, guest, new, overview |
| both | lang |
de |
| both | material |
liquid |
phone.html |
streamer |
1 (streamer mode) |
phone.html |
frame |
1 (inside a phone frame) |
index.html |
shot |
1 (no dev bar, for screenshots) |
npm run screenshots renders every screen of both pages (scripts/screenshots.sh, then
scripts/screenshots-phone.sh) into web/screenshots/. The screenshots on these pages come from there. Pass a name
filter to render only some (bash scripts/screenshots.sh pin) and SCALE=3 for close-up checks.
Tests ​
bash tests/run.sh # luac -p on every Lua file, then the server and client suites (plain Lua 5.4)
VERBOSE=1 bash tests/run.sh # with resource log lines and stubbed natives
The harness (tests/harness.lua, tests/harness_fakes.lua) stubs the FiveM natives (including
GetPasswordHash / VerifyPasswordHash), oxmysql (in-memory store), es_extended players, np_inventory, np_hud,
np_phone and np_gangs. The server suite drives everything through RPCs, exports, events, the phone app RPCs and the
admin command: registration and persistence, prompts and autofill, lockouts, guest codes, verifiers, save offers,
create and rules, vaults and rotation, 2FA, cracking, shoulder surfing, leaks, notes, warrant reads, stash locks,
doors and rate limits. Every secret used in the tests is checked against every client event, so a leak to a client
fails the suite. The client suite covers the exports, NUI callbacks, pushes, proximity prompts and web component
routes.
Try it in game ​
/pwlock add pin Test door 1234 with the node np_passwords.locks places a lock at your position. See
Installation → Check it works and Events & commands.