verifyBasicAuth
Verify a Basic Auth username/password pair against the configured credentials. Uses a constant-time comparison to prevent timing attacks. Useful for custom auth flows where you need to check credentials outside a middleware context.
Returns false immediately when Basic Auth is not configured (i.e.,
basicAuth was not passed to the constructor). For full request validation
including Bearer and API key fallbacks, use
validate() or attach
middleware() to your Hono app.
Parameters
username
The username to verify.
password
The password to verify.
Returns
boolean — true if the credentials match; false if they don’t, or if
Basic Auth was not configured.