Skip to content

Conversation

@klaidliadon
Copy link
Contributor

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new AccessKey type (alias for string) and updates all related APIs to use methods on that type for better type safety. Key changes include:

  • Defining type AccessKey string and converting free functions (GetProjectIDFromAccessKey, GenerateAccessKey, GetAccessKeyPrefix) into receiver methods on AccessKey.
  • Updating all context helpers, middleware, common utilities, CLI commands, and tests to use the new AccessKey type.
  • Adjusting go.mod to add direct dependencies (base64, base62, cobra) and remove duplicated indirect entries.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
middleware.go Switched calls from GetProjectIDFromAccessKey to accessKey.GetProjectID() and cast to string
common.go Updated AccessKeyFunc and AccessKeyFromHeader to return AccessKey instead of string
context.go Changed WithAccessKey/GetAccessKey signatures to use AccessKey
access_key.go Introduced AccessKey type and moved encode/decode/free functions into methods on it
access_key_test.go Updated tests to call accessKey.GetProjectID()
common_test.go Changed keyFunc to return authcontrol.AccessKey
cmd/access_key/main.go Cast CLI argument to authcontrol.AccessKey
go.mod Added direct dependencies for base64, base62, cobra and cleaned up indirect entries
Comments suppressed due to low confidence (2)

access_key.go:25

  • Removing the free function GetProjectIDFromAccessKey is a breaking change; consider providing a wrapper or alias for backward compatibility to ease migration for existing consumers.
type AccessKey string

context.go:105

  • Update the function comment to reflect that accessKey is now of type AccessKey instead of string to keep documentation in sync with the API.
func WithAccessKey(ctx context.Context, accessKey AccessKey) context.Context {

VojtechVitek
VojtechVitek previously approved these changes Jul 7, 2025
Copy link
Contributor

@VojtechVitek VojtechVitek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

Copy link
Contributor

@VojtechVitek VojtechVitek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@klaidliadon klaidliadon merged commit 1a44627 into master Jul 10, 2025
2 checks passed
@klaidliadon klaidliadon deleted the accesskey-type branch July 10, 2025 15:53
VojtechVitek added a commit that referenced this pull request Jul 17, 2025
VojtechVitek added a commit that referenced this pull request Jul 17, 2025
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.

3 participants