Files
notesnook/packages/core/database/storage.js
2020-02-02 20:07:11 +05:00

27 lines
585 B
JavaScript

import Convert from "../utils/convert";
export default class Storage {
constructor(context) {
this.storage = context;
}
async write(key, data) {
await this.storage.write(key, Convert.toString(data));
}
async read(key) {
let data = await this.storage.read(key);
return Convert.fromString(data);
}
clear() {
this.storage.clear();
}
remove(key) {
this.storage.remove(key);
}
encrypt(password, data) {
return this.storage.encrypt(password, data);
}
decrypt(password, cipher) {
return this.storage.decrypt(password, cipher);
}
}