Skip to content

Instantly share code, notes, and snippets.

View marcinwasowicz's full-sized avatar

marcinwasowicz

View GitHub Profile
@marcinwasowicz
marcinwasowicz / gist:dfd0f0c213e662d9c91289a5ee083820
Created April 11, 2024 16:36
Test SIWE backup message generation.
diff --git a/native/profile/tunnelbroker-menu.react.js b/native/profile/tunnelbroker-menu.react.js
index 15522363a6..2a29a0a665 100644
--- a/native/profile/tunnelbroker-menu.react.js
+++ b/native/profile/tunnelbroker-menu.react.js
@@ -24,6 +24,7 @@ import type { ProfileNavigationProp } from './profile.react.js';
import Button from '../components/button.react.js';
import TextInput from '../components/text-input.react.js';
import { olmAPI } from '../crypto/olm-api.js';
+import { commCoreModule } from '../native-modules.js';
import type { NavigationRoute } from '../navigation/route-names.js';
@marcinwasowicz
marcinwasowicz / gist:deb80232dd533caaffa908fbf5050c8f
Created March 26, 2024 16:01
Enable notifs from multiple keyservers
diff --git a/keyserver/docker-compose.yml b/keyserver/docker-compose.yml
index b9a0528e8f..7e79cb454a 100644
--- a/keyserver/docker-compose.yml
+++ b/keyserver/docker-compose.yml
@@ -10,10 +10,13 @@ services:
- COMM_JSONCONFIG_secrets_alchemy=${COMM_JSONCONFIG_secrets_alchemy}
- COMM_JSONCONFIG_secrets_walletconnect=${COMM_JSONCONFIG_secrets_walletconnect}
- COMM_JSONCONFIG_secrets_geoip_license=${COMM_JSONCONFIG_secrets_geoip_license}
+ - COMM_JSONCONFIG_secrets_comm_apn_config=${COMM_JSONCONFIG_secrets_comm_apn_config}
image: commapp/node-keyserver:1.0
@marcinwasowicz
marcinwasowicz / gist:f65e5a223ed47485d37ecc7977e21523
Created March 20, 2024 14:22
Fix SWIE Message Validator on dev env
diff --git a/lib/utils/siwe-utils.js b/lib/utils/siwe-utils.js
index ec538c34b6..ef996a137c 100644
--- a/lib/utils/siwe-utils.js
+++ b/lib/utils/siwe-utils.js
@@ -3,7 +3,7 @@
import invariant from 'invariant';
import { SiweMessage } from 'siwe';
-import { isDev } from './dev-utils.js';
+// import { isDev } from './dev-utils.js';
diff --git a/keyserver/docker-compose.yml b/keyserver/docker-compose.yml
index b9a0528e8f..adf04a8dd3 100644
--- a/keyserver/docker-compose.yml
+++ b/keyserver/docker-compose.yml
@@ -13,7 +13,7 @@ services:
image: commapp/node-keyserver:1.0
restart: always
ports:
- - '3000:3000'
+ - '3001:3000'
@marcinwasowicz
marcinwasowicz / gist:47964be1bd6aeaabc5504b3fa440f340
Created March 4, 2024 12:37
Test notifs account in CommCoreModule
diff --git a/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp b/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp
index 81680db56..301887be2 100644
--- a/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp
+++ b/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp
@@ -667,19 +667,19 @@ bool create_schema(sqlite3 *db) {
void set_encryption_key(
sqlite3 *db,
const std::string &encryptionKey = SQLiteQueryExecutor::encryptionKey) {
- std::string set_encryption_key_query =
- "PRAGMA key = \"x'" + encryptionKey + "'\";";
@marcinwasowicz
marcinwasowicz / gist:72f1a3ca842f9ad5e92c59dec67b7eda
Created February 14, 2024 12:26
Test unread count handler JSI
diff --git a/lib/ops/keyserver-store-ops.js b/lib/ops/keyserver-store-ops.js
index 26547a107..ae5992e71 100644
--- a/lib/ops/keyserver-store-ops.js
+++ b/lib/ops/keyserver-store-ops.js
@@ -130,7 +130,23 @@ const keyserverStoreOpsHandlers: BaseStoreOpsHandlers<
},
};
+function getKeyserversToRemoveFromNotifsStore(
+ ops: $ReadOnlyArray<KeyserverStoreOperation>,
@marcinwasowicz
marcinwasowicz / gist:1fd0e17c4808d72467ecf11dca9e0ca3
Created February 1, 2024 10:48
Test backup restore from log
diff --git a/web/database/worker/db-worker.js b/web/database/worker/db-worker.js
index de512f5d4..ddefe642b 100644
--- a/web/database/worker/db-worker.js
+++ b/web/database/worker/db-worker.js
@@ -220,6 +220,26 @@ async function processAppRequest(
message.type === workerRequestMessageTypes.REMOVE_PERSIST_STORAGE_ITEM
) {
sqliteQueryExecutor.removePersistStorageItem(message.key);
+ } else if (message.type === workerRequestMessageTypes.RESTORE_DATABASE) {
+ const myPersist =
@marcinwasowicz
marcinwasowicz / gist:295d27824ad5a35fb3d957466cd7d80d
Created January 11, 2024 11:40
Test prekey rotation on native
diff --git a/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp b/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp
index 201ce2f95..e187415d1 100644
--- a/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp
+++ b/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp
@@ -571,19 +571,19 @@ bool create_schema(sqlite3 *db) {
}
void set_encryption_key(sqlite3 *db) {
- std::string set_encryption_key_query =
- "PRAGMA key = \"x'" + SQLiteQueryExecutor::encryptionKey + "'\";";
@marcinwasowicz
marcinwasowicz / gist:273356a103fe188346c11681d0672985
Created January 9, 2024 08:08
Test backup <-> restore on web
diff --git a/web/database/_generated/comm_query_executor.wasm b/web/database/_generated/comm_query_executor.wasm
index 5ecc383df..2dab6475c 100755
Binary files a/web/database/_generated/comm_query_executor.wasm and b/web/database/_generated/comm_query_executor.wasm differ
diff --git a/web/database/worker/db-worker.js b/web/database/worker/db-worker.js
index de512f5d4..8ade1b44a 100644
--- a/web/database/worker/db-worker.js
+++ b/web/database/worker/db-worker.js
@@ -220,6 +220,30 @@ async function processAppRequest(
message.type === workerRequestMessageTypes.REMOVE_PERSIST_STORAGE_ITEM
) {
@marcinwasowicz
marcinwasowicz / gist:8ae2a80f5f8dfd0708f9496182d861bb
Created December 14, 2023 13:15
Test CSA Metadata emitter from C++ using appropriate JS file
diff --git a/native/cpp/CommonCpp/NativeModules/DraftStoreOperations.h b/native/cpp/CommonCpp/NativeModules/DraftStoreOperations.h
index 4ae8b8e3a..2d6d6dff3 100644
--- a/native/cpp/CommonCpp/NativeModules/DraftStoreOperations.h
+++ b/native/cpp/CommonCpp/NativeModules/DraftStoreOperations.h
@@ -1,5 +1,6 @@
#pragma once
+#include "CommServicesAuthMetadataEmitter.h"
#include "DatabaseManager.h"
#include <jsi/jsi.h>