-
-
Notifications
You must be signed in to change notification settings - Fork 351
Add doc about encryption #337
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
Conversation
|
Nice job! @drzraf @evilaliv3 Can you think of any additions to this? |
|
An asymmetric StreamEncryptor? class StreamEncryptor {
constructor(gpgKeys) {
this.gpgKeys = gpgKeys;
this._reader = [];
}
async init(flowObj) {
const { message } = await openpgp.encrypt({
message: openpgp.message.fromBinary(flowObj.file.stream(), flowObj.file.name),
publicKeys: this.gpgKeys
});
this._reader[flowObj.uniqueIdentifier] = openpgp.stream.getReader(message.packets.write());
flowObj.size = flowObj.file.size + compute_pgp_overhead(this.gpgKeys, flowObj.file.name);
}
async read(flowObj, startByte, endByte, fileType, chunk) {
const buffer = await this._reader[flowObj.uniqueIdentifier].readBytes(flowObj.chunkSize);
if (buffer && buffer.length) {
return new Blob([buffer], {type: 'application/octet-stream'});
}
}
}
var encryptor = new StreamEncryptor(gpgKeys);
new Flow({
// ...
asyncReadFileFn: encryptor.read.bind(encryptor),
initFileFn: encryptor.init.bind(encryptor),
forceChunkSize: true,
}); |
|
@drzraf nice! :) In my case, I use AES symmetric keys (to encrypt/decrypt files) managed with RSA asymmetric key pairs. We can modify the page and just put our 2 file encryption methods. |
|
@bertrandg that would be awesome, can you add it please? 👍 |
The trick is that my Since each chunk has it's own URL I can upload in parallel : Thanks to v3 stream support and respect for |
|
I've updated the doc file with your example @drzraf |
|
Sweet, can we merge it @drzraf ? |
No description provided.