Initial commit: Luminary AI Gateway
CI / docker (push) Successful in 2m4s

OpenAI-compatible AI gateway with Vue admin UI, multi-provider egress,
ingress key governance, monitoring, and security controls.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
renjue
2026-06-23 21:46:16 +08:00
commit 76ba500417
134 changed files with 18988 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
package auth
import (
"strings"
"golang.org/x/crypto/bcrypt"
)
func HashPassword(password string) (string, error) {
b, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)
return string(b), err
}
func CheckPassword(hash, password string) bool {
return bcrypt.CompareHashAndPassword([]byte(hash), []byte(password)) == nil
}
// HashIngressKey stores a SHA-256 hex digest for O(1) cache lookup.
func HashIngressKey(key string) string {
return HashToken(key)
}
func IsLegacyIngressHash(hash string) bool {
return strings.HasPrefix(hash, "$2a$") || strings.HasPrefix(hash, "$2b$")
}
// CheckIngressKey verifies legacy bcrypt-hashed ingress keys.
func CheckIngressKey(hash, key string) bool {
return bcrypt.CompareHashAndPassword([]byte(hash), []byte(key)) == nil
}