convert to base64 before encryption
This commit is contained in:
parent
9981d9bb3d
commit
15c67e403f
2 changed files with 8 additions and 5 deletions
|
@ -35,9 +35,9 @@ const main = () => {
|
||||||
);
|
);
|
||||||
|
|
||||||
// Send the file to the user
|
// Send the file to the user
|
||||||
const blob = new Blob([decrypted_file], {
|
const blob = new Blob([
|
||||||
type: "application/json",
|
atob(decrypted_file.split(";base64,").pop()),
|
||||||
});
|
]);
|
||||||
const url = URL.createObjectURL(blob);
|
const url = URL.createObjectURL(blob);
|
||||||
download(url, decrypted_filename);
|
download(url, decrypted_filename);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -70,7 +70,10 @@ const update = (element, text, tag = undefined) => {
|
||||||
* @param file File to send
|
* @param file File to send
|
||||||
*/
|
*/
|
||||||
const send = (file, element) => {
|
const send = (file, element) => {
|
||||||
file.text().then((content) => {
|
let reader = new FileReader();
|
||||||
|
reader.readAsDataURL(file);
|
||||||
|
reader.onload = () => {
|
||||||
|
const content = reader.result.split(";base64,").pop();
|
||||||
const req = new XMLHttpRequest();
|
const req = new XMLHttpRequest();
|
||||||
|
|
||||||
element = update(element, "Génération des clefs...", "H3");
|
element = update(element, "Génération des clefs...", "H3");
|
||||||
|
@ -135,5 +138,5 @@ const send = (file, element) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
});
|
};
|
||||||
};
|
};
|
||||||
|
|
Reference in a new issue