logos-chat/src/chat/utils.nim
Jazz Turner-Baggs 3bfba7cf25
Libchat library Integration (#55)
* chore: add smoke test and redesign CI workflow (#62)

Add a smoke test that validates the binary links all dependencies
at runtime by instantiating a client without networking. Redesign
CI into separate build and test jobs, with test gated on build.

* Add libchat module

* Add Context

* Add libchat

* Update to latest libchat

* Remove stale files

* Bump to latest Libchat

* Update imports

* Update client

* Update library to work with Libchat

* Fix examples

* Remove Tui Examples - Replace with logos-core

* Add Indentity Todo

* fix: add `build-libchat` as dependency for examples, tests, and library (#59)

The Rust liblogos_chat.so was not being built automatically, causing
runtime failures when loading the shared library.

* Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Add Todo for Sender data

* Updated error log

---------

Co-authored-by: osmaczko <33099791+osmaczko@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-18 22:20:14 +01:00

19 lines
598 B
Nim

import waku/waku_core
import std/[macros, times]
import blake2
import strutils
proc getCurrentTimestamp*(): Timestamp =
result = waku_core.getNanosecondTime(getTime().toUnix())
proc hash_func*(s: string | seq[byte]): string =
# This should be Blake2s but it does not exist so substituting with Blake2b
result = getBlake2b(s, 4, "")
proc bytesToHex*[T](bytes: openarray[T], lowercase: bool = false): string =
## Convert bytes to hex string with case option
result = ""
for b in bytes:
let hex = b.toHex(2)
result.add(if lowercase: hex.toLower() else: hex)