auth0 / go-auth0

Go SDK for the Auth0 Management API.
https://auth0.com
MIT License
135 stars 54 forks source link

Add Support for Control Your Own Key (CYOK) and Bring Your Own Key (BYOK) Features with New `EncryptionKeyManager` #435

Closed developerkunal closed 2 months ago

developerkunal commented 2 months ago

πŸ”§ Changes

This PR introduces a new EncryptionKeyManager to manage encryption keys using the Auth0 Management API, with added support for Control Your Own Key (CYOK) and Bring Your Own Key (BYOK) features. The following methods have been added:

πŸ“š References

Each method integrates directly with the Auth0 Management API, allowing for full lifecycle management of encryption keys.

πŸ”¬ Testing

Test Summaries for EncryptionKeyManager

  1. TestEncryptionKeyManager_Create: Verifies that an encryption key can be created successfully.

  2. TestEncryptionKeyManager_List: Confirms that the List method retrieves all encryption keys.

  3. TestEncryptionKeyManager_Read: Ensures that an encryption key can be read by its key ID.

  4. TestEncryptionKeyManager_Rekey: Validates that the Rekey method correctly rekeys the key hierarchy.

  5. TestEncryptionKeyManager_Delete: Tests that an encryption key can be deleted and its state becomes "destroyed."

  6. TestEncryptionKeyManager_CreatePublicWrappingKey: Checks that a public wrapping key is generated successfully.

  7. TestEncryptionKeyManager_ImportWrappedKey: Confirms that wrapped key material can be imported and activated.

πŸ“ Checklist

codecov-commenter commented 2 months ago

Codecov Report

Attention: Patch coverage is 96.10390% with 3 lines in your changes missing coverage. Please review.

Project coverage is 95.64%. Comparing base (88dff30) to head (fc9c263).

Files Patch % Lines
management/encryption_key.go 91.17% 3 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #435 +/- ## ======================================= Coverage 95.64% 95.64% ======================================= Files 48 49 +1 Lines 8081 8158 +77 ======================================= + Hits 7729 7803 +74 - Misses 235 238 +3 Partials 117 117 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.