api_keys 0.2.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/.simplecov +36 -0
- data/AGENTS.md +5 -0
- data/Appraisals +17 -0
- data/CHANGELOG.md +9 -0
- data/CLAUDE.md +5 -0
- data/README.md +767 -3
- data/Rakefile +9 -4
- data/app/controllers/api_keys/keys_controller.rb +43 -11
- data/app/controllers/api_keys/security_controller.rb +8 -0
- data/app/views/api_keys/keys/_empty_state.html.erb +9 -0
- data/app/views/api_keys/keys/_form.html.erb +31 -2
- data/app/views/api_keys/keys/_key_actions.html.erb +20 -0
- data/app/views/api_keys/keys/_key_badges.html.erb +17 -0
- data/app/views/api_keys/keys/_key_row.html.erb +21 -35
- data/app/views/api_keys/keys/_key_status.html.erb +10 -0
- data/app/views/api_keys/keys/_keys_table.html.erb +2 -7
- data/app/views/api_keys/keys/_publishable_keys.html.erb +40 -0
- data/app/views/api_keys/keys/_secret_keys.html.erb +39 -0
- data/app/views/api_keys/keys/_show_token.html.erb +5 -1
- data/app/views/api_keys/keys/_token_display.html.erb +11 -0
- data/app/views/api_keys/keys/index.html.erb +40 -8
- data/app/views/api_keys/security/best_practices.html.erb +73 -47
- data/app/views/layouts/api_keys/application.html.erb +113 -7
- data/context7.json +4 -0
- data/gemfiles/rails_7.2.gemfile +21 -0
- data/gemfiles/rails_8.0.gemfile +21 -0
- data/gemfiles/rails_8.1.gemfile +21 -0
- data/lib/api_keys/configuration.rb +77 -0
- data/lib/api_keys/errors.rb +73 -0
- data/lib/api_keys/form_builder_extensions.rb +158 -0
- data/lib/api_keys/helpers/expiration_options.rb +131 -0
- data/lib/api_keys/helpers/token_session.rb +68 -0
- data/lib/api_keys/helpers/view_helpers.rb +216 -0
- data/lib/api_keys/models/api_key.rb +229 -17
- data/lib/api_keys/models/concerns/has_api_keys.rb +183 -3
- data/lib/api_keys/services/authenticator.rb +45 -2
- data/lib/api_keys/services/digestor.rb +6 -2
- data/lib/api_keys/tenant_resolution.rb +3 -1
- data/lib/api_keys/version.rb +1 -1
- data/lib/api_keys.rb +12 -0
- data/lib/generators/api_keys/add_key_types_generator.rb +68 -0
- data/lib/generators/api_keys/templates/add_key_types_to_api_keys.rb.erb +18 -0
- data/lib/generators/api_keys/templates/create_api_keys_table.rb.erb +9 -0
- data/lib/generators/api_keys/templates/initializer.rb +242 -120
- metadata +24 -58
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f2eb256f13ca90621678457aba6cfb4892da3c0497f6932b797f1648a672c009
|
|
4
|
+
data.tar.gz: c74450d08743ee817e41590e200fe244621c742b2f5687e257499b31867f4e6e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2807a51c53e139efbb8d464067b9640e682ef72d7c70c95e8ba1c3d16f97e6818d4e89251e1db40a4be516c9e1294057c1e2903e2e7d55669576044d0e2952a5
|
|
7
|
+
data.tar.gz: 5927cd629287b119d7224306c4e28f35d3dd38241951735ceffeaaada381317e48a0168464e4f101828ef9ba3a7634bc13b9b9146e7725a6bf50f982aaeaa1b4
|
data/.simplecov
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# SimpleCov configuration file (auto-loaded before test suite)
|
|
4
|
+
# This keeps test_helper.rb clean and follows best practices
|
|
5
|
+
|
|
6
|
+
SimpleCov.start do
|
|
7
|
+
# Use SimpleFormatter for terminal-only output (no HTML generation)
|
|
8
|
+
formatter SimpleCov::Formatter::SimpleFormatter
|
|
9
|
+
|
|
10
|
+
# Track coverage for the lib directory (gem source code)
|
|
11
|
+
add_filter "/test/"
|
|
12
|
+
|
|
13
|
+
# Track the lib and app directories
|
|
14
|
+
track_files "{lib,app}/**/*.rb"
|
|
15
|
+
|
|
16
|
+
# Enable branch coverage for more detailed metrics
|
|
17
|
+
enable_coverage :branch
|
|
18
|
+
|
|
19
|
+
# Set minimum coverage threshold to prevent coverage regression
|
|
20
|
+
# Starting at 60% - can be increased as coverage improves
|
|
21
|
+
minimum_coverage line: 60, branch: 60
|
|
22
|
+
|
|
23
|
+
# Disambiguate parallel test runs
|
|
24
|
+
command_name "Job #{ENV['TEST_ENV_NUMBER']}" if ENV['TEST_ENV_NUMBER']
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Print coverage summary to terminal after tests complete
|
|
28
|
+
SimpleCov.at_exit do
|
|
29
|
+
SimpleCov.result.format!
|
|
30
|
+
puts "\n" + "=" * 60
|
|
31
|
+
puts "COVERAGE SUMMARY"
|
|
32
|
+
puts "=" * 60
|
|
33
|
+
puts "Line Coverage: #{SimpleCov.result.covered_percent.round(2)}%"
|
|
34
|
+
puts "Branch Coverage: #{SimpleCov.result.coverage_statistics[:branch]&.percent&.round(2) || 'N/A'}%"
|
|
35
|
+
puts "=" * 60
|
|
36
|
+
end
|
data/AGENTS.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to AI Agents (like OpenAI's Codex, Cursor Agent, Claude Code, etc) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
Please go ahead and read the full context for this project at `.cursor/rules/0-overview.mdc` and `.cursor/rules/1-quality.mdc` now. Also read the README for a good overview of the project.
|
data/Appraisals
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Test against multiple Rails versions
|
|
4
|
+
# This is our most critical dependency point
|
|
5
|
+
|
|
6
|
+
appraise "rails-7.2" do
|
|
7
|
+
gem "rails", "~> 7.2.3"
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
appraise "rails-8.0" do
|
|
11
|
+
gem "rails", "~> 8.0"
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# Test against Rails 8.1 (latest)
|
|
15
|
+
appraise "rails-8.1" do
|
|
16
|
+
gem "rails", "~> 8.1.2"
|
|
17
|
+
end
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## [0.3.0] - 2026-02-09
|
|
2
|
+
|
|
3
|
+
- Add Stripe-style key types and environments (publishable/secret keys with test/live isolation)
|
|
4
|
+
- Add public key token storage for non-revocable publishable keys
|
|
5
|
+
- Add headless helpers for custom dashboard integrations
|
|
6
|
+
- Add usage analytics scopes for admin dashboards
|
|
7
|
+
- Fix PostgreSQL FOR UPDATE with COUNT aggregate error
|
|
8
|
+
- Fix blank scopes bypass in key_types mode: empty scopes no longer grant unrestricted access when permission ceilings are configured
|
|
9
|
+
|
|
1
10
|
## [0.2.1] - 2025-08-04
|
|
2
11
|
|
|
3
12
|
- Fix SecurityController callback reference from :authenticate_api_keys_user! to :authenticate_api_keys_owner!
|
data/CLAUDE.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
Please go ahead and read the full context for this project at `.cursor/rules/0-overview.mdc` and `.cursor/rules/1-quality.mdc` now. Also read the README for a good overview of the project.
|