goldwarden-vaultwarden-bitw.../agent/systemauth/biometrics/touchid.go

23 lines
352 B
Go
Raw Normal View History

2023-09-12 01:26:46 +02:00
//go:build darwin
2023-09-12 01:22:48 +02:00
package biometrics
2023-09-12 02:54:46 +02:00
import (
touchid "github.com/lox/go-touchid"
)
2023-09-12 01:22:48 +02:00
func CheckBiometrics(approvalType Approval) bool {
2023-09-12 01:26:16 +02:00
ok, err := touchid.Authenticate(approvalType.String())
2023-09-12 01:22:48 +02:00
if err != nil {
2023-09-12 02:54:46 +02:00
log.Error(err)
2023-09-12 01:22:48 +02:00
}
if ok {
2023-09-12 02:54:46 +02:00
log.Info("Authenticated")
2023-09-12 01:22:48 +02:00
return true
} else {
2023-09-12 02:54:46 +02:00
log.Error("Failed to authenticate")
2023-09-12 01:22:48 +02:00
return false
}
}