api key auth added

This commit is contained in:
Ravi Prasad
2025-05-08 00:32:49 -05:00
parent 09d81c251a
commit 8c577b441c
17 changed files with 345 additions and 61 deletions
+17
View File
@@ -0,0 +1,17 @@
package models
import (
"time"
"gorm.io/gorm"
)
// APIKey is stored **hashed** (SHA256) and may be revoked at any time.
type APIKey struct {
ID uint `gorm:"primaryKey"`
Hash []byte `gorm:"uniqueIndex"`
Label string // e.g. “mobileapp”, “datapartnerX”
Revoked bool
CreatedAt time.Time
RevokedAt gorm.DeletedAt `gorm:"index"`
}