homebridge-prometheus-exporter/src/security.ts
Lars Strojny f8007b55ca
Add experimental support for basic auth and TLS (#23)
Allows restricting access to the monitoring endpoint using basic auth
and configure TLS certificates.
2022-11-16 22:19:08 +01:00

9 lines
228 B
TypeScript

import { compare } from 'bcrypt'
export function isAuthenticated(
username: string,
plainPassword: string,
map: Record<string, string>,
): Promise<boolean> {
return compare(plainPassword, map[username] || '')
}