Three primitives the middleware leans on. Each is small; combined they're the entire AuthN story.
Bcrypt — storing the PIN without being able to recover it
Local IP bypass — convenience with an audit trail
The bypass is a deliberate trade: you accept that anyone on these IPs is "you", in exchange for not entering the PIN every time you reload from your dev machine. Two rules make it survivable.
- Be explicit about which IPs. Hardcode the set; don't accept "any RFC1918 address" by default.
- Log when it triggers. Future-you debugging "did the PIN work?" needs to see "bypassed because IP was in trusted list".