From 079bbc0ad37fca8e8360afd91fb11ca89fb3befa Mon Sep 17 00:00:00 2001 From: Dario Gabriel Lipicar Date: Thu, 11 Jun 2026 20:25:21 -0300 Subject: [PATCH] cdylib glue: seed the cdylib's protocol stack with the host auth token MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The glue's init() reads the authToken property module_initializer now surfaces on the LogosAPI object and forwards it across logos_module_accept_token under the initializer's own keys (core / capability_module). Without it the cdylib's TokenManager (a separate static copy of the singleton) is empty and every outbound call — including the capability requestModule bootstrap — is rejected as unauthorized. --- cpp-generator/experimental/lidl_gen_cdylib.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cpp-generator/experimental/lidl_gen_cdylib.cpp b/cpp-generator/experimental/lidl_gen_cdylib.cpp index f514023..6be92ab 100644 --- a/cpp-generator/experimental/lidl_gen_cdylib.cpp +++ b/cpp-generator/experimental/lidl_gen_cdylib.cpp @@ -543,6 +543,16 @@ QString lidlMakeCdylibGlueSource(const ModuleDecl& module) s << " api->property(\"modulePath\").toString().toUtf8().constData(),\n"; s << " api->property(\"instanceId\").toString().toUtf8().constData(),\n"; s << " api->property(\"instancePersistencePath\").toString().toUtf8().constData());\n"; + s << " // The cdylib runs its own protocol stack (a separate static copy with\n"; + s << " // its own TokenManager). Seed it with the host-issued auth token the\n"; + s << " // initializer surfaces as a property, under the same keys it uses\n"; + s << " // (\"core\" / \"capability_module\") — this is what authenticates the\n"; + s << " // module's OUTBOUND calls (incl. the capability requestModule flow).\n"; + s << " const QString authToken = api->property(\"authToken\").toString();\n"; + s << " if (!authToken.isEmpty()) {\n"; + s << " logos_module_accept_token(\"core\", authToken.toUtf8().constData());\n"; + s << " logos_module_accept_token(\"capability_module\", authToken.toUtf8().constData());\n"; + s << " }\n"; s << "}\n"; return c; }