Documentation
¶
Index ¶
- func GenerateKey() (string, error)
- func GetOrgID(c *fiber.Ctx) string
- func HasPermission(info *KeyInfo, permission string) bool
- func RequireAuth(m *Manager) fiber.Handler
- type KeyInfo
- type Manager
- func (m *Manager) Close()
- func (m *Manager) CreateKey(name, orgID, permissions string) (string, error)
- func (m *Manager) DeleteKey(id int64) error
- func (m *Manager) EnsureBootstrap() (string, error)
- func (m *Manager) ListKeys(orgID string) ([]KeyInfo, error)
- func (m *Manager) VerifyKey(key string) *KeyInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateKey ¶
GenerateKey creates a new API key with the mtk_ prefix
func HasPermission ¶
HasPermission checks if a key has a specific permission
func RequireAuth ¶
RequireAuth returns Fiber middleware that validates API keys
Types ¶
type KeyInfo ¶
type KeyInfo struct {
ID int64 `json:"id"`
Name string `json:"name"`
OrgID string `json:"org_id"`
Permissions []string `json:"permissions"`
CreatedAt time.Time `json:"created_at"`
ExpiresAt time.Time `json:"expires_at,omitempty"`
Enabled bool `json:"enabled"`
}
KeyInfo represents API key metadata
func GetKeyInfo ¶
GetKeyInfo extracts the key info from the Fiber context
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles API key authentication
func NewManager ¶
NewManager creates a new auth manager using the metadata DB
func (*Manager) EnsureBootstrap ¶
EnsureBootstrap creates the default org and admin key if none exist
Click to show internal directories.
Click to hide internal directories.