chore: fix some validation issues

This commit is contained in:
2026-04-29 15:23:13 +02:00
parent 6669fda371
commit da3dee9ae7
5 changed files with 47 additions and 27 deletions
+14
View File
@@ -23,6 +23,20 @@ func NewKeyService(db *gorm.DB) *KeyService {
}
}
func (s *KeyService) ListValidKeyHashes() ([]string, error) {
keyRecords, err := database.ListKeys(s.db)
if err != nil {
return nil, err
}
hashList := make([]string, 0, len(keyRecords))
for _, k := range keyRecords {
hashList = append(hashList, k.KeyHash)
}
return hashList, nil
}
func (s *KeyService) Create(name string, expiresAt time.Time) (assets.KeyResponse, error) {
keyContent := security.GenerateChars(accessKeyLen)