Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add RSA encryption function to templates #502

Merged
merged 2 commits into from
Jul 3, 2024
Merged

Conversation

LinuxSuRen
Copy link
Owner

@LinuxSuRen LinuxSuRen commented Jul 1, 2024

Related to #501

Adds the rasEncryptWithPublicKey function to the template rendering functionalities and includes unit tests for the new function.

  • New Functionality: Implements the rasEncryptWithPublicKey function in pkg/render/template.go, allowing users to encrypt content with a public key directly within templates. This function takes two string arguments (content and key), performs RSA encryption, and returns the encrypted content in base64 encoded format.
  • Error Handling: Adds error handling for key parsing and encryption processes within the rasEncryptWithPublicKey function to ensure robustness.
  • Unit Tests: Extends pkg/render/template_test.go with tests for the rasEncryptWithPublicKey function, verifying its behavior with both valid and invalid keys, and ensuring the encryption process works as expected.

For more details, open the Copilot Workspace session.

@LinuxSuRen LinuxSuRen linked an issue Jul 1, 2024 that may be closed by this pull request
@LinuxSuRen LinuxSuRen added the enhancement New feature or request label Jul 1, 2024
@LinuxSuRen LinuxSuRen marked this pull request as draft July 1, 2024 14:10
Copy link

sonarqubecloud bot commented Jul 3, 2024

Copy link

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
-0.02% 60.00%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (b7926da) 15067 6496 43.11%
Head commit (14443d2) 15086 (+19) 6501 (+5) 43.09% (-0.02%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#502) 20 12 60.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences


🚀 Don’t miss a bit, follow what’s new on Codacy.

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

Copy link

github-actions bot commented Jul 3, 2024

There are 1 test cases, failed count 0:

Name Average Max Min Count Error
9.383516ms 11.376308ms 8.331835ms 3 0

Reported by api-testing.

@LinuxSuRen LinuxSuRen marked this pull request as ready for review July 3, 2024 14:49
@LinuxSuRen LinuxSuRen merged commit 3aceced into master Jul 3, 2024
18 checks passed
@LinuxSuRen LinuxSuRen deleted the add-rsa-encrypt branch July 3, 2024 14:49
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a go template func for ras
1 participant