aboutsummaryrefslogtreecommitdiffhomepage
path: root/public/scripts/2_encryption.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/scripts/2_encryption.js')
-rw-r--r--public/scripts/2_encryption.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/public/scripts/2_encryption.js b/public/scripts/2_encryption.js
index a6f610e..7c7fb9b 100644
--- a/public/scripts/2_encryption.js
+++ b/public/scripts/2_encryption.js
@@ -10,7 +10,6 @@ let db;
*/
function setupDatabase() {
db = new Dexie('texx');
- window.db = db;
db.version(2).stores({
own_keys: '&key_type, key_data',
peer_keys: 'peer_id, key_data',
@@ -179,6 +178,15 @@ async function getPeerPublicKey(peerId) {
}
/**
+ * Resets the database/encryption
+ */
+function reset() {
+ db.delete();
+ localStorage.removeItem('database');
+ console.log('[LOG] Database has been deleted!')
+}
+
+/**
* Just a general test case
*/
function testEncryption() {
@@ -202,4 +210,5 @@ exports.decryptPrivate = decryptPrivateKey;
exports.check = isEncrypted;
exports.store = storePeerPublicKey;
exports.get = getPeerPublicKey;
+exports.reset = reset;
exports.test = testEncryption;