Initial commit

This commit is contained in:
blankhex committed 2026-10-15 23:25:46 +03:00
commit c578b91c2d
46 files changed
+3241

No files matched your search

+31
View File
@@ -0,0 +1,31 @@
package auth
import "time"
type Session struct {
Token string
UserId int64
Device string
Address string
CreatedAt time.Time
ExpiresAt time.Time
}
type Invite struct {
Token string
Uses int64
CreatedAt time.Time
ExpiresAt time.Time
}
func (s *Session) CreatedAtLocal() string {
return s.CreatedAt.Local().Format("2006-01-02 15:04")
}
func (s *Session) IsValid() bool {
return time.Now().Before(s.ExpiresAt)
}
func (i *Invite) IsValid() bool {
return time.Now().Before(i.ExpiresAt) && i.Uses > 0
}