Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: non encrypted notifications #558

Merged
merged 9 commits into from
Feb 19, 2025

Conversation

JeremyTubongbanua
Copy link
Member

@JeremyTubongbanua JeremyTubongbanua commented Feb 18, 2025

closes #246

- What I did

  • Added support for C SDK to send non-encrypted notifications
  • Fixed macro error I was getting regarding atauth's CMake. Figure 1 is the error I was getting
  • Added ifdef clause to packages/atauth/src/constants.h
  • Wrote test_2b_receive_non_encrypted_notifications test in test_atclient_monitor.c which is an end-to-end test for non-encrypted notifications/monitor
  • New "non_encrypted_events" examples
  • Added -f to just file's clean command

Figure 1: atauth's -D-DATAUTH_BUILD_EXECUTABLES=1 error

<command-line>: error: macro names must be identifiers
gmake[2]: *** [packages/atauth/CMakeFiles/atauth.dir/build.make:76: packages/atauth/CMakeFiles/atauth.dir/src/apkam_keys.c.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:3279: packages/atauth/CMakeFiles/atauth.dir/all] Error 2
gmake: *** [Makefile:166: all] Error 2

- How to verify it

Comments show output from running the new examples and tests

- Description for the changelog
fix: non encrypted notifications

@JeremyTubongbanua
Copy link
Member Author

non_encrypted_notification/main.c

[INFO] 2025-02-19 03:08:47.950046 | connection | Connected
[DEBG] 2025-02-19 03:08:48.108153 | connection |        SENT: "from:12snowboating"
[DEBG] 2025-02-19 03:08:48.148261 | connection |        RECV: "data:_08bd6538-684a-4c85-8b69-96741c3505b8@12snowboating:92c893be-ad04-49a5-af96-54dabd6f2e82"
[DEBG] 2025-02-19 03:08:48.159244 | connection |        SENT: "pkam:BFUgVPPt/fiaRxHCQgKLY7DMFdXl/UhIrbNrQU0ci5aREFWmRZBD7XGb/LoPP8GDxeBOpwAgfZgUyLnTY7rB/FCuHdSMAKa00Yvpjk0Mu43McoDK76uD3exSB1lCKbLiSO0EAjgBr3m6zNdp2lbjH+UjDoIe1L89z/23tUNza/vE8wM3riMx3nBwlaMu6yMrGDySYDIGJVnrdAnrHokkjkSMIIesD77K3FtxMgnG/e6p8lu4WiKf/9bvip/AWWMJ83r/eWxtmtsy/U1uOfyLELWDZRsEAnXWCz8EJBdkCqlYjBbEd1Neh8dn9YcrDuzGCGciFrUXdT463SQId4LllA=="
[DEBG] 2025-02-19 03:08:48.200547 | connection |        RECV: "data:success"
[INFO] 2025-02-19 03:08:48.200570 | main | Params:
[INFO] 2025-02-19 03:08:48.200573 | main |   atkey: 0x631485399e10
[INFO] 2025-02-19 03:08:48.200575 | main |   value: Hello, World!
[INFO] 2025-02-19 03:08:48.200580 | main |   should_encrypt: 0
[DEBG] 2025-02-19 03:08:48.200640 | connection |        SENT: "notify:isEncrypted:false:@12alpaca:non_encrypted_notification.test@12snowboating:Hello, World!"
[DEBG] 2025-02-19 03:08:48.240240 | connection |        RECV: "data:430e03e6-fa94-44f7-9945-4a5dcf442546"
jeremy@atsign:~/GitHub/at_c/examples/desktop/non_encrypted_notification$ ^C

non_encrypted_monitor.c

