now successfully encrypts a file
parent
437a74f26f
commit
26b3ba9b4a
|
@ -42,7 +42,9 @@
|
|||
}
|
||||
convertToBase64(file).then((base64) => {
|
||||
encrypt(base64).then((encrypted_content => {
|
||||
let encrypted_file: Blob = new Blob(encrypted_content, {type: "text/plain"});
|
||||
console.log(encrypted_content)
|
||||
let encrypted_b64: string = btoa(unescape(encodeURIComponent(encrypted_content)));
|
||||
let encrypted_file: Blob = new Blob([encrypted_b64], {type: "text/plain"});
|
||||
let url = URL.createObjectURL(encrypted_file);
|
||||
let a = document.createElement("a");
|
||||
a.href = url;
|
||||
|
|
|
@ -71,8 +71,8 @@ export async function encrypt(string: string) {
|
|||
key,
|
||||
encoded
|
||||
);
|
||||
console.log(ciphertext)
|
||||
return ciphertext
|
||||
let decodedCiphertext = dec.decode(ciphertext);
|
||||
return decodedCiphertext
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
import { writable} from 'svelte/store';
|
||||
|
||||
export let filename = writable("Encrypted.b64");
|
|
@ -10,5 +10,5 @@ function generateRandomString(length: number): string {
|
|||
}
|
||||
|
||||
const password: string = generateRandomString(16);
|
||||
export const globalPassword = writable(password);
|
||||
export let globalPassword = writable(password);
|
||||
|
||||
|
|
Loading…
Reference in New Issue