git » sdk » commit c5a8197

Persistence: IDB: Mark some read-only transactions as read-only

author Matthew Wild
2025-05-24 14:55:20 UTC
committer Stephen Paul Weber
2025-09-29 13:43:32 UTC
parent b8606904806150e1ad35d9dde28e9cb779b8ec13

Persistence: IDB: Mark some read-only transactions as read-only

snikket/persistence/IDB.js +3 -3

diff --git a/snikket/persistence/IDB.js b/snikket/persistence/IDB.js
index 7ff77bf..8e95739 100644
--- a/snikket/persistence/IDB.js
+++ b/snikket/persistence/IDB.js
@@ -652,7 +652,7 @@ export default (dbname, media, tokenize, stemmer) => {
 		},
 
 		getOmemoDeviceList: function (chatId, callback) {
-			const tx = db.transaction(["keyvaluepairs"], "readwrite");
+			const tx = db.transaction(["keyvaluepairs"], "readonly");
 			const store = tx.objectStore("keyvaluepairs");
 			promisifyRequest(store.get("omemo:devices:"+chatId)).then((result) => {
 				if (result === undefined) {
@@ -684,7 +684,7 @@ export default (dbname, media, tokenize, stemmer) => {
 		},
 
 		getOmemoPreKey: function (account, keyId, callback) {
-			const tx = db.transaction(["keyvaluepairs"], "readwrite");
+			const tx = db.transaction(["keyvaluepairs"], "readonly");
 			const store = tx.objectStore("keyvaluepairs");
 			promisifyRequest(store.get("omemo:prekeys:"+account+":"+keyId.toString())).then((result) => {
 				if(result === undefined) {
@@ -702,7 +702,7 @@ export default (dbname, media, tokenize, stemmer) => {
 		},
 
 		getOmemoPreKeys: function (account, callback) {
-			const tx = db.transaction(["keyvaluepairs"], "readwrite");
+			const tx = db.transaction(["keyvaluepairs"], "readonly");
 			const store = tx.objectStore("keyvaluepairs");
 			const prefix = "omemo:prekeys:"+account+":";
 			const keyRange = IDBKeyRange.bound(prefix, prefix + '\uffff');