[INFO] 2025-02-19 03:08:45.173592 | atclient | Missing atServer host or port. Using root.atsign.org:64 atDirectory to find atServer address
[INFO] 2025-02-19 03:08:45.957458 | connection | Connected
[DEBG] 2025-02-19 03:08:46.110434 | connection |        SENT: "from:12alpaca"
[DEBG] 2025-02-19 03:08:46.148856 | connection |        RECV: "data:_066320c5-8dc8-4e32-860f-755bb96a7273@12alpaca:2609b3bb-9a39-4f6e-9335-b46fc1242a1f"
[DEBG] 2025-02-19 03:08:46.158716 | connection |        SENT: "pkam:BmSNxg4///O5w7AhFGPvJznLJ07l+H9gP8jt8GWIbrNuoBJZDXhDt6LxFuhn7Mvf463lmKZukPxhFvT4H8rcLeA+mUkIkkF16ccEKirOXD5ARPtZNOE9Rfq3hvjAWrGzOK5XFq9Bpk1yjpUcqwvKIn3cGpqNEf22/72ZYI5pEh+D6KdOcYFieaIi/Uv01HSUESvJjEIGudwZI7ZtenPg95WvJDCwrZ0SN/BxdBxygmMlrGbsjfVuPmJfOGTgf8YvXRo3ETDy6Sz2G+tpbSJZVuCFd1VKSQ0LuWP0oBICR4Fs/DlCqIjk0iYsxCYd551QumEN9b/kWxLr86xuDlFLyw=="
[DEBG] 2025-02-19 03:08:46.201194 | connection |        RECV: "data:success"
[INFO] 2025-02-19 03:08:46.201212 | atclient | Missing atServer host or port. Using root.atsign.org:64 atDirectory to find atServer address
[INFO] 2025-02-19 03:08:46.511825 | connection | Connected
[DEBG] 2025-02-19 03:08:46.665697 | connection |        SENT: "from:12alpaca"
[DEBG] 2025-02-19 03:08:46.704526 | connection |        RECV: "data:_d4b825d8-f06e-4f87-8734-db37438e312c@12alpaca:ee9eadca-bd99-4c50-b332-224d1b11fb34"
[DEBG] 2025-02-19 03:08:46.714580 | connection |        SENT: "pkam:kpnrf4ViEKmlHYBuQbajzSV9lcD3fIlYBZTDMlgp8DzDQfBC2gzvQaduyj6pCqkUnPJNZFlGdiRPhTkWSYJaa7xzgIWrnL/CUoZh/yFqA6KcET3gjXNrGIWqRnSpiYBvo6tlkjMogmDLgkCfdd8DRJT7OitMEZfToYC4U5weuQ9xVq1NhJtdkD33gxQC6Q5UMxwdkFSbdLVYWO5P4OLAO/2p/SpK5VewmyDz54EYPY72DyQoKAZPLq5K3oZKJj25ZBH0poWC1PO5lTM8W5BJIEAYr1ox9WDnu13WfqniCBYoVFpUbJo1wHYOZft7Vnw6kIp3wiMd5QMFfh9Nt87EkA=="
[DEBG] 2025-02-19 03:08:46.754292 | connection |        RECV: "data:success"
[DEBG] 2025-02-19 03:08:46.754342 | connection |        SENT: "monitor .*"
[ERROR] 2025-02-19 03:08:46.754346 | connection | recv is null. exiting
[DEBG] 2025-02-19 03:08:46.754348 | atclient_monitor |  SENT: "monitor .*"
[DEBG] 2025-02-19 03:08:48.244548 | atclient_monitor |  RECV: "@12alpaca@notification: {"id":"430e03e6-fa94-44f7-9945-4a5dcf442546","from":"@12snowboating","to":"@12alpaca","key":"@12alpaca:non_encrypted_notification.test@12snowboating","value":"Hello, World!","operation":"update","epochMillis":1739934528219,"messageType":"MessageType.key","isEncrypted":false,"metadata":{"encKeyName":null,"encAlgo":null,"ivNonce":null,"skeEncKeyName":null,"skeEncAlgo":null,"sharedKeyEnc":null,"pubKeyHash":null}}"
[INFO] 2025-02-19 03:08:48.244585 | main | Received notification: "Hello, World!"

@JeremyTubongbanua JeremyTubongbanua force-pushed the jt/fix-non-encrypted-notifications branch from 77a698e to 0f9f0fb Compare February 19, 2025 04:49
@JeremyTubongbanua JeremyTubongbanua marked this pull request as ready for review February 19, 2025 19:08
@JeremyTubongbanua
Copy link
Member Author

This is what the non-encrypted monitor/notification test looks like in test_atclient_monitor.c

[DEBG] 2025-02-19 19:04:43.209225 | test_atclient_monitor 2b | Starting test 2b
[DEBG] 2025-02-19 19:04:43.209316 | connection |        SENT: "monitor f1ba4cc1-508f-4be1-8724-dee85efc4b79"
[ERROR] 2025-02-19 19:04:43.209321 | connection | recv is null. exiting
[DEBG] 2025-02-19 19:04:43.209323 | atclient_monitor |  SENT: "monitor f1ba4cc1-508f-4be1-8724-dee85efc4b79"
[DEBG] 2025-02-19 19:04:43.209326 | test_atclient_monitor 2b | Sending non-encrypted notification..
[DEBG] 2025-02-19 19:04:43.209346 | connection |        SENT: "notify:update:isEncrypted:false:@bob🛠:non-encrypted-key.f1ba4cc1-508f-4be1-8724-dee85efc4b79@alice🛠:non-encrypted-value"
[DEBG] 2025-02-19 19:04:43.211130 | connection |        RECV: "data:b440c7c9-9356-4803-b395-d0e57812752f"
[DEBG] 2025-02-19 19:04:43.211136 | test_atclient_monitor 2b | Sent non-encrypted notification with id b440c7c9-9356-4803-b395-d0e57812752f
[DEBG] 2025-02-19 19:04:43.211855 | atclient_monitor |  RECV: "notification: {"id":"b440c7c9-9356-4803-b395-d0e57812752f","from":"@alice🛠","to":"@bob🛠","key":"@bob🛠:non-encrypted-key.f1ba4cc1-508f-4be1-8724-dee85efc4b79@alice🛠","value":"non-encrypted-value","operation":"update","epochMillis":1739991883210,"messageType":"MessageType.key","isEncrypted":false,"metadata":{"encKeyName":null,"encAlgo":null,"ivNonce":null,"skeEncKeyName":null,"skeEncAlgo":null,"sharedKeyEnc":null,"pubKeyHash":null}}"
[DEBG] 2025-02-19 19:04:43.211879 | test_atclient_monitor 2b | Received non-encrypted notification with id "b440c7c9-9356-4803-b395-d0e57812752f" with expected value "non-encrypted-value"
[DEBG] 2025-02-19 19:04:43.211883 | test_atclient_monitor 2b | Finished test 2b with exit code 0

@JeremyTubongbanua JeremyTubongbanua merged commit c2c632a into trunk Feb 19, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

at_c: non-encrypted notifications cause a segfault
2 participants