feat(auth): add argon2id passwords, replay-safe totp and redis rate limits
Refs #3 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
1 parent
96c1555889
commit
caff396264
6 files changed
+243
-3
No files matched your search
@@ -50,7 +50,7 @@ func key(token string) string {
|
||||
|
||||
func userIndex(id uuid.UUID) string { return "user_sessions:" + id.String() }
|
||||
|
||||
func randomToken() string {
|
||||
func RandomToken() string {
|
||||
b := make([]byte, 32)
|
||||
_, _ = rand.Read(b)
|
||||
return base64.RawURLEncoding.EncodeToString(b)
|
||||
@@ -58,10 +58,10 @@ func randomToken() string {
|
||||
|
||||
func (s *Sessions) Create(ctx context.Context, user, org uuid.UUID) (*Session, error) {
|
||||
sess := &Session{
|
||||
Token: randomToken(),
|
||||
Token: RandomToken(),
|
||||
UserID: user,
|
||||
OrgID: org,
|
||||
CSRF: randomToken(),
|
||||
CSRF: RandomToken(),
|
||||
CreatedAt: s.now(),
|
||||
}
|
||||
k := key(sess.Token)
|
||||
|
||||
Reference in new issue
Block a user