mirror of
https://github.com/logos-messaging/nim-chat-poc.git
synced 2026-07-05 07:59:32 +00:00
Integrate logos-chat with the LEZ-backed mix network: - Update vendor/nwaku to logos-delivery fork (feat/mix-rln-gifter-sim) with mix protocol, OnchainLEZGroupManager, RLN gifter client, and mix-rln-spam-protection-plugin - Add vendor/logos-lez-rln submodule for reproducible LEZ module builds - Add RLN FFI surface to liblogoschat: chat_set_rln_fetcher, chat_set_rln_config, chat_push_roots, chat_push_proof, etc. - Wire gifter client for RLN membership registration via mix network - Switch to filter-based message reception (relay: false, filter: true) - Send via lightpushPublish(mixify=true) for Sphinx onion routing - Add mix-librln separate build + duplicate symbol resolution - Exclude vendor/logos-lez-rln from nimble link creation - Update nix build for mix-librln and cross-platform support
52 lines
1.4 KiB
Nim
52 lines
1.4 KiB
Nim
import ffi
|
|
import src/chat/client
|
|
import waku/waku_mix/logos_core_client as mix_rln_client
|
|
|
|
declareLibrary("logoschat")
|
|
|
|
proc set_event_callback(
|
|
ctx: ptr FFIContext[ChatClient],
|
|
callback: FFICallBack,
|
|
userData: pointer
|
|
) {.dynlib, exportc, cdecl.} =
|
|
ctx[].eventCallback = cast[pointer](callback)
|
|
ctx[].eventUserData = userData
|
|
|
|
proc chat_set_rln_fetcher(
|
|
ctx: ptr FFIContext[ChatClient], fetcher: mix_rln_client.RlnFetcherFunc, fetcherData: pointer
|
|
) {.dynlib, exportc, cdecl.} =
|
|
if fetcher.isNil:
|
|
echo "error: nil fetcher in chat_set_rln_fetcher"
|
|
return
|
|
mix_rln_client.setRlnFetcher(fetcher, fetcherData)
|
|
|
|
proc chat_set_rln_config(
|
|
ctx: ptr FFIContext[ChatClient], configAccountId: cstring, leafIndex: cint
|
|
): cint {.dynlib, exportc, cdecl.} =
|
|
if configAccountId.isNil:
|
|
return RET_ERR
|
|
mix_rln_client.setRlnConfig($configAccountId, leafIndex.int)
|
|
return RET_OK
|
|
|
|
proc chat_set_rln_identity(
|
|
ctx: ptr FFIContext[ChatClient], idSecretHashHex: cstring
|
|
) {.dynlib, exportc, cdecl.} =
|
|
if idSecretHashHex.isNil:
|
|
return
|
|
mix_rln_client.setRlnIdentity($idSecretHashHex)
|
|
|
|
proc chat_push_roots(
|
|
ctx: ptr FFIContext[ChatClient], rootsJson: cstring
|
|
) {.dynlib, exportc, cdecl.} =
|
|
if rootsJson.isNil:
|
|
return
|
|
mix_rln_client.pushRoots($rootsJson)
|
|
|
|
proc chat_push_proof(
|
|
ctx: ptr FFIContext[ChatClient], proofJson: cstring
|
|
) {.dynlib, exportc, cdecl.} =
|
|
if proofJson.isNil:
|
|
return
|
|
mix_rln_client.pushProof($proofJson)
|
|
|