What is EnIndex
Encrypted IndexedDB, made for convenience of use, using Promise instead of callbacks.
Module Load
New Module Load
// In main app.js
import eidb from "./libs/eidb.js";
Classic Load
Not recommended, need to wait for eidb to be fully loaded and exists.
<script type="module" src="eidb.js"></script>
Unencrypted Usage
// Regular open
eidb.init();
var Db = await eidb.open_av("my_db", Indices);
if (Db instanceof Error){
console.error(Db);
return;
}
eidb.enable_op_hist(); // Operation history
eidb.enable_fts(); // Full-text search
Db.close();
// CRUD
eidb.insert...
eidb.find...
eidb.update...
eidb.remove...
Encrypted Usage
// Secure open
eidb.init();
var Db = await eidb.s_open_av("my_db", Indices);
if (Db instanceof Error){
console.error(Db);
return;
}
eidb.s_enable_op_hist(); // Operation history
eidb.s_enable_fts(); // Full-text search
eidb.sec.prepare_keys(Username,Password);
Db.close();
// CRUD
eidb.s_insert...
eidb.s_find...
eidb.s_update...
eidb.s_remove