New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add encrypt route #496
base: main
Are you sure you want to change the base?
add encrypt route #496
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR! 😄
Don't forget to run make fmt
.
You should also update some routes to offer the possibility to encrypt the resulting PDFs:
pkg/gotenberg/pdfengine.go
Outdated
@@ -38,6 +38,9 @@ type PDFEngine interface { | |||
|
|||
// Convert converts the given PDF to a specific PDF format. | |||
Convert(ctx context.Context, logger *zap.Logger, format, inputPath, outputPath string) error | |||
|
|||
//Encrypt one or more PDF Files with given passwords. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//Encrypt one or more PDF Files with given passwords. | |
// Encrypt encrypts the given PDF. |
Codecov Report
@@ Coverage Diff @@
## main #496 +/- ##
==========================================
- Coverage 93.77% 91.25% -2.52%
==========================================
Files 35 36 +1
Lines 3050 3203 +153
==========================================
+ Hits 2860 2923 +63
- Misses 121 204 +83
- Partials 69 76 +7
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
regarding the routes: is it possible (or a good idea) to pass the multiPDFEngines to the chrome/libre routes? not sure atm how to access the encrypt parts from within the chrome/libre routes |
Both the Chromium and LibreOffice modules have a
For the Chromium module, you should update the For the LibreOffice module, you should update the Also, it seems the following packages do not have all required tests (I suspect most of them being "stupid" test but still): |
add encryption to all routes tests
So i added encryption to every route that handles PDFs (all chromium, libreoffice and pdfengine). Restructured the openapi.yaml a little bit, so it's easier to maintain. Tested all routes locally. I hope i got all the tests, but it's hard to tell them all apart :D |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
any feedback? |
Hello @vidschofelix, Sorry for the delay, but I don’t have enough time to properly review it. There are many implementations available, so finding the correct interface for all modules is not straightforward. Also, having an encrypt method will trigger a need for a I keep this PR open until I find some time to work on it. |
Ok, thank you :). |
It's a very useful feature, I hope I can use it soon. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
First time even touching go. Implemented encryption of PDFs for qpdf and pdfcpu. Pdftk also supports encrypting, but behaviour was weird, so i dropped it for now.
Api description was extended, but no tests so far, because i have no idea how they work in go.
Please give feedback :)