chore: fix some validation issues
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user