MCPcopy Index your code
hub / github.com/DeepNotesApp/DeepNotes / _handleUserNotification

Method _handleUserNotification

apps/client/src/code/realtime/client.ts:425–469  ·  view source on GitHub ↗
(decoder: decoding.Decoder)

Source from the content-addressed store, hash-verified

423 }
424 }
425 private async _handleUserNotification(decoder: decoding.Decoder) {
426 const notifObj: DeepNotesNotification = unpack(
427 decoding.readVarUint8Array(decoder),
428 );
429
430 pagesStore().notifications.items.unshift(notifObj);
431
432 const symmetricKey = wrapSymmetricKey(
433 internals.keyPair.decrypt(notifObj.encryptedSymmetricKey),
434 );
435
436 const notifContent = unpack(
437 symmetricKey.decrypt(notifObj.encryptedContent, {
438 padding: true,
439 associatedData: { context: 'UserNotificationContent' },
440 }),
441 );
442
443 this._logger
444 .sub('_handleUserNotification')
445 .info('notifObj: %o', notifObj);
446 this._logger
447 .sub('_handleUserNotification')
448 .info('content: %o', notifContent);
449
450 if (notifContent.agentId != null) {
451 pagesStore().groups[notifContent.groupId]?.userIds.add(
452 notifContent.agentId,
453 );
454 }
455
456 if (notifContent.patientId != null) {
457 pagesStore().groups[notifContent.groupId]?.userIds.add(
458 notifContent.patientId,
459 );
460 }
461
462 const notifInfo = await getNotificationInfo(notifObj, notifContent);
463
464 $quasar().notify({
465 ...notifInfo,
466
467 actions: notifInfo.actions,
468 });
469 }
470
471 isSynced<
472 DataPrefix_ extends DataPrefix,

Callers 1

_handleMessageMethod · 0.80

Calls 5

wrapSymmetricKeyFunction · 0.90
getNotificationInfoFunction · 0.90
subMethod · 0.80
decryptMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected