Перенести решение лабораторной 2 как основу для лабораторной 3

This commit is contained in:
2026-11-02 10:00:11 +03:00
parent 0ab3a341aa
commit 5b9f377783
76 changed files with 7008 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
package auth
import (
"context"
"github.com/google/uuid"
)
type Repository interface {
// Create stores the session until its absolute ExpiresAt.
Create(ctx context.Context, s Session) error
// UserID returns the owner of a live session, or ErrUnauthenticated when
// the token is unknown, expired or revoked: the store cannot tell these
// apart, and the client must not either.
UserID(ctx context.Context, tokenHash string) (uuid.UUID, error)
// Delete revokes the session; deleting a missing one is not an error.
Delete(ctx context.Context, tokenHash string) error
}