|
@@ -168,6 +168,14 @@ func (r *RefreshTokenRepo) RevokeAllForUser(ctx context.Context, userID string)
|
|
|
return err
|
|
return err
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+func (r *RefreshTokenRepo) Delete(ctx context.Context, tokenHash string) error {
|
|
|
|
|
+ _, err := r.pool.Exec(ctx,
|
|
|
|
|
+ `DELETE FROM refresh_tokens WHERE token_hash = $1`,
|
|
|
|
|
+ tokenHash,
|
|
|
|
|
+ )
|
|
|
|
|
+ return err
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
// ReplaceIfExists soft-replaces a token (sets replaced_at) and returns true if a row was updated.
|
|
// ReplaceIfExists soft-replaces a token (sets replaced_at) and returns true if a row was updated.
|
|
|
// Returns false if the token was already replaced by another request.
|
|
// Returns false if the token was already replaced by another request.
|
|
|
func (r *RefreshTokenRepo) ReplaceIfExists(ctx context.Context, tokenHash string) (bool, error) {
|
|
func (r *RefreshTokenRepo) ReplaceIfExists(ctx context.Context, tokenHash string) (bool, error) {
|