indexdb_save method
Saves this IICaller into the browser's IndexDB
making it possible to store this logged in user accross browser sessions even when the SubtleCrypto session-private-key extractable
property is set to false.
Implementation
Future<void> indexdb_save() async {
if (IndexDB.is_support_here()) {
IndexDB idb = await IndexDB.open(_indexdb_name, [_indexdb_object_store_name]);
await idb.add_or_put_object(
object_store_name: _indexdb_object_store_name,
key: _indexdb_object_key_cryptokey_public,
value: this.keys.public_key,
);
await idb.add_or_put_object(
object_store_name: _indexdb_object_store_name,
key: _indexdb_object_key_cryptokey_private,
value: this.keys.private_key
);
await idb.add_or_put_object(
object_store_name: _indexdb_object_store_name,
key: _indexdb_object_key_legations,
value: this.legations.map<JSLegation>(jslegation_of_a_legation).toList(),
);
idb.shutdown();
} else {
print('IndexDB not supported here. User will be logged out when the session closes.');
}
}