Skip to content
This repository was archived by the owner on Jun 19, 2025. It is now read-only.

Conversation

@toastsandwich
Copy link
Contributor

Implemented logic to define keys present in config file.

@toastsandwich toastsandwich requested a review from aead May 23, 2025 12:17
@toastsandwich toastsandwich marked this pull request as draft May 23, 2025 12:37
@toastsandwich toastsandwich marked this pull request as ready for review May 23, 2025 12:49
keystore.go Outdated
"github.com/minio/kms-go/kes"
)

// Key structure define a cryptographic key
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Key structure define a cryptographic key
// Key defines a cryptographic key

server.go Outdated
Comment on lines 248 to 270
if len(conf.PredefinedKeys) > 0 {
cipher := crypto.DetermineSecretKeyType()
for _, k := range conf.PredefinedKeys {
key, err := crypto.GenerateSecretKey(cipher, rand.Reader)
if err != nil {
return nil, err
}
hmac, err := crypto.GenerateHMACKey(crypto.SHA256, rand.Reader)
if err != nil {
return nil, err
}
if err = state.Keys.Create(ctx, k.Name, crypto.KeyVersion{
Key: key,
HMACKey: hmac,
CreatedAt: time.Now().UTC(),
CreatedBy: conf.Admin,
}); err != nil {
if err != kes.ErrKeyExists {
return nil, err
}
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

We can define a private function for this and reuse in both places

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right, we create it as a private function. Thank you @shtripat .

server.go Outdated
// [Server.UpdatePolicies]. These more specific methods are usually
// simpler to use and more efficient.
func (s *Server) Update(conf *Config) (io.Closer, error) {
func (s *Server) Update(ctx context.Context, conf *Config) (io.Closer, error) {
Copy link
Member

Choose a reason for hiding this comment

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

We cannot simply change the public API here

@aead aead merged commit aacc4fd into minio:master May 26, 2025
7 checks passed
@toastsandwich toastsandwich deleted the 519 branch May 27, 2025 10:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants