Fix passphrase login: use ESM imports for node:crypto
Used `require('node:crypto')` inline for timingSafeEqual + createHash,
but the server is ESM (package.json type=module) — `require` isn't
defined in that scope so the finish call threw "require is not defined"
and the browser surfaced it as the login error. Hoist the imports to
the top of the file.