mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 06:59:31 +01:00
feat: add 3-layer-encryption for attachments
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { randomBytes } from "../utils/random";
|
||||
|
||||
export default class Storage {
|
||||
constructor(context) {
|
||||
this.storage = context;
|
||||
@@ -46,4 +48,10 @@ export default class Storage {
|
||||
getCryptoKey(name) {
|
||||
return this.storage.getCryptoKey(name);
|
||||
}
|
||||
|
||||
async generateRandomKey() {
|
||||
const passwordBytes = randomBytes(124);
|
||||
const password = passwordBytes.toString("base64");
|
||||
return await this.storage.generateCryptoKey(password, false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user