Skip to content

np_passwords v0.1.0 ​

Codes, logins and a keychain for every lock on the server. Doors, safes, stashes, laptops, computer logins, Wi-Fi and 2FA all ask through np_passwords. A resource registers a lock once and later only asks "did this player get in?". It never stores, sends or sees the secret. Players get a Passwords app in np_phone that remembers what their character knows.

It uses the Nimbus UI look of np_hud and np_phone: grey glass, glossy squircle tiles, and colour only where it means something (green unlocked, orange weak or locked out, red leaked). It runs on es_extended, qbx_core and qb-core, or standalone (np_character aware). Items and stash locks work best with np_inventory, with ox_inventory and qb-inventory as fallbacks. Requires oxmysql and np_prophandler 1.1.0+ (doors and keypad props). No ox_lib.

PIN keypad with a saved code

Login with saved logins Password
Login Password
Phrase Pattern
Phrase Pattern
2FA code Create a code
OTP Create
Wrong code Locked out
Wrong Locked
Unlocked Save / update toasts
Unlocked Toasts
Cracking Shoulder surfing
Crack Surf
Warrant keychain read Liquid Glass
Warrant Liquid Glass

Passwords app in np_phone

The screenshots come from the browser mock (see Development). The UI ships in English and German.

At a glance ​

  • Locks live in np_passwords. RegisterLock once (or a static lock in the config), then Prompt(id) returns true or false. Lock codes are stored only as bcrypt hashes (GetPasswordHash) and compared on the server. See Locks & doors.
  • Six prompt types: PIN keypad, password, login (user + password), word phrase, 3×3 pattern and 6-digit 2FA code. Wrong tries count per lock for everyone; after 3 (default) the keypad locks for 45 s and the owner is alerted. See Prompts & autofill.
  • Keychain and autofill: what a character knows is stored encrypted per character. TAB fills a saved code, the login dropdown lists own and shared logins, and after a typed success a Save / Update toast (Y / N) follows. Autofill never sends the secret to the client.
  • Proximity prompts at locks with coords: E unlock with a saved code (or lock an open door again), G enter a code, H watch someone type. Doors are optional per lock and synced to everyone through np_prophandler, with auto-relock.
  • Create and rotate codes with a generator (PIN, password, phrase, pattern), rules from the caller and strength shown as time to crack. Owners change codes, hand out guest codes and see the history.
  • Passwords app in np_phone: categories, nearby doors, hold-to-reveal, share to a nearby player, paper notes, 2FA codes, a security check (leaked, weak, reused) and shared vaults for gangs, jobs and custom groups. See Passwords app.
  • 2FA: RequireCode(src, app) asks for a rotating 6-digit code. The first time, it arrives by SMS; after that it fills from the Codes tab. See 2FA codes.
  • Crime & police: code breaker cracking minigame, shoulder surfing, paper notes, leak detection, and a warrant keychain read for officers. See Crime & police.
  • Discord DMs (optional np_discord): players DM the bot passwords or password bank and get their saved codes as spoilers, also while offline. Off by default. See Discord DMs.
  • Stash locks for np_inventory stashes (stash:<id>) and an opt-in np_gangs gang stash lock.
  • For other NUIs: drop-in web components <np-password>, <np-password-new> and <np-otp>. The host page never gets the secret. See Web components.
  • Staff tools (optional np_admin): permission nodes instead of ACE, live settings, /pwlock and staff actions.

Quick example ​

lua
-- server: register a safe once (persisted, idempotent)
exports.np_passwords:RegisterLock({
  id = 'apt12:safe', label = 'Bedroom safe', icon = 'vault', type = 'pin', length = 6,
  owner = { type = 'char', id = cid }, coords = vector3(-1150.2, -1520.4, 10.6),
  generate = true,                 -- random code, saved to the owner's keychain
})
lua
-- client: ask for it (yields)
local ok, reason = exports.np_passwords:Prompt('apt12:safe')
if ok then TriggerServerEvent('apartments:openSafe', 'apt12') end
lua
-- server: trust only what np_passwords saw
RegisterNetEvent('apartments:openSafe', function(apt)
  if not exports.np_passwords:ConsumeUnlock(source, apt .. ':safe') then return end
  exports.np_inventory:OpenInventory(source, 'stash', apt .. '_safe')
end)

Next steps ​