-
Notifications
You must be signed in to change notification settings - Fork 0
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
Adding a new CLI for consistent management of compression and encryption #2
Adding a new CLI for consistent management of compression and encryption #2
Conversation
✅ Deploy Preview for redirect-tutors-reader canceled.
|
interface EncryptedCompressedData { | ||
isCompressed: boolean; | ||
isEncrypted: boolean; | ||
data: string; |
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.
Structurally what I am aiming for here is two booleans to allow me know the order of operations as the encryption happens before the compression so the inverse has to occur in that order to successfully return the file
return JSON.stringify({ | ||
isCompressed, | ||
isEncrypted, | ||
data: jsonData |
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.
This is the structure we are left with meaning we can quickly get a true/false read on the JSON that is created and the "payload" of jsonData is then free to interact with and parse later.
I added two single line comments to show one of the approaches that we can then reuse when this is applied elsewhere, it creates a simple boolean control included with the modified JSON payload. That should give us a simple if statement as a control, if the booleans are there, we decrypt and / or decompress, if they are not we have a plain text JSON. |
Hi @lgriffin I have tried just focussing on the simple compress/decompress functions initially. I can successfully integrate into the generator, and have verified that they work successfully, achieving approx 5x compression. However, when the compressed file is fetched in the reader, we get "incorrect header check" consistently. In debug, we can see the correct number of raw bytes coming down, pako cannot inflate correctly. Perhaps it is related to the compression/encoding? Particularly compatibility with http/text? In addition, the controller strategy looks interesting. It could, however, be shortcutted perhpas by the upgraded generator generating a "tutors.bin" instead of "tutors.json". The reader then can attempt to fetch the "bin" version. If present, assume it is encrypted and compressed. If not present, then we fall back to fetching the json? |
Please check if the PR fulfills these requirements
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
This is a feature addition to try and partly address Issue tutors-sdk#689 wherein we need to have a consistent usage of encryption tooling and standards.
What commits does this PR relate to?
Thank you for your contribution
We hope you stay around and connect with our growing community!