From 15a40f8efff70f930da102da14e9925d33cfb1c2 Mon Sep 17 00:00:00 2001 From: Jazz Turner-Baggs <473256+jazzz@users.noreply.github.com> Date: Fri, 26 Sep 2025 12:07:22 -0700 Subject: [PATCH] expose decode in content_types for apps --- .gitmodules | 3 +++ examples/nim_chat_poc.nim | 1 + src/content_types/all.nim | 14 +++++++------- vendor/illwill | 1 + 4 files changed, 12 insertions(+), 7 deletions(-) create mode 160000 vendor/illwill diff --git a/.gitmodules b/.gitmodules index ed6af0f..684984a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -26,3 +26,6 @@ url = https://github.com/narimiran/blake2.git ignore = untracked branch = master +[submodule "vendor/illwill"] + path = vendor/illwill + url = https://github.com/johnnovak/illwill.git diff --git a/examples/nim_chat_poc.nim b/examples/nim_chat_poc.nim index 11a4883..2b7327d 100644 --- a/examples/nim_chat_poc.nim +++ b/examples/nim_chat_poc.nim @@ -6,6 +6,7 @@ import ../src/chat_sdk/client import ../src/chat_sdk/conversations import ../src/chat_sdk/delivery/waku_client import ../src/chat_sdk/utils +import ../src/chat_sdk/identity import ../src/content_types/all diff --git a/src/content_types/all.nim b/src/content_types/all.nim index a9b00ab..0772639 100644 --- a/src/content_types/all.nim +++ b/src/content_types/all.nim @@ -38,14 +38,14 @@ proc encode*(frame: object): seq[byte] = result = Protobuf.encode(frame) -# proc decode*[T: object] (bytes: seq[byte], proto: typedesc[ -# T]): Result[T, string] = -# ## Encodes the frame into a byte sequence using Protobuf serialization. +proc decode*[T: object] (bytes: seq[byte], proto: typedesc[ + T]): Result[T, string] = + ## Encodes the frame into a byte sequence using Protobuf serialization. -# try: -# result = ok(Protobuf.decode(bytes, proto)) -# except ProtobufError as e: -# result = err("Failed to decode payload: " & e.msg) + try: + result = ok(Protobuf.decode(bytes, proto)) + except ProtobufError as e: + result = err("Failed to decode payload: " & e.msg) proc toContentFrame*(frame: TextFrame): ContentFrame = diff --git a/vendor/illwill b/vendor/illwill new file mode 160000 index 0000000..99a120f --- /dev/null +++ b/vendor/illwill @@ -0,0 +1 @@ +Subproject commit 99a120f7f69868b94f5d35ce7e21dd12535de70c