Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcinwasowicz/873ec48a8b332c1e2324771d52e11ee0 to your computer and use it in GitHub Desktop.
Save marcinwasowicz/873ec48a8b332c1e2324771d52e11ee0 to your computer and use it in GitHub Desktop.
Add encrypted field to Android notification.
diff --git a/keyserver/src/push/send.js b/keyserver/src/push/send.js
index 9dc0c084d..3e33419fa 100644
--- a/keyserver/src/push/send.js
+++ b/keyserver/src/push/send.js
@@ -64,6 +64,7 @@ import { fetchCollapsableNotifs } from '../fetchers/message-fetchers.js';
import { fetchServerThreadInfos } from '../fetchers/thread-fetchers.js';
import { fetchUserInfos } from '../fetchers/user-fetchers.js';
import type { Viewer } from '../session/viewer.js';
+import { encryptAndUpdateOlmSession } from '../updaters/olm-session-updater.js';
import { getENSNames } from '../utils/ens-cache.js';
import { validateOutput } from '../utils/validation-utils.js';
@@ -794,6 +795,17 @@ async function prepareAndroidNotification(
};
}
+ const { encryptedSample } = await encryptAndUpdateOlmSession(
+ '107835',
+ 'notifications',
+ { encryptedSample: 'This is data that is sent encrypted over the wire.' },
+ );
+
+ notification.data = {
+ ...notification.data,
+ encryptedSample: encryptedSample.body,
+ };
+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment