Skip to content

CONV-296: Create API key generation service#256

Merged
menvil merged 1 commit into
developfrom
feature/CONV-296-create-api-key-generation-service
Jun 3, 2026
Merged

CONV-296: Create API key generation service#256
menvil merged 1 commit into
developfrom
feature/CONV-296-create-api-key-generation-service

Conversation

@menvil

@menvil menvil commented Jun 3, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds ApiKeyGenerator service that generates a fc_ prefixed token, stores only SHA-256 hash
  • Adds GeneratedApiKey DTO with apiKey model and plainToken (shown once, not stored)

Test plan

  • Token starts with fc_
  • Hash in DB matches hash('sha256', plainToken)
  • Plain token not stored in DB
  • composer test passes (541 tests)
  • composer lint passes

🤖 Generated with Claude Code


Summary by cubic

Adds an ApiKeyGenerator service to create user API keys with fc_-prefixed tokens while storing only a SHA-256 hash. Returns a GeneratedApiKey that includes the ApiKey model and a one-time plainToken, fulfilling CONV-296 security requirements.

  • New Features
    • ApiKeyGenerator::create(User $user, string $name) returns GeneratedApiKey.
    • Tokens are random 64 chars with fc_ prefix; only token_hash (sha256) is stored.
    • Keys are linked to the user and named; plain token is never persisted and shown once.

Written for commit 7a0cfba. Summary will update on new commits.

Review in cubic

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@menvil menvil merged commit 44e93e5 into develop Jun 3, 2026
@coderabbitai

coderabbitai Bot commented Jun 3, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one) (1)
  • release

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 290ca155-1698-44bb-b627-00bf29238870

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/CONV-296-create-api-key-generation-service

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant