better_auth 0.1.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +23 -0
- data/README.md +110 -18
- data/lib/better_auth/adapters/base.rb +49 -0
- data/lib/better_auth/adapters/internal_adapter.rb +589 -0
- data/lib/better_auth/adapters/memory.rb +235 -0
- data/lib/better_auth/adapters/mongodb.rb +9 -0
- data/lib/better_auth/adapters/mssql.rb +42 -0
- data/lib/better_auth/adapters/mysql.rb +33 -0
- data/lib/better_auth/adapters/postgres.rb +17 -0
- data/lib/better_auth/adapters/sql.rb +441 -0
- data/lib/better_auth/adapters/sqlite.rb +20 -0
- data/lib/better_auth/api.rb +226 -0
- data/lib/better_auth/api_error.rb +53 -0
- data/lib/better_auth/auth.rb +42 -0
- data/lib/better_auth/configuration.rb +399 -0
- data/lib/better_auth/context.rb +211 -0
- data/lib/better_auth/cookies.rb +278 -0
- data/lib/better_auth/core.rb +37 -1
- data/lib/better_auth/crypto/jwe.rb +76 -0
- data/lib/better_auth/crypto.rb +191 -0
- data/lib/better_auth/database_hooks.rb +114 -0
- data/lib/better_auth/endpoint.rb +326 -0
- data/lib/better_auth/error.rb +52 -0
- data/lib/better_auth/middleware/origin_check.rb +128 -0
- data/lib/better_auth/password.rb +120 -0
- data/lib/better_auth/plugin.rb +142 -0
- data/lib/better_auth/plugin_context.rb +16 -0
- data/lib/better_auth/plugin_registry.rb +67 -0
- data/lib/better_auth/plugins/access.rb +87 -0
- data/lib/better_auth/plugins/additional_fields.rb +29 -0
- data/lib/better_auth/plugins/admin/schema.rb +28 -0
- data/lib/better_auth/plugins/admin.rb +518 -0
- data/lib/better_auth/plugins/anonymous.rb +198 -0
- data/lib/better_auth/plugins/api_key.rb +16 -0
- data/lib/better_auth/plugins/bearer.rb +128 -0
- data/lib/better_auth/plugins/captcha.rb +159 -0
- data/lib/better_auth/plugins/custom_session.rb +84 -0
- data/lib/better_auth/plugins/device_authorization.rb +302 -0
- data/lib/better_auth/plugins/email_otp.rb +536 -0
- data/lib/better_auth/plugins/expo.rb +88 -0
- data/lib/better_auth/plugins/generic_oauth.rb +780 -0
- data/lib/better_auth/plugins/have_i_been_pwned.rb +94 -0
- data/lib/better_auth/plugins/jwt.rb +482 -0
- data/lib/better_auth/plugins/last_login_method.rb +92 -0
- data/lib/better_auth/plugins/magic_link.rb +181 -0
- data/lib/better_auth/plugins/mcp.rb +342 -0
- data/lib/better_auth/plugins/multi_session.rb +173 -0
- data/lib/better_auth/plugins/oauth_protocol.rb +694 -0
- data/lib/better_auth/plugins/oauth_provider.rb +16 -0
- data/lib/better_auth/plugins/oauth_proxy.rb +257 -0
- data/lib/better_auth/plugins/oidc_provider.rb +597 -0
- data/lib/better_auth/plugins/one_tap.rb +154 -0
- data/lib/better_auth/plugins/one_time_token.rb +106 -0
- data/lib/better_auth/plugins/open_api.rb +489 -0
- data/lib/better_auth/plugins/organization/schema.rb +106 -0
- data/lib/better_auth/plugins/organization.rb +995 -0
- data/lib/better_auth/plugins/passkey.rb +16 -0
- data/lib/better_auth/plugins/phone_number.rb +321 -0
- data/lib/better_auth/plugins/scim.rb +16 -0
- data/lib/better_auth/plugins/siwe.rb +242 -0
- data/lib/better_auth/plugins/sso.rb +16 -0
- data/lib/better_auth/plugins/stripe.rb +16 -0
- data/lib/better_auth/plugins/two_factor.rb +514 -0
- data/lib/better_auth/plugins/username.rb +278 -0
- data/lib/better_auth/plugins.rb +46 -0
- data/lib/better_auth/rate_limiter.rb +232 -0
- data/lib/better_auth/request_ip.rb +70 -0
- data/lib/better_auth/router.rb +378 -0
- data/lib/better_auth/routes/account.rb +211 -0
- data/lib/better_auth/routes/email_verification.rb +111 -0
- data/lib/better_auth/routes/error.rb +102 -0
- data/lib/better_auth/routes/ok.rb +15 -0
- data/lib/better_auth/routes/password.rb +183 -0
- data/lib/better_auth/routes/session.rb +160 -0
- data/lib/better_auth/routes/sign_in.rb +90 -0
- data/lib/better_auth/routes/sign_out.rb +15 -0
- data/lib/better_auth/routes/sign_up.rb +196 -0
- data/lib/better_auth/routes/social.rb +367 -0
- data/lib/better_auth/routes/user.rb +205 -0
- data/lib/better_auth/schema/sql.rb +202 -0
- data/lib/better_auth/schema.rb +291 -0
- data/lib/better_auth/session.rb +122 -0
- data/lib/better_auth/session_store.rb +91 -0
- data/lib/better_auth/social_providers/apple.rb +91 -0
- data/lib/better_auth/social_providers/atlassian.rb +32 -0
- data/lib/better_auth/social_providers/base.rb +325 -0
- data/lib/better_auth/social_providers/cognito.rb +32 -0
- data/lib/better_auth/social_providers/discord.rb +81 -0
- data/lib/better_auth/social_providers/dropbox.rb +33 -0
- data/lib/better_auth/social_providers/facebook.rb +35 -0
- data/lib/better_auth/social_providers/figma.rb +31 -0
- data/lib/better_auth/social_providers/github.rb +74 -0
- data/lib/better_auth/social_providers/gitlab.rb +67 -0
- data/lib/better_auth/social_providers/google.rb +90 -0
- data/lib/better_auth/social_providers/huggingface.rb +31 -0
- data/lib/better_auth/social_providers/kakao.rb +32 -0
- data/lib/better_auth/social_providers/kick.rb +32 -0
- data/lib/better_auth/social_providers/line.rb +33 -0
- data/lib/better_auth/social_providers/linear.rb +44 -0
- data/lib/better_auth/social_providers/linkedin.rb +30 -0
- data/lib/better_auth/social_providers/microsoft_entra_id.rb +137 -0
- data/lib/better_auth/social_providers/naver.rb +31 -0
- data/lib/better_auth/social_providers/notion.rb +33 -0
- data/lib/better_auth/social_providers/paybin.rb +31 -0
- data/lib/better_auth/social_providers/paypal.rb +36 -0
- data/lib/better_auth/social_providers/polar.rb +31 -0
- data/lib/better_auth/social_providers/railway.rb +49 -0
- data/lib/better_auth/social_providers/reddit.rb +32 -0
- data/lib/better_auth/social_providers/roblox.rb +31 -0
- data/lib/better_auth/social_providers/salesforce.rb +38 -0
- data/lib/better_auth/social_providers/slack.rb +30 -0
- data/lib/better_auth/social_providers/spotify.rb +31 -0
- data/lib/better_auth/social_providers/tiktok.rb +35 -0
- data/lib/better_auth/social_providers/twitch.rb +39 -0
- data/lib/better_auth/social_providers/twitter.rb +32 -0
- data/lib/better_auth/social_providers/vercel.rb +47 -0
- data/lib/better_auth/social_providers/vk.rb +34 -0
- data/lib/better_auth/social_providers/wechat.rb +104 -0
- data/lib/better_auth/social_providers/zoom.rb +31 -0
- data/lib/better_auth/social_providers.rb +38 -0
- data/lib/better_auth/version.rb +1 -1
- data/lib/better_auth.rb +86 -2
- metadata +233 -21
- data/.ruby-version +0 -1
- data/.standard.yml +0 -12
- data/.vscode/settings.json +0 -22
- data/AGENTS.md +0 -50
- data/CLAUDE.md +0 -1
- data/CODE_OF_CONDUCT.md +0 -173
- data/CONTRIBUTING.md +0 -187
- data/Gemfile +0 -12
- data/Makefile +0 -207
- data/Rakefile +0 -25
- data/SECURITY.md +0 -28
- data/docker-compose.yml +0 -63
data/CONTRIBUTING.md
DELETED
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
# Contributing to Better Auth Ruby
|
|
2
|
-
|
|
3
|
-
Thank you for your interest in contributing to Better Auth Ruby!
|
|
4
|
-
This guide will help you get started with the contribution process.
|
|
5
|
-
|
|
6
|
-
## Code of Conduct
|
|
7
|
-
|
|
8
|
-
This project and everyone participating in it is governed by our
|
|
9
|
-
[Code of Conduct](/CODE_OF_CONDUCT.md).
|
|
10
|
-
By participating, you are expected to uphold this code.
|
|
11
|
-
|
|
12
|
-
## Project Structure
|
|
13
|
-
|
|
14
|
-
```
|
|
15
|
-
lib/
|
|
16
|
-
better_auth.rb # Main entry point
|
|
17
|
-
better_auth/
|
|
18
|
-
version.rb # Version constant
|
|
19
|
-
core.rb # Core module loader
|
|
20
|
-
core/ # Core authentication logic
|
|
21
|
-
rails.rb # Rails adapter entry
|
|
22
|
-
rails/ # Rails-specific code
|
|
23
|
-
|
|
24
|
-
test/ # Core library tests (Minitest)
|
|
25
|
-
spec/ # Rails adapter tests (RSpec)
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## Development Guidelines
|
|
29
|
-
|
|
30
|
-
When contributing to Better Auth Ruby:
|
|
31
|
-
|
|
32
|
-
* Keep changes focused. Large PRs are harder to review.
|
|
33
|
-
* Follow Ruby conventions and idioms
|
|
34
|
-
* Ensure all code passes StandardRB linting
|
|
35
|
-
* Write tests for new features
|
|
36
|
-
* Maintain backward compatibility when possible
|
|
37
|
-
|
|
38
|
-
## Getting Started
|
|
39
|
-
|
|
40
|
-
1. Fork the repository to your GitHub account
|
|
41
|
-
|
|
42
|
-
2. Clone your fork locally:
|
|
43
|
-
|
|
44
|
-
```bash
|
|
45
|
-
git clone https://github.com/your-username/better-auth-ruby.git
|
|
46
|
-
cd better-auth-ruby
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
3. Install Ruby (3.2+ required, 3.3 recommended)
|
|
50
|
-
|
|
51
|
-
We recommend using a Ruby version manager like rbenv, rvm, or asdf.
|
|
52
|
-
|
|
53
|
-
4. Install dependencies:
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
bundle install
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
5. Run tests to ensure everything is working:
|
|
60
|
-
|
|
61
|
-
```bash
|
|
62
|
-
bundle exec rake ci
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
## Development Workflow
|
|
66
|
-
|
|
67
|
-
1. Create a new branch for your changes:
|
|
68
|
-
|
|
69
|
-
```bash
|
|
70
|
-
git checkout -b type/description
|
|
71
|
-
# Example: git checkout -b feat/oauth-provider
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
Branch type prefixes:
|
|
75
|
-
|
|
76
|
-
* `feat/` - New features
|
|
77
|
-
* `fix/` - Bug fixes
|
|
78
|
-
* `docs/` - Documentation changes
|
|
79
|
-
* `refactor/` - Code refactoring
|
|
80
|
-
* `test/` - Test-related changes
|
|
81
|
-
* `chore/` - Build process or tooling changes
|
|
82
|
-
|
|
83
|
-
2. Make your changes following the code style guidelines
|
|
84
|
-
|
|
85
|
-
3. Run the linter:
|
|
86
|
-
|
|
87
|
-
```bash
|
|
88
|
-
bundle exec standardrb --fix
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
4. Add tests for your changes
|
|
92
|
-
|
|
93
|
-
5. Run the test suite:
|
|
94
|
-
|
|
95
|
-
```bash
|
|
96
|
-
# Run all tests
|
|
97
|
-
bundle exec rake ci
|
|
98
|
-
|
|
99
|
-
# Run only core tests
|
|
100
|
-
bundle exec rake test
|
|
101
|
-
|
|
102
|
-
# Run only Rails adapter tests
|
|
103
|
-
bundle exec rspec
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
6. Commit your changes with a descriptive message:
|
|
107
|
-
|
|
108
|
-
```text
|
|
109
|
-
feat(rails): add current_user helper method
|
|
110
|
-
|
|
111
|
-
fix(core): resolve token validation issue
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
7. Push your branch to your fork
|
|
115
|
-
|
|
116
|
-
8. Open a pull request against the **main** branch
|
|
117
|
-
|
|
118
|
-
## Code Style
|
|
119
|
-
|
|
120
|
-
We use [StandardRB](https://github.com/standardrb/standard) for code formatting and linting.
|
|
121
|
-
Before committing, please ensure your code passes:
|
|
122
|
-
|
|
123
|
-
```bash
|
|
124
|
-
# Check code style
|
|
125
|
-
bundle exec standardrb
|
|
126
|
-
|
|
127
|
-
# Auto-fix issues
|
|
128
|
-
bundle exec standardrb --fix
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
### Ruby Style Guidelines
|
|
132
|
-
|
|
133
|
-
* Use 2 spaces for indentation
|
|
134
|
-
* Use `snake_case` for methods, variables, and file names
|
|
135
|
-
* Use `CamelCase` for classes and modules
|
|
136
|
-
* Use `SCREAMING_SNAKE_CASE` for constants
|
|
137
|
-
* Add `frozen_string_literal: true` pragma to all Ruby files
|
|
138
|
-
* Prefer single quotes for strings without interpolation
|
|
139
|
-
* Avoid unnecessary Ruby features (unless they improve readability)
|
|
140
|
-
|
|
141
|
-
## Testing Guidelines
|
|
142
|
-
|
|
143
|
-
### Core Library (Minitest)
|
|
144
|
-
|
|
145
|
-
Located in `test/` directory:
|
|
146
|
-
|
|
147
|
-
```ruby
|
|
148
|
-
# test/better_auth/some_feature_test.rb
|
|
149
|
-
require_relative "test_helper"
|
|
150
|
-
|
|
151
|
-
class SomeFeatureTest < Minitest::Test
|
|
152
|
-
def test_something
|
|
153
|
-
assert_equal expected, actual
|
|
154
|
-
end
|
|
155
|
-
end
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
### Rails Adapter (RSpec)
|
|
159
|
-
|
|
160
|
-
Located in `spec/` directory:
|
|
161
|
-
|
|
162
|
-
```ruby
|
|
163
|
-
# spec/better_auth/rails/some_feature_spec.rb
|
|
164
|
-
require "spec_helper"
|
|
165
|
-
|
|
166
|
-
RSpec.describe BetterAuth::Rails::SomeFeature do
|
|
167
|
-
it "does something" do
|
|
168
|
-
expect(subject).to eq expected
|
|
169
|
-
end
|
|
170
|
-
end
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
## Pull Request Process
|
|
174
|
-
|
|
175
|
-
1. Create a draft pull request early to facilitate discussion
|
|
176
|
-
2. Reference any related issues in your PR description
|
|
177
|
-
3. Ensure all tests pass and the build is successful
|
|
178
|
-
4. Update documentation as needed
|
|
179
|
-
5. Keep your PR focused on a single feature or bug fix
|
|
180
|
-
6. Be responsive to code review feedback
|
|
181
|
-
|
|
182
|
-
## Security Issues
|
|
183
|
-
|
|
184
|
-
For security-related issues, please email [security@better-auth.com](mailto:security@better-auth.com).
|
|
185
|
-
Include a detailed description of the vulnerability and steps to reproduce it.
|
|
186
|
-
All reports will be reviewed and addressed promptly.
|
|
187
|
-
For more information, see our [security documentation](/SECURITY.md).
|
data/Gemfile
DELETED
data/Makefile
DELETED
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
# Better Auth Ruby - Makefile
|
|
2
|
-
# Este archivo te ayuda a ejecutar comandos comunes de desarrollo
|
|
3
|
-
# Cada comando tiene comentarios explicativos para aprender
|
|
4
|
-
|
|
5
|
-
# Variables de color para hacer la salida más legible
|
|
6
|
-
BLUE := \033[36m
|
|
7
|
-
GREEN := \033[32m
|
|
8
|
-
YELLOW := \033[33m
|
|
9
|
-
NC := \033[0m # No Color
|
|
10
|
-
|
|
11
|
-
# =============================================
|
|
12
|
-
# COMANDOS PRINCIPALES DE DESARROLLO
|
|
13
|
-
# =============================================
|
|
14
|
-
|
|
15
|
-
# Instala todas las dependencias del proyecto
|
|
16
|
-
# Equivale a: bundle install
|
|
17
|
-
.PHONY: install
|
|
18
|
-
install:
|
|
19
|
-
@echo "$(BLUE)📦 Instalando dependencias...$(NC)"
|
|
20
|
-
bundle install
|
|
21
|
-
@echo "$(GREEN)✓ Dependencias instaladas$(NC)"
|
|
22
|
-
|
|
23
|
-
# Configuración inicial del proyecto (primer clone)
|
|
24
|
-
# Ejecuta bin/setup que hace bundle install
|
|
25
|
-
.PHONY: setup
|
|
26
|
-
setup:
|
|
27
|
-
@echo "$(BLUE)🔧 Configurando proyecto...$(NC)"
|
|
28
|
-
bin/setup
|
|
29
|
-
@echo "$(GREEN)✓ Proyecto configurado$(NC)"
|
|
30
|
-
|
|
31
|
-
# =============================================
|
|
32
|
-
# COMANDOS DE CALIDAD DE CÓDIGO
|
|
33
|
-
# =============================================
|
|
34
|
-
|
|
35
|
-
# Revisa que el código cumpla con el estilo StandardRB
|
|
36
|
-
# Muestra errores pero NO los corrige automáticamente
|
|
37
|
-
.PHONY: lint
|
|
38
|
-
lint:
|
|
39
|
-
@echo "$(BLUE)🔍 Revisando estilo de código...$(NC)"
|
|
40
|
-
bundle exec standardrb
|
|
41
|
-
@echo "$(GREEN)✓ Código cumple con el estilo$(NC)"
|
|
42
|
-
|
|
43
|
-
# Revisa Y AUTOCORRIGE problemas de estilo con StandardRB
|
|
44
|
-
# Úsalo cuando quieras formatear todo automáticamente
|
|
45
|
-
.PHONY: lint-fix
|
|
46
|
-
lint-fix:
|
|
47
|
-
@echo "$(BLUE)🔧 Corrigiendo estilo de código automáticamente...$(NC)"
|
|
48
|
-
bundle exec standardrb --fix
|
|
49
|
-
@echo "$(GREEN)✓ Código corregido$(NC)"
|
|
50
|
-
|
|
51
|
-
# =============================================
|
|
52
|
-
# COMANDOS DE TESTING
|
|
53
|
-
# =============================================
|
|
54
|
-
|
|
55
|
-
# Ejecuta TODOS los tests (core + rails adapter)
|
|
56
|
-
# Es lo mismo que: bundle exec rake ci
|
|
57
|
-
.PHONY: test
|
|
58
|
-
test:
|
|
59
|
-
@echo "$(BLUE)🧪 Ejecutando todos los tests...$(NC)"
|
|
60
|
-
bundle exec rake test
|
|
61
|
-
@echo "$(GREEN)✓ Tests completados$(NC)"
|
|
62
|
-
|
|
63
|
-
# Ejecuta solo los tests del core (Minitest)
|
|
64
|
-
# Son los tests en el directorio test/
|
|
65
|
-
.PHONY: test-core
|
|
66
|
-
test-core:
|
|
67
|
-
@echo "$(BLUE)🧪 Ejecutando tests del core...$(NC)"
|
|
68
|
-
bundle exec rake test:core
|
|
69
|
-
@echo "$(GREEN)✓ Tests del core completados$(NC)"
|
|
70
|
-
|
|
71
|
-
# Ejecuta solo los tests del adapter Rails (RSpec)
|
|
72
|
-
# Son los tests en el directorio spec/
|
|
73
|
-
.PHONY: test-rails
|
|
74
|
-
test-rails:
|
|
75
|
-
@echo "$(BLUE)🧪 Ejecutando tests del adapter Rails...$(NC)"
|
|
76
|
-
bundle exec rspec
|
|
77
|
-
@echo "$(GREEN)✓ Tests de Rails completados$(NC)"
|
|
78
|
-
|
|
79
|
-
# Ejecuta tests con cobertura de código
|
|
80
|
-
# Genera reporte en coverage/index.html
|
|
81
|
-
.PHONY: test-coverage
|
|
82
|
-
test-coverage:
|
|
83
|
-
@echo "$(BLUE)📊 Ejecutando tests con cobertura...$(NC)"
|
|
84
|
-
COVERAGE=true bundle exec rake test
|
|
85
|
-
@echo "$(GREEN)✓ Reporte de cobertura en coverage/index.html$(NC)"
|
|
86
|
-
|
|
87
|
-
# =============================================
|
|
88
|
-
# COMANDOS DE INTEGRACIÓN CONTINUA (CI)
|
|
89
|
-
# =============================================
|
|
90
|
-
|
|
91
|
-
# Ejecuta TODO el pipeline de CI localmente
|
|
92
|
-
# 1. Lint (StandardRB)
|
|
93
|
-
# 2. Tests (Minitest + RSpec)
|
|
94
|
-
# Esto es lo que corre GitHub Actions en cada PR
|
|
95
|
-
.PHONY: ci
|
|
96
|
-
ci:
|
|
97
|
-
@echo "$(BLUE)🔧 Ejecutando CI completo...$(NC)"
|
|
98
|
-
bundle exec rake ci
|
|
99
|
-
@echo "$(GREEN)✓ CI completado exitosamente$(NC)"
|
|
100
|
-
|
|
101
|
-
# =============================================
|
|
102
|
-
# COMANDOS DE DESARROLLO INTERACTIVO
|
|
103
|
-
# =============================================
|
|
104
|
-
|
|
105
|
-
# Abre una consola interactiva (IRB) con la gema cargada
|
|
106
|
-
# Útil para probar código manualmente
|
|
107
|
-
.PHONY: console
|
|
108
|
-
console:
|
|
109
|
-
@echo "$(BLUE)💻 Abriendo consola interactiva...$(NC)"
|
|
110
|
-
bin/console
|
|
111
|
-
|
|
112
|
-
# =============================================
|
|
113
|
-
# COMANDOS DE PUBLICACIÓN (RELEASE)
|
|
114
|
-
# =============================================
|
|
115
|
-
|
|
116
|
-
# PASO 1: Actualiza la versión en version.rb
|
|
117
|
-
# Debes hacerlo manualmente antes de release
|
|
118
|
-
|
|
119
|
-
# PASO 2: Crea un git tag con la versión
|
|
120
|
-
# Ejemplo: make tag VERSION=0.1.0
|
|
121
|
-
.PHONY: tag
|
|
122
|
-
tag:
|
|
123
|
-
ifndef VERSION
|
|
124
|
-
$(error VERSION no está definido. Usa: make tag VERSION=0.1.0)
|
|
125
|
-
endif
|
|
126
|
-
@echo "$(YELLOW)🏷️ Creando tag v$(VERSION)...$(NC)"
|
|
127
|
-
git add -A
|
|
128
|
-
git commit -m "chore: release v$(VERSION)"
|
|
129
|
-
git tag -a v$(VERSION) -m "Release v$(VERSION)"
|
|
130
|
-
@echo "$(GREEN)✓ Tag creado. Ahora haz: git push origin main --tags$(NC)"
|
|
131
|
-
|
|
132
|
-
# PASO 3 (MANUAL): Publica la gema a RubyGems manualmente
|
|
133
|
-
# Solo úsalo si NO estás usando GitHub Actions
|
|
134
|
-
.PHONY: release-manual
|
|
135
|
-
release-manual:
|
|
136
|
-
@echo "$(YELLOW)📦 Construyendo gema...$(NC)"
|
|
137
|
-
gem build better_auth.gemspec
|
|
138
|
-
@echo "$(YELLOW)🚀 Publicando a RubyGems...$(NC)"
|
|
139
|
-
gem push better_auth-*.gem
|
|
140
|
-
@echo "$(GREEN)✓ Gema publicada$(NC)"
|
|
141
|
-
|
|
142
|
-
# =============================================
|
|
143
|
-
# COMANDOS DE BASES DE DATOS (TESTING)
|
|
144
|
-
# =============================================
|
|
145
|
-
|
|
146
|
-
# Inicia los contenedores de Docker para testing
|
|
147
|
-
# (PostgreSQL, MySQL, Redis)
|
|
148
|
-
.PHONY: db-up
|
|
149
|
-
db-up:
|
|
150
|
-
@echo "$(BLUE)🐳 Iniciando bases de datos...$(NC)"
|
|
151
|
-
docker-compose up -d
|
|
152
|
-
@echo "$(GREEN)✓ Bases de datos listas$(NC)"
|
|
153
|
-
|
|
154
|
-
# Detiene los contenedores de Docker
|
|
155
|
-
.PHONY: db-down
|
|
156
|
-
db-down:
|
|
157
|
-
@echo "$(BLUE)🐳 Deteniendo bases de datos...$(NC)"
|
|
158
|
-
docker-compose down
|
|
159
|
-
@echo "$(GREEN)✓ Bases de datos detenidas$(NC)"
|
|
160
|
-
|
|
161
|
-
# =============================================
|
|
162
|
-
# COMANDOS DE LIMPIEZA
|
|
163
|
-
# =============================================
|
|
164
|
-
|
|
165
|
-
# Limpia archivos temporales y la gema compilada
|
|
166
|
-
.PHONY: clean
|
|
167
|
-
clean:
|
|
168
|
-
@echo "$(BLUE)🧹 Limpiando archivos temporales...$(NC)"
|
|
169
|
-
rm -rf *.gem coverage/ .bundle/
|
|
170
|
-
@echo "$(GREEN)✓ Limpieza completada$(NC)"
|
|
171
|
-
|
|
172
|
-
# =============================================
|
|
173
|
-
# AYUDA
|
|
174
|
-
# =============================================
|
|
175
|
-
|
|
176
|
-
# Muestra todos los comandos disponibles con descripción
|
|
177
|
-
.PHONY: help
|
|
178
|
-
help:
|
|
179
|
-
@echo "$(GREEN)Better Auth Ruby - Comandos disponibles:$(NC)"
|
|
180
|
-
@echo ""
|
|
181
|
-
@echo "$(YELLOW)Instalación:$(NC)"
|
|
182
|
-
@echo " make install - Instala dependencias (bundle install)"
|
|
183
|
-
@echo " make setup - Configuración inicial del proyecto"
|
|
184
|
-
@echo ""
|
|
185
|
-
@echo "$(YELLOW)Desarrollo:$(NC)"
|
|
186
|
-
@echo " make console - Abre consola interactiva (IRB)"
|
|
187
|
-
@echo " make lint - Revisa estilo de código"
|
|
188
|
-
@echo " make lint-fix - Corrige estilo automáticamente"
|
|
189
|
-
@echo ""
|
|
190
|
-
@echo "$(YELLOW)Testing:$(NC)"
|
|
191
|
-
@echo " make test - Ejecuta todos los tests"
|
|
192
|
-
@echo " make test-core - Solo tests del core (Minitest)"
|
|
193
|
-
@echo " make test-rails - Solo tests Rails (RSpec)"
|
|
194
|
-
@echo " make test-coverage - Tests con reporte de cobertura"
|
|
195
|
-
@echo " make ci - Ejecuta CI completo (lint + test)"
|
|
196
|
-
@echo ""
|
|
197
|
-
@echo "$(YELLOW)Bases de datos (Docker):$(NC)"
|
|
198
|
-
@echo " make db-up - Inicia PostgreSQL, MySQL, Redis"
|
|
199
|
-
@echo " make db-down - Detiene contenedores"
|
|
200
|
-
@echo ""
|
|
201
|
-
@echo "$(YELLOW)Release:$(NC)"
|
|
202
|
-
@echo " make tag VERSION=x.x.x - Crea git tag para release"
|
|
203
|
-
@echo " make release-manual - Publica manualmente (NO usar con CI)"
|
|
204
|
-
@echo ""
|
|
205
|
-
@echo "$(YELLOW)Utilidades:$(NC)"
|
|
206
|
-
@echo " make clean - Limpia archivos temporales"
|
|
207
|
-
@echo " make help - Muestra esta ayuda"
|
data/Rakefile
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "bundler/gem_tasks"
|
|
4
|
-
require "rake/testtask"
|
|
5
|
-
|
|
6
|
-
Rake::TestTask.new(:test) do |t|
|
|
7
|
-
t.libs << "test"
|
|
8
|
-
t.libs << "lib"
|
|
9
|
-
t.test_files = FileList["test/**/*_test.rb"]
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
desc "Run StandardRB linter"
|
|
13
|
-
task :lint do
|
|
14
|
-
sh "bundle exec standardrb"
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
desc "Auto-fix StandardRB issues"
|
|
18
|
-
task "lint:fix" do
|
|
19
|
-
sh "bundle exec standardrb --fix"
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
desc "Run full CI check (lint + test)"
|
|
23
|
-
task ci: [:lint, :test]
|
|
24
|
-
|
|
25
|
-
task default: :ci
|
data/SECURITY.md
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# Security Policy
|
|
2
|
-
|
|
3
|
-
### Reporting a Vulnerability
|
|
4
|
-
|
|
5
|
-
If you believe you've found a security vulnerability, please follow these steps:
|
|
6
|
-
|
|
7
|
-
1. Do not disclose the vulnerability publicly until it has been addressed by our
|
|
8
|
-
team.
|
|
9
|
-
2. Email your findings to `security@better-auth.com` Include:
|
|
10
|
-
* A description of the vulnerability
|
|
11
|
-
* Steps to reproduce the vulnerability
|
|
12
|
-
* Potential impact of the vulnerability
|
|
13
|
-
* Any suggestions for mitigation
|
|
14
|
-
* Any other relevant information
|
|
15
|
-
3. We will respond to your report within 72 hours.
|
|
16
|
-
4. If the issue is confirmed, we will release a patch as soon as possible.
|
|
17
|
-
|
|
18
|
-
### Disclosure Policy
|
|
19
|
-
|
|
20
|
-
If the issue is confirmed, we will release a patch as soon as possible.
|
|
21
|
-
Once a patch is released, we will disclose the issue publicly.
|
|
22
|
-
If 90 days has elapsed and we still don't have a fix, we will disclose the issue
|
|
23
|
-
publicly.
|
|
24
|
-
|
|
25
|
-
## Supported Versions
|
|
26
|
-
|
|
27
|
-
We only support the latest version of Better Auth Ruby.
|
|
28
|
-
Older versions are not supported.
|
data/docker-compose.yml
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
# Services for testing database adapters
|
|
2
|
-
# These are used in CI for testing various database backends
|
|
3
|
-
|
|
4
|
-
x-postgres-healthcheck: &postgres-healthcheck
|
|
5
|
-
healthcheck:
|
|
6
|
-
test: ["CMD-SHELL", "pg_isready -U user -d better_auth"]
|
|
7
|
-
interval: 1s
|
|
8
|
-
timeout: 5s
|
|
9
|
-
retries: 10
|
|
10
|
-
|
|
11
|
-
x-mysql-healthcheck: &mysql-healthcheck
|
|
12
|
-
healthcheck:
|
|
13
|
-
test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "-uuser", "-ppassword"]
|
|
14
|
-
interval: 1s
|
|
15
|
-
timeout: 5s
|
|
16
|
-
retries: 10
|
|
17
|
-
start_period: 30s
|
|
18
|
-
|
|
19
|
-
services:
|
|
20
|
-
redis:
|
|
21
|
-
image: redis:latest
|
|
22
|
-
container_name: redis
|
|
23
|
-
ports:
|
|
24
|
-
- "6379:6379"
|
|
25
|
-
volumes:
|
|
26
|
-
- redis_data:/data
|
|
27
|
-
healthcheck:
|
|
28
|
-
test: ["CMD", "redis-cli", "ping"]
|
|
29
|
-
interval: 1s
|
|
30
|
-
timeout: 5s
|
|
31
|
-
retries: 10
|
|
32
|
-
|
|
33
|
-
postgres:
|
|
34
|
-
<<: *postgres-healthcheck
|
|
35
|
-
image: postgres:latest
|
|
36
|
-
container_name: postgres
|
|
37
|
-
environment:
|
|
38
|
-
POSTGRES_USER: user
|
|
39
|
-
POSTGRES_PASSWORD: password
|
|
40
|
-
POSTGRES_DB: better_auth
|
|
41
|
-
ports:
|
|
42
|
-
- "5432:5432"
|
|
43
|
-
volumes:
|
|
44
|
-
- postgres_data:/var/lib/postgresql
|
|
45
|
-
|
|
46
|
-
mysql:
|
|
47
|
-
<<: *mysql-healthcheck
|
|
48
|
-
image: mysql:latest
|
|
49
|
-
container_name: mysql
|
|
50
|
-
environment:
|
|
51
|
-
MYSQL_ROOT_PASSWORD: root_password
|
|
52
|
-
MYSQL_DATABASE: better_auth
|
|
53
|
-
MYSQL_USER: user
|
|
54
|
-
MYSQL_PASSWORD: password
|
|
55
|
-
ports:
|
|
56
|
-
- "3306:3306"
|
|
57
|
-
volumes:
|
|
58
|
-
- mysql_data:/var/lib/mysql
|
|
59
|
-
|
|
60
|
-
volumes:
|
|
61
|
-
redis_data:
|
|
62
|
-
postgres_data:
|
|
63
|
-
mysql_data:
|