space-data-module-sdk 0.8.4 → 0.8.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (354) hide show
  1. package/README.md +117 -20
  2. package/bin/space-data-module.js +263 -0
  3. package/docs/.nojekyll +1 -0
  4. package/docs/AGENTS.md +34 -0
  5. package/docs/architecture.svg +141 -0
  6. package/docs/browser-wasmedge-isomorphic.md +179 -0
  7. package/docs/flatsql-streaming-standard.md +341 -0
  8. package/docs/gpu-module-abi.md +193 -0
  9. package/docs/index.html +125 -0
  10. package/docs/isomorphic-pthreads.md +188 -0
  11. package/docs/isomorphic-sdn-runtime-plan.md +167 -0
  12. package/docs/language-runtime-matrix.md +82 -0
  13. package/docs/manifest-structure.svg +114 -0
  14. package/docs/module-bundle-runtime-plan.md +19 -0
  15. package/docs/module-lifecycle.svg +70 -0
  16. package/docs/module-publication-standard.md +540 -0
  17. package/docs/node-red-default-node-parity.md +88 -0
  18. package/docs/protocol-installation.md +196 -0
  19. package/docs/secrets-capability.md +152 -0
  20. package/docs/styles.css +288 -0
  21. package/docs/testing-harness.md +408 -0
  22. package/docs/tri-runtime-parity.md +132 -0
  23. package/docs/wallet-callback.html +2 -0
  24. package/package.json +25 -6
  25. package/schemas/HttpRequestAbi.fbs +41 -0
  26. package/schemas/HttpResponseAbi.fbs +36 -0
  27. package/schemas/PluginManifest.fbs +2 -1
  28. package/src/AGENTS.md +1 -1
  29. package/src/app/codec.js +548 -0
  30. package/src/app/index.js +6 -0
  31. package/src/browser.js +5 -0
  32. package/src/bundle/constants.js +1 -0
  33. package/src/bundle/index.js +15 -0
  34. package/src/bundle/sigdomain.js +179 -0
  35. package/src/bundle/signing.js +767 -0
  36. package/src/bundle/wasm.js +3 -2
  37. package/src/capabilities.js +3 -0
  38. package/src/compat/index.js +7 -0
  39. package/src/compat/sdnLegacy.js +449 -0
  40. package/src/compiler/compileModule.js +556 -55
  41. package/src/compiler/flatcSupport.js +41 -27
  42. package/src/compiler/index.d.ts +2 -0
  43. package/src/compiler/index.js +18 -0
  44. package/src/compiler/invokeGlue.js +1212 -183
  45. package/src/compiler/pthreadArtifactGuard.js +910 -0
  46. package/src/compiler/sdnShimGenerator.js +323 -0
  47. package/src/compiler/wasiThreadsToolchain.js +150 -0
  48. package/src/compliance/index.js +11 -1
  49. package/src/compliance/legacyWildcardPorts.js +228 -0
  50. package/src/compliance/pluginCompliance.js +1000 -96
  51. package/src/field-stream/index.d.ts +31 -0
  52. package/src/field-stream/index.js +119 -0
  53. package/src/flow/dependencyStreamBridge.js +234 -0
  54. package/src/flow/flatsqlLinkShim.js +304 -0
  55. package/src/flow/flowCodec.js +107 -0
  56. package/src/flow/flowCompiler.js +2900 -0
  57. package/src/flow/flowRuntimeHost.js +877 -0
  58. package/src/flow/index.d.ts +117 -0
  59. package/src/flow/index.js +31 -0
  60. package/src/flow/isomorphicFlowHost.js +384 -0
  61. package/src/flow/jsFlowRuntime.js +275 -0
  62. package/src/flow/normalize.js +294 -0
  63. package/src/flow/runtime-src/flow_runtime.cpp +1699 -0
  64. package/src/flow/vendor/sdn-flow/MethodRegistry.js +400 -0
  65. package/src/flow/vendor/sdn-flow/constants.js +39 -0
  66. package/src/flow/vendor/sdn-flow/index.js +29 -0
  67. package/src/flow/vendor/sdn-flow/normalize.js +506 -0
  68. package/src/flow/vendor/sdn-flow/wasmCompatibility.js +189 -0
  69. package/src/generated/http/cpp/HttpRequestAbi_generated.h +285 -0
  70. package/src/generated/http/cpp/HttpResponseAbi_generated.h +192 -0
  71. package/src/generated/http/sdn/http/http-header.js +53 -0
  72. package/src/generated/http/sdn/http/http-header.ts +67 -0
  73. package/src/generated/http/sdn/http/http-request.js +132 -0
  74. package/src/generated/http/sdn/http/http-request.ts +179 -0
  75. package/src/generated/http/sdn/http/http-response.js +144 -0
  76. package/src/generated/http/sdn/http/http-response.ts +168 -0
  77. package/src/generated/http/sdn/http.js +11 -0
  78. package/src/generated/http/sdn/http.ts +4 -0
  79. package/src/generated/orbpro/flow/backpressure-policy.d.ts +12 -0
  80. package/src/generated/orbpro/flow/backpressure-policy.d.ts.map +1 -0
  81. package/src/generated/orbpro/flow/backpressure-policy.js +17 -0
  82. package/src/generated/orbpro/flow/backpressure-policy.js.map +1 -0
  83. package/src/generated/orbpro/flow/backpressure-policy.ts +15 -0
  84. package/src/generated/orbpro/flow/flow-bundle-manifest.d.ts +142 -0
  85. package/src/generated/orbpro/flow/flow-bundle-manifest.d.ts.map +1 -0
  86. package/src/generated/orbpro/flow/flow-bundle-manifest.js +304 -0
  87. package/src/generated/orbpro/flow/flow-bundle-manifest.js.map +1 -0
  88. package/src/generated/orbpro/flow/flow-bundle-manifest.ts +399 -0
  89. package/src/generated/orbpro/flow/flow-edge.d.ts +113 -0
  90. package/src/generated/orbpro/flow/flow-edge.d.ts.map +1 -0
  91. package/src/generated/orbpro/flow/flow-edge.js +221 -0
  92. package/src/generated/orbpro/flow/flow-edge.js.map +1 -0
  93. package/src/generated/orbpro/flow/flow-edge.ts +292 -0
  94. package/src/generated/orbpro/flow/flow-node.d.ts +80 -0
  95. package/src/generated/orbpro/flow/flow-node.d.ts.map +1 -0
  96. package/src/generated/orbpro/flow/flow-node.js +158 -0
  97. package/src/generated/orbpro/flow/flow-node.js.map +1 -0
  98. package/src/generated/orbpro/flow/flow-node.ts +202 -0
  99. package/src/generated/orbpro/flow/flow-program.d.ts +164 -0
  100. package/src/generated/orbpro/flow/flow-program.d.ts.map +1 -0
  101. package/src/generated/orbpro/flow/flow-program.js +350 -0
  102. package/src/generated/orbpro/flow/flow-program.js.map +1 -0
  103. package/src/generated/orbpro/flow/flow-program.ts +477 -0
  104. package/src/generated/orbpro/flow/flow-trigger.d.ts +108 -0
  105. package/src/generated/orbpro/flow/flow-trigger.d.ts.map +1 -0
  106. package/src/generated/orbpro/flow/flow-trigger.js +207 -0
  107. package/src/generated/orbpro/flow/flow-trigger.js.map +1 -0
  108. package/src/generated/orbpro/flow/flow-trigger.ts +276 -0
  109. package/src/generated/orbpro/flow/node-kind.d.ts +13 -0
  110. package/src/generated/orbpro/flow/node-kind.d.ts.map +1 -0
  111. package/src/generated/orbpro/flow/node-kind.js +16 -0
  112. package/src/generated/orbpro/flow/node-kind.js.map +1 -0
  113. package/src/generated/orbpro/{invoke.ts → flow/node-kind.ts} +12 -2
  114. package/src/generated/orbpro/flow/plugin-version-binding.d.ts +52 -0
  115. package/src/generated/orbpro/flow/plugin-version-binding.d.ts.map +1 -0
  116. package/src/generated/orbpro/flow/plugin-version-binding.js +85 -0
  117. package/src/generated/orbpro/flow/plugin-version-binding.js.map +1 -0
  118. package/src/generated/orbpro/flow/plugin-version-binding.ts +121 -0
  119. package/src/generated/orbpro/flow/schema-hash-binding.d.ts +70 -0
  120. package/src/generated/orbpro/flow/schema-hash-binding.d.ts.map +1 -0
  121. package/src/generated/orbpro/flow/schema-hash-binding.js +143 -0
  122. package/src/generated/orbpro/flow/schema-hash-binding.js.map +1 -0
  123. package/src/generated/orbpro/flow/schema-hash-binding.ts +189 -0
  124. package/src/generated/orbpro/flow/trigger-binding.d.ts +71 -0
  125. package/src/generated/orbpro/flow/trigger-binding.d.ts.map +1 -0
  126. package/src/generated/orbpro/flow/trigger-binding.js +142 -0
  127. package/src/generated/orbpro/flow/trigger-binding.js.map +1 -0
  128. package/src/generated/orbpro/flow/trigger-binding.ts +181 -0
  129. package/src/generated/orbpro/flow/trigger-kind.d.ts +14 -0
  130. package/src/generated/orbpro/flow/trigger-kind.d.ts.map +1 -0
  131. package/src/generated/orbpro/flow/trigger-kind.js +17 -0
  132. package/src/generated/orbpro/flow/trigger-kind.js.map +1 -0
  133. package/src/generated/orbpro/flow/trigger-kind.ts +17 -0
  134. package/src/generated/orbpro/flow.d.ts +21 -0
  135. package/src/generated/orbpro/flow.d.ts.map +1 -0
  136. package/src/generated/orbpro/flow.js +23 -0
  137. package/src/generated/orbpro/flow.js.map +1 -0
  138. package/src/generated/orbpro/flow.ts +24 -0
  139. package/src/generated/orbpro/manifest/capability-kind.d.ts +2 -1
  140. package/src/generated/orbpro/manifest/capability-kind.js +1 -0
  141. package/src/generated/orbpro/manifest/capability-kind.ts +1 -0
  142. package/src/generated/orbpro/plugin/stream-invoke-request.d.ts +93 -0
  143. package/src/generated/orbpro/plugin/stream-invoke-request.js +160 -0
  144. package/src/generated/orbpro/plugin/stream-invoke-request.ts +211 -0
  145. package/src/generated/orbpro/plugin/stream-invoke-response.d.ts +99 -0
  146. package/src/generated/orbpro/plugin/stream-invoke-response.js +175 -0
  147. package/src/generated/orbpro/plugin/stream-invoke-response.ts +226 -0
  148. package/src/generated/orbpro/plugin.js +8 -0
  149. package/src/generated/orbpro/stream.d.ts +12 -0
  150. package/src/generated/orbpro/stream.js +14 -0
  151. package/src/generated/orbpro/stream.ts +15 -0
  152. package/src/generated/spacedatastandards/plg/EntryFunction.d.ts +52 -0
  153. package/src/generated/spacedatastandards/plg/EntryFunction.d.ts.map +1 -0
  154. package/src/generated/spacedatastandards/plg/EntryFunction.js +106 -0
  155. package/src/generated/spacedatastandards/plg/EntryFunction.ts +162 -0
  156. package/src/generated/spacedatastandards/plg/FlatBufferTypeRef.d.ts +90 -0
  157. package/src/generated/spacedatastandards/plg/FlatBufferTypeRef.d.ts.map +1 -0
  158. package/src/generated/spacedatastandards/plg/FlatBufferTypeRef.js +189 -0
  159. package/src/generated/spacedatastandards/plg/FlatBufferTypeRef.ts +270 -0
  160. package/src/generated/spacedatastandards/plg/PLG.d.ts +492 -0
  161. package/src/generated/spacedatastandards/plg/PLG.d.ts.map +1 -0
  162. package/src/generated/spacedatastandards/plg/PLG.js +1139 -0
  163. package/src/generated/spacedatastandards/plg/PLG.ts +1600 -0
  164. package/src/generated/spacedatastandards/plg/PLGAcceptedTypeSet.d.ts +63 -0
  165. package/src/generated/spacedatastandards/plg/PLGAcceptedTypeSet.d.ts.map +1 -0
  166. package/src/generated/spacedatastandards/plg/PLGAcceptedTypeSet.js +138 -0
  167. package/src/generated/spacedatastandards/plg/PLGAcceptedTypeSet.ts +189 -0
  168. package/src/generated/spacedatastandards/plg/PLGBuildArtifact.d.ts +41 -0
  169. package/src/generated/spacedatastandards/plg/PLGBuildArtifact.d.ts.map +1 -0
  170. package/src/generated/spacedatastandards/plg/PLGBuildArtifact.js +104 -0
  171. package/src/generated/spacedatastandards/plg/PLGBuildArtifact.ts +151 -0
  172. package/src/generated/spacedatastandards/plg/PLGFlowEdge.d.ts +68 -0
  173. package/src/generated/spacedatastandards/plg/PLGFlowEdge.d.ts.map +1 -0
  174. package/src/generated/spacedatastandards/plg/PLGFlowEdge.js +124 -0
  175. package/src/generated/spacedatastandards/plg/PLGFlowEdge.ts +184 -0
  176. package/src/generated/spacedatastandards/plg/PLGFlowEdgeContract.d.ts +58 -0
  177. package/src/generated/spacedatastandards/plg/PLGFlowEdgeContract.d.ts.map +1 -0
  178. package/src/generated/spacedatastandards/plg/PLGFlowEdgeContract.js +126 -0
  179. package/src/generated/spacedatastandards/plg/PLGFlowEdgeContract.ts +161 -0
  180. package/src/generated/spacedatastandards/plg/PLGFlowNode.d.ts +82 -0
  181. package/src/generated/spacedatastandards/plg/PLGFlowNode.d.ts.map +1 -0
  182. package/src/generated/spacedatastandards/plg/PLGFlowNode.js +164 -0
  183. package/src/generated/spacedatastandards/plg/PLGFlowNode.ts +244 -0
  184. package/src/generated/spacedatastandards/plg/PLGFlowTrigger.d.ts +55 -0
  185. package/src/generated/spacedatastandards/plg/PLGFlowTrigger.d.ts.map +1 -0
  186. package/src/generated/spacedatastandards/plg/PLGFlowTrigger.js +105 -0
  187. package/src/generated/spacedatastandards/plg/PLGFlowTrigger.ts +162 -0
  188. package/src/generated/spacedatastandards/plg/PLGFlowTriggerBinding.d.ts +42 -0
  189. package/src/generated/spacedatastandards/plg/PLGFlowTriggerBinding.d.ts.map +1 -0
  190. package/src/generated/spacedatastandards/plg/PLGFlowTriggerBinding.js +83 -0
  191. package/src/generated/spacedatastandards/plg/PLGFlowTriggerBinding.ts +127 -0
  192. package/src/generated/spacedatastandards/plg/PLGHostCapability.d.ts +36 -0
  193. package/src/generated/spacedatastandards/plg/PLGHostCapability.d.ts.map +1 -0
  194. package/src/generated/spacedatastandards/plg/PLGHostCapability.js +90 -0
  195. package/src/generated/spacedatastandards/plg/PLGHostCapability.ts +127 -0
  196. package/src/generated/spacedatastandards/plg/PLGMethodManifest.d.ts +53 -0
  197. package/src/generated/spacedatastandards/plg/PLGMethodManifest.d.ts.map +1 -0
  198. package/src/generated/spacedatastandards/plg/PLGMethodManifest.js +153 -0
  199. package/src/generated/spacedatastandards/plg/PLGMethodManifest.ts +210 -0
  200. package/src/generated/spacedatastandards/plg/PLGPortManifest.d.ts +70 -0
  201. package/src/generated/spacedatastandards/plg/PLGPortManifest.d.ts.map +1 -0
  202. package/src/generated/spacedatastandards/plg/PLGPortManifest.js +149 -0
  203. package/src/generated/spacedatastandards/plg/PLGPortManifest.ts +212 -0
  204. package/src/generated/spacedatastandards/plg/PLGProtocolSpec.d.ts +73 -0
  205. package/src/generated/spacedatastandards/plg/PLGProtocolSpec.d.ts.map +1 -0
  206. package/src/generated/spacedatastandards/plg/PLGProtocolSpec.js +199 -0
  207. package/src/generated/spacedatastandards/plg/PLGProtocolSpec.ts +292 -0
  208. package/src/generated/spacedatastandards/plg/PLGTimerSpec.d.ts +40 -0
  209. package/src/generated/spacedatastandards/plg/PLGTimerSpec.d.ts.map +1 -0
  210. package/src/generated/spacedatastandards/plg/PLGTimerSpec.js +103 -0
  211. package/src/generated/spacedatastandards/plg/PLGTimerSpec.ts +148 -0
  212. package/src/generated/spacedatastandards/plg/PluginCapability.d.ts +41 -0
  213. package/src/generated/spacedatastandards/plg/PluginCapability.d.ts.map +1 -0
  214. package/src/generated/spacedatastandards/plg/PluginCapability.js +82 -0
  215. package/src/generated/spacedatastandards/plg/{plugin-capability.ts → PluginCapability.ts} +55 -18
  216. package/src/generated/spacedatastandards/plg/PluginDependency.d.ts +42 -0
  217. package/src/generated/spacedatastandards/plg/PluginDependency.d.ts.map +1 -0
  218. package/src/generated/spacedatastandards/plg/PluginDependency.js +80 -0
  219. package/src/generated/spacedatastandards/plg/PluginDependency.ts +124 -0
  220. package/src/generated/spacedatastandards/plg/TAB.d.ts +85 -0
  221. package/src/generated/spacedatastandards/plg/TAB.d.ts.map +1 -0
  222. package/src/generated/spacedatastandards/plg/TAB.js +173 -0
  223. package/src/generated/spacedatastandards/plg/TAB.ts +228 -0
  224. package/src/generated/spacedatastandards/plg/bufferMutability.d.ts +18 -0
  225. package/src/generated/spacedatastandards/plg/bufferMutability.d.ts.map +1 -0
  226. package/src/generated/spacedatastandards/plg/bufferMutability.js +20 -0
  227. package/src/generated/spacedatastandards/plg/bufferMutability.ts +23 -0
  228. package/src/generated/spacedatastandards/plg/bufferOwnership.d.ts +18 -0
  229. package/src/generated/spacedatastandards/plg/bufferOwnership.d.ts.map +1 -0
  230. package/src/generated/spacedatastandards/plg/bufferOwnership.js +20 -0
  231. package/src/generated/spacedatastandards/plg/bufferOwnership.ts +23 -0
  232. package/src/generated/spacedatastandards/plg/drainBehavior.d.ts +20 -0
  233. package/src/generated/spacedatastandards/plg/drainBehavior.d.ts.map +1 -0
  234. package/src/generated/spacedatastandards/plg/drainBehavior.js +22 -0
  235. package/src/generated/spacedatastandards/plg/drainBehavior.ts +25 -0
  236. package/src/generated/spacedatastandards/plg/flowEdgeRoutePolicy.d.ts +10 -0
  237. package/src/generated/spacedatastandards/plg/flowEdgeRoutePolicy.d.ts.map +1 -0
  238. package/src/generated/spacedatastandards/plg/flowEdgeRoutePolicy.js +12 -0
  239. package/src/generated/spacedatastandards/plg/flowEdgeRoutePolicy.ts +13 -0
  240. package/src/generated/spacedatastandards/plg/hostCapabilityKind.d.ts +51 -0
  241. package/src/generated/spacedatastandards/plg/hostCapabilityKind.d.ts.map +1 -0
  242. package/src/generated/spacedatastandards/plg/hostCapabilityKind.js +53 -0
  243. package/src/generated/spacedatastandards/plg/hostCapabilityKind.ts +55 -0
  244. package/src/generated/spacedatastandards/plg/invokeSurfaceKind.d.ts +15 -0
  245. package/src/generated/spacedatastandards/plg/invokeSurfaceKind.d.ts.map +1 -0
  246. package/src/generated/spacedatastandards/plg/invokeSurfaceKind.js +17 -0
  247. package/src/generated/spacedatastandards/plg/invokeSurfaceKind.ts +19 -0
  248. package/src/generated/spacedatastandards/plg/main.d.ts +29 -0
  249. package/src/generated/spacedatastandards/plg/main.d.ts.map +1 -0
  250. package/src/generated/spacedatastandards/plg/main.js +30 -0
  251. package/src/generated/spacedatastandards/plg/main.ts +32 -0
  252. package/src/generated/spacedatastandards/plg/payloadWireFormat.d.ts +17 -0
  253. package/src/generated/spacedatastandards/plg/payloadWireFormat.d.ts.map +1 -0
  254. package/src/generated/spacedatastandards/plg/payloadWireFormat.js +19 -0
  255. package/src/generated/spacedatastandards/plg/payloadWireFormat.ts +21 -0
  256. package/src/generated/spacedatastandards/plg/pluginCategory.d.ts +82 -0
  257. package/src/generated/spacedatastandards/plg/pluginCategory.d.ts.map +1 -0
  258. package/src/generated/spacedatastandards/plg/pluginCategory.js +84 -0
  259. package/src/generated/spacedatastandards/plg/pluginCategory.ts +103 -0
  260. package/src/generated/spacedatastandards/plg/publicationState.d.ts +18 -0
  261. package/src/generated/spacedatastandards/plg/publicationState.d.ts.map +1 -0
  262. package/src/generated/spacedatastandards/plg/publicationState.js +20 -0
  263. package/src/generated/spacedatastandards/plg/purchaseTier.d.ts +18 -0
  264. package/src/generated/spacedatastandards/plg/purchaseTier.d.ts.map +1 -0
  265. package/src/generated/spacedatastandards/plg/purchaseTier.js +20 -0
  266. package/src/host/AGENTS.md +2 -2
  267. package/src/host/abi.js +53 -66
  268. package/src/host/browserHost.js +355 -8
  269. package/src/host/cpp/keyslotClient.hpp +231 -0
  270. package/src/host/cpp/secretsClient.hpp +583 -0
  271. package/src/host/hostcallWire.js +183 -0
  272. package/src/host/index.js +2 -0
  273. package/src/host/isomorphicLoader.js +44 -7
  274. package/src/host/nodeHost.js +227 -8
  275. package/src/host/sabHostcallChannel.js +206 -0
  276. package/src/host/timerDriver.js +203 -0
  277. package/src/host/wasiShim.js +41 -1
  278. package/src/host/wasiThreadBrowserWorker.mjs +48 -0
  279. package/src/host/wasiThreadHost.js +393 -0
  280. package/src/host/wasiThreadWorker.mjs +32 -0
  281. package/src/host/wasiThreadWorkerRuntime.js +93 -0
  282. package/src/http/index.js +339 -0
  283. package/src/index.d.ts +725 -11
  284. package/src/index.js +4 -0
  285. package/src/invoke/codec.js +1202 -128
  286. package/src/invoke/index.js +5 -1
  287. package/src/licensing/index.d.ts +2 -0
  288. package/src/licensing/index.js +2 -0
  289. package/src/licensing/records.js +287 -8
  290. package/src/manifest/codec.js +62 -14
  291. package/src/manifest/index.js +2 -0
  292. package/src/manifest/legacyToPlg.js +164 -25
  293. package/src/manifest/normalize.js +1 -0
  294. package/src/manifest/plgCodec.js +1303 -62
  295. package/src/manifest/typeRefs.js +162 -24
  296. package/src/runtime/compiledRuntimeAbi.js +47 -0
  297. package/src/runtime/compiledRuntimeAbi.json +33 -0
  298. package/src/runtime/index.d.ts +32 -0
  299. package/src/runtime/index.js +1 -0
  300. package/src/runtime-host/index.js +3 -0
  301. package/src/runtime-host/methodRegistry.js +55 -0
  302. package/src/standards/index.js +200 -56
  303. package/src/standards/sharedCatalog.js +16 -0
  304. package/src/testing/browserModuleHarness.js +604 -31
  305. package/src/testing/docker/wasmedge-parity.Dockerfile +39 -0
  306. package/src/testing/index.d.ts +151 -0
  307. package/src/testing/index.js +21 -0
  308. package/src/testing/native/wasmedge_emscripten_pthread_runner.c +25 -1
  309. package/src/testing/parityBrowserRunner.js +138 -0
  310. package/src/testing/parityHarness.js +616 -0
  311. package/src/testing/parityLanes.js +537 -0
  312. package/src/testing/processInvoke.js +29 -21
  313. package/src/testing/streamInvokeCodec.js +10 -175
  314. package/src/testing/wasmedgePin.json +6 -0
  315. package/src/testing/workerModuleHarness.js +242 -0
  316. package/src/testing/workerModuleHarnessWorker.js +176 -0
  317. package/src/transport/index.js +3 -0
  318. package/src/transport/pki.js +352 -14
  319. package/src/transport/records.js +16 -7
  320. package/src/utils/ecdsaDer.js +106 -0
  321. package/src/utils/wasmCrypto.js +0 -43
  322. package/templates/gpu-module/README.md +48 -0
  323. package/templates/gpu-module/include/space_data_gpu_abi.h +122 -0
  324. package/templates/gpu-module/manifest.json +84 -0
  325. package/schemas/PluginInvokeRequest.fbs +0 -18
  326. package/schemas/PluginInvokeResponse.fbs +0 -30
  327. package/schemas/spacedatastandards/PLG.fbs +0 -191
  328. package/src/generated/orbpro/invoke/plugin-invoke-request.d.ts +0 -51
  329. package/src/generated/orbpro/invoke/plugin-invoke-request.d.ts.map +0 -1
  330. package/src/generated/orbpro/invoke/plugin-invoke-request.js +0 -131
  331. package/src/generated/orbpro/invoke/plugin-invoke-request.js.map +0 -1
  332. package/src/generated/orbpro/invoke/plugin-invoke-request.ts +0 -173
  333. package/src/generated/orbpro/invoke/plugin-invoke-response.d.ts +0 -76
  334. package/src/generated/orbpro/invoke/plugin-invoke-response.d.ts.map +0 -1
  335. package/src/generated/orbpro/invoke/plugin-invoke-response.js +0 -184
  336. package/src/generated/orbpro/invoke/plugin-invoke-response.js.map +0 -1
  337. package/src/generated/orbpro/invoke/plugin-invoke-response.ts +0 -243
  338. package/src/generated/orbpro/invoke.d.ts +0 -3
  339. package/src/generated/orbpro/invoke.js +0 -5
  340. package/src/generated/spacedatastandards/plg/entry-function.js +0 -86
  341. package/src/generated/spacedatastandards/plg/entry-function.ts +0 -119
  342. package/src/generated/spacedatastandards/plg/index.js +0 -16
  343. package/src/generated/spacedatastandards/plg/index.ts +0 -11
  344. package/src/generated/spacedatastandards/plg/plg.js +0 -657
  345. package/src/generated/spacedatastandards/plg/plg.ts +0 -924
  346. package/src/generated/spacedatastandards/plg/plugin-capability.js +0 -66
  347. package/src/generated/spacedatastandards/plg/plugin-category.js +0 -15
  348. package/src/generated/spacedatastandards/plg/plugin-category.ts +0 -53
  349. package/src/generated/spacedatastandards/plg/plugin-dependency.js +0 -63
  350. package/src/generated/spacedatastandards/plg/plugin-dependency.ts +0 -86
  351. package/src/generated/spacedatastandards/plg/publication-state.js +0 -9
  352. package/src/generated/spacedatastandards/plg/purchase-tier.js +0 -9
  353. /package/src/generated/spacedatastandards/plg/{publication-state.ts → publicationState.ts} +0 -0
  354. /package/src/generated/spacedatastandards/plg/{purchase-tier.ts → purchaseTier.ts} +0 -0
@@ -0,0 +1,583 @@
1
+ // C++ guest-side wrapper for the `secrets` host capability.
2
+ //
3
+ // Mirrors the server-side handlers in
4
+ // sdn-server/internal/modulert/caps/secrets.go. `secrets` is the node's
5
+ // encrypted-at-rest credential keystore: an operator enters a third-party
6
+ // credential once (Space-Track, an EDC/CPF account, or ANY service they define
7
+ // a lane for), and a module the operator has explicitly approved can read that
8
+ // one lane through the two operations below.
9
+ //
10
+ // ---------------------------------------------------------------------------
11
+ // THE APPROVAL CONTRACT — read this before using the header
12
+ // ---------------------------------------------------------------------------
13
+ //
14
+ // This is the ONLY capability family that hands a guest raw plaintext secret
15
+ // material. Nothing in this header enforces anything; the guarantees are all
16
+ // host-side, and they are these:
17
+ //
18
+ // 1. CAPABILITY PER LANE. A lane named "<lane>" is gated by the capability
19
+ // "secrets:<lane>". Declare exactly the lanes you read in your manifest's
20
+ // `capabilities`. "secrets:spacetrack" conveys NOTHING about
21
+ // "secrets:edc_cpf" or any operator-defined lane — the host re-checks the
22
+ // exact lane on every single call, so a module holding one lane's grant is
23
+ // refused on every other.
24
+ //
25
+ // 2. THE OPERATOR APPROVES YOUR MODULE HASH. Every "secrets:*" capability is
26
+ // sensitive, which means the operator must record an approval for your
27
+ // module's exact SHA-256 content hash, for that exact lane, in the node's
28
+ // capability_policy.json. Without it the module is DENIED AT LOAD — the
29
+ // whole module fails to load, not just this call. Recompiling changes the
30
+ // hash and therefore revokes the approval; that is deliberate.
31
+ //
32
+ // 3. LANES ARE OPERATOR-DEFINED. Do not assume a fixed set. The well-known
33
+ // lanes ("spacetrack", "edc_cpf", "myintelsat") are only the ones the node
34
+ // ships a verifier for; an operator may create a lane for any service.
35
+ // Treat the lane id as configuration, not as a compile-time constant, and
36
+ // handle "not configured" as a normal runtime state.
37
+ //
38
+ // 4. THE CREDENTIAL ARRIVES AS PLAINTEXT. Once secrets_get() returns, the
39
+ // password is in your linear memory. The host cannot protect it any
40
+ // further. Therefore:
41
+ // - NEVER log it, and never include it in an error message, a trace, or
42
+ // a progress event.
43
+ // - NEVER persist it — not to storage.write, not to the filesystem, not
44
+ // into a record, not into a cache that outlives the call.
45
+ // - NEVER forward it anywhere except the provider it belongs to.
46
+ // - Use it, then wipe() it. Hold it for the shortest span you can.
47
+ // If your module also holds the `http` capability it is technically able to
48
+ // exfiltrate the credential; the operator's approval is the trust decision
49
+ // that permits that, so honor it.
50
+ //
51
+ // 5. THERE IS NO ENUMERATION. There is no "list" and no "export" operation,
52
+ // by design. A guest may ask for a lane it is approved for and nothing
53
+ // else — it can never discover which credentials the node holds. Do not
54
+ // probe lane names to find out.
55
+ //
56
+ // ---------------------------------------------------------------------------
57
+ // USAGE
58
+ // ---------------------------------------------------------------------------
59
+ //
60
+ // #include "sdm_hostcall_wire.hpp" // must come first
61
+ // #include "secretsClient.hpp"
62
+ //
63
+ // sdm_secrets::Credential cred;
64
+ // if (!sdm_secrets::secrets_get("spacetrack", &cred)) {
65
+ // // Not approved for this lane, or the operator has not entered it yet.
66
+ // // Report the CONDITION, never the lane's contents.
67
+ // return report_error("space-track credential unavailable");
68
+ // }
69
+ // const bool ok = provider_login(cred.username, cred.secret);
70
+ // sdm_secrets::wipe(&cred); // do this even on the failure path
71
+ //
72
+ // To decide whether to attempt a fetch at all without touching the plaintext:
73
+ //
74
+ // sdm_secrets::Status status;
75
+ // if (sdm_secrets::secrets_status("spacetrack", &status) && status.configured) { ... }
76
+ //
77
+ // Wire shapes (JSON meta documents; nothing here uses binary segments):
78
+ //
79
+ // secrets.get -> {"id":"<lane>"}
80
+ // <- {"ok":true,"result":{"id":"...","username":"...","secret":"..."}}
81
+ // secrets.status -> {"id":"<lane>"}
82
+ // <- {"ok":true,"result":{"id":"...","configured":true,
83
+ // "username_masked":"o***@example.com",
84
+ // "updated_at":"...","verified_at":"..."}}
85
+ //
86
+ // A refusal (unapproved lane, unconfigured credential, missing keystore) comes
87
+ // back as {"ok":false,...} and NEVER carries credential material. Both helpers
88
+ // return false in that case and leave their output parameter untouched.
89
+ //
90
+ // This header assumes the including translation unit has already pulled in the
91
+ // sdm_hostcall wire protocol (sdm_hostcall::call / Segment / Response — see
92
+ // space-data-network-modules/common/sdm_hostcall_wire.hpp) ahead of this file,
93
+ // since that protocol is what actually crosses the WASM import boundary.
94
+ // Keeping that as a precondition (rather than a relative #include reaching
95
+ // across repos) avoids a fragile cross-repo path that would break depending on
96
+ // checkout layout — same convention as keyslotClient.hpp.
97
+
98
+ #ifndef SDM_SECRETS_CLIENT_HPP
99
+ #define SDM_SECRETS_CLIENT_HPP
100
+
101
+ #ifndef SDM_HOSTCALL_WIRE_HPP
102
+ #error "include sdm_hostcall_wire.hpp (sdm_hostcall::call/Segment/Response) before secretsClient.hpp"
103
+ #endif
104
+
105
+ #include <cstddef>
106
+ #include <cstdint>
107
+ #include <string>
108
+ #include <string_view>
109
+
110
+ namespace sdm_secrets {
111
+
112
+ namespace detail {
113
+
114
+ inline std::string escape_json_string(std::string_view value) {
115
+ std::string escaped;
116
+ escaped.reserve(value.size());
117
+ for (const char c : value) {
118
+ switch (c) {
119
+ case '"':
120
+ escaped += "\\\"";
121
+ break;
122
+ case '\\':
123
+ escaped += "\\\\";
124
+ break;
125
+ case '\n':
126
+ escaped += "\\n";
127
+ break;
128
+ case '\r':
129
+ escaped += "\\r";
130
+ break;
131
+ case '\t':
132
+ escaped += "\\t";
133
+ break;
134
+ default:
135
+ escaped.push_back(c);
136
+ break;
137
+ }
138
+ }
139
+ return escaped;
140
+ }
141
+
142
+ inline size_t skip_ws(std::string_view text, size_t cursor) {
143
+ while (cursor < text.size()) {
144
+ const char c = text[cursor];
145
+ if (c != ' ' && c != '\t' && c != '\n' && c != '\r') {
146
+ break;
147
+ }
148
+ ++cursor;
149
+ }
150
+ return cursor;
151
+ }
152
+
153
+ inline bool hex_nibble(char c, uint32_t* out) {
154
+ if (c >= '0' && c <= '9') {
155
+ *out = static_cast<uint32_t>(c - '0');
156
+ return true;
157
+ }
158
+ if (c >= 'a' && c <= 'f') {
159
+ *out = static_cast<uint32_t>(c - 'a' + 10);
160
+ return true;
161
+ }
162
+ if (c >= 'A' && c <= 'F') {
163
+ *out = static_cast<uint32_t>(c - 'A' + 10);
164
+ return true;
165
+ }
166
+ return false;
167
+ }
168
+
169
+ inline void append_utf8(std::string* out, uint32_t code_point) {
170
+ if (code_point < 0x80u) {
171
+ out->push_back(static_cast<char>(code_point));
172
+ } else if (code_point < 0x800u) {
173
+ out->push_back(static_cast<char>(0xC0u | (code_point >> 6)));
174
+ out->push_back(static_cast<char>(0x80u | (code_point & 0x3Fu)));
175
+ } else if (code_point < 0x10000u) {
176
+ out->push_back(static_cast<char>(0xE0u | (code_point >> 12)));
177
+ out->push_back(static_cast<char>(0x80u | ((code_point >> 6) & 0x3Fu)));
178
+ out->push_back(static_cast<char>(0x80u | (code_point & 0x3Fu)));
179
+ } else {
180
+ out->push_back(static_cast<char>(0xF0u | (code_point >> 18)));
181
+ out->push_back(static_cast<char>(0x80u | ((code_point >> 12) & 0x3Fu)));
182
+ out->push_back(static_cast<char>(0x80u | ((code_point >> 6) & 0x3Fu)));
183
+ out->push_back(static_cast<char>(0x80u | (code_point & 0x3Fu)));
184
+ }
185
+ }
186
+
187
+ // parse_string reads the JSON string starting at text[cursor] == '"' and
188
+ // advances cursor past the closing quote.
189
+ //
190
+ // \uXXXX IS DECODED, including surrogate pairs. This is not optional
191
+ // pedantry: the host serializes with Go's encoding/json, whose default HTML
192
+ // escaping turns '<', '>' and '&' into <, > and &. A password
193
+ // containing any of those characters would be silently corrupted by a decoder
194
+ // that passed escapes through — and a corrupted password looks exactly like a
195
+ // wrong password at the provider.
196
+ inline bool parse_string(std::string_view text, size_t* cursor, std::string* out) {
197
+ if (!cursor || !out || *cursor >= text.size() || text[*cursor] != '"') {
198
+ return false;
199
+ }
200
+ size_t i = *cursor + 1;
201
+ std::string value;
202
+ while (i < text.size()) {
203
+ const char c = text[i++];
204
+ if (c == '"') {
205
+ *cursor = i;
206
+ *out = value;
207
+ return true;
208
+ }
209
+ if (c != '\\') {
210
+ value.push_back(c);
211
+ continue;
212
+ }
213
+ if (i >= text.size()) {
214
+ return false;
215
+ }
216
+ const char escaped = text[i++];
217
+ switch (escaped) {
218
+ case '"':
219
+ case '\\':
220
+ case '/':
221
+ value.push_back(escaped);
222
+ break;
223
+ case 'b':
224
+ value.push_back('\b');
225
+ break;
226
+ case 'f':
227
+ value.push_back('\f');
228
+ break;
229
+ case 'n':
230
+ value.push_back('\n');
231
+ break;
232
+ case 'r':
233
+ value.push_back('\r');
234
+ break;
235
+ case 't':
236
+ value.push_back('\t');
237
+ break;
238
+ case 'u': {
239
+ if (i + 4 > text.size()) {
240
+ return false;
241
+ }
242
+ uint32_t code_point = 0;
243
+ for (int n = 0; n < 4; ++n) {
244
+ uint32_t nibble = 0;
245
+ if (!hex_nibble(text[i + static_cast<size_t>(n)], &nibble)) {
246
+ return false;
247
+ }
248
+ code_point = (code_point << 4) | nibble;
249
+ }
250
+ i += 4;
251
+ // High surrogate: consume the paired low surrogate if present.
252
+ if (code_point >= 0xD800u && code_point <= 0xDBFFu &&
253
+ i + 6 <= text.size() && text[i] == '\\' && text[i + 1] == 'u') {
254
+ uint32_t low = 0;
255
+ bool low_ok = true;
256
+ for (int n = 0; n < 4; ++n) {
257
+ uint32_t nibble = 0;
258
+ if (!hex_nibble(text[i + 2 + static_cast<size_t>(n)], &nibble)) {
259
+ low_ok = false;
260
+ break;
261
+ }
262
+ low = (low << 4) | nibble;
263
+ }
264
+ if (low_ok && low >= 0xDC00u && low <= 0xDFFFu) {
265
+ code_point = 0x10000u + ((code_point - 0xD800u) << 10) + (low - 0xDC00u);
266
+ i += 6;
267
+ }
268
+ }
269
+ append_utf8(&value, code_point);
270
+ break;
271
+ }
272
+ default:
273
+ return false;
274
+ }
275
+ }
276
+ return false;
277
+ }
278
+
279
+ inline bool skip_value(std::string_view text, size_t* cursor);
280
+
281
+ // skip_container walks a balanced {...} or [...] respecting string literals,
282
+ // so a brace or bracket inside a string value cannot end it early.
283
+ inline bool skip_container(std::string_view text, size_t* cursor) {
284
+ const char open = text[*cursor];
285
+ const char close = (open == '{') ? '}' : ']';
286
+ int depth = 0;
287
+ size_t i = *cursor;
288
+ while (i < text.size()) {
289
+ const char c = text[i];
290
+ if (c == '"') {
291
+ std::string ignored;
292
+ if (!parse_string(text, &i, &ignored)) {
293
+ return false;
294
+ }
295
+ continue;
296
+ }
297
+ if (c == open) {
298
+ ++depth;
299
+ } else if (c == close) {
300
+ --depth;
301
+ if (depth == 0) {
302
+ *cursor = i + 1;
303
+ return true;
304
+ }
305
+ }
306
+ ++i;
307
+ }
308
+ return false;
309
+ }
310
+
311
+ // skip_value advances cursor past one complete JSON value.
312
+ inline bool skip_value(std::string_view text, size_t* cursor) {
313
+ size_t i = skip_ws(text, *cursor);
314
+ if (i >= text.size()) {
315
+ return false;
316
+ }
317
+ const char c = text[i];
318
+ if (c == '"') {
319
+ std::string ignored;
320
+ if (!parse_string(text, &i, &ignored)) {
321
+ return false;
322
+ }
323
+ *cursor = i;
324
+ return true;
325
+ }
326
+ if (c == '{' || c == '[') {
327
+ *cursor = i;
328
+ return skip_container(text, cursor);
329
+ }
330
+ // Number, true, false, null: run to the next structural character.
331
+ while (i < text.size()) {
332
+ const char n = text[i];
333
+ if (n == ',' || n == '}' || n == ']' || n == ' ' || n == '\t' || n == '\n' || n == '\r') {
334
+ break;
335
+ }
336
+ ++i;
337
+ }
338
+ *cursor = i;
339
+ return true;
340
+ }
341
+
342
+ // find_member locates `key` among the MEMBERS of the object beginning at
343
+ // text[object_start] == '{' and leaves value_cursor at the start of its value.
344
+ //
345
+ // This is a structural walk, not a substring search. A substring search for
346
+ // "\"secret\"" would happily match those characters inside some OTHER member's
347
+ // string value — and for a credential parser that is not a hypothetical: it
348
+ // would silently return attacker-influenced text as the password.
349
+ inline bool find_member(
350
+ std::string_view text,
351
+ size_t object_start,
352
+ std::string_view key,
353
+ size_t* value_cursor) {
354
+ if (object_start >= text.size() || text[object_start] != '{' || !value_cursor) {
355
+ return false;
356
+ }
357
+ size_t i = skip_ws(text, object_start + 1);
358
+ if (i < text.size() && text[i] == '}') {
359
+ return false; // empty object
360
+ }
361
+ while (i < text.size()) {
362
+ std::string member;
363
+ i = skip_ws(text, i);
364
+ if (!parse_string(text, &i, &member)) {
365
+ return false;
366
+ }
367
+ i = skip_ws(text, i);
368
+ if (i >= text.size() || text[i] != ':') {
369
+ return false;
370
+ }
371
+ i = skip_ws(text, i + 1);
372
+ if (member == key) {
373
+ *value_cursor = i;
374
+ return true;
375
+ }
376
+ if (!skip_value(text, &i)) {
377
+ return false;
378
+ }
379
+ i = skip_ws(text, i);
380
+ if (i < text.size() && text[i] == ',') {
381
+ i = skip_ws(text, i + 1);
382
+ continue;
383
+ }
384
+ return false; // end of object without a match
385
+ }
386
+ return false;
387
+ }
388
+
389
+ // result_object returns the cursor of the top-level "result" object in a
390
+ // response meta document ({"ok":true,"result":{...}}).
391
+ inline bool result_object(std::string_view meta, size_t* cursor) {
392
+ size_t root = skip_ws(meta, 0);
393
+ if (root >= meta.size() || meta[root] != '{') {
394
+ return false;
395
+ }
396
+ size_t value = 0;
397
+ if (!find_member(meta, root, "result", &value)) {
398
+ return false;
399
+ }
400
+ value = skip_ws(meta, value);
401
+ if (value >= meta.size() || meta[value] != '{') {
402
+ return false;
403
+ }
404
+ *cursor = value;
405
+ return true;
406
+ }
407
+
408
+ inline bool result_string(std::string_view meta, std::string_view field, std::string* out) {
409
+ size_t result = 0;
410
+ if (!result_object(meta, &result)) {
411
+ return false;
412
+ }
413
+ size_t value = 0;
414
+ if (!find_member(meta, result, field, &value)) {
415
+ return false;
416
+ }
417
+ return parse_string(meta, &value, out);
418
+ }
419
+
420
+ inline bool result_bool(std::string_view meta, std::string_view field, bool* out) {
421
+ size_t result = 0;
422
+ if (!result_object(meta, &result)) {
423
+ return false;
424
+ }
425
+ size_t value = 0;
426
+ if (!find_member(meta, result, field, &value)) {
427
+ return false;
428
+ }
429
+ value = skip_ws(meta, value);
430
+ if (value >= meta.size()) {
431
+ return false;
432
+ }
433
+ if (meta.compare(value, 4, "true") == 0) {
434
+ *out = true;
435
+ return true;
436
+ }
437
+ if (meta.compare(value, 5, "false") == 0) {
438
+ *out = false;
439
+ return true;
440
+ }
441
+ return false;
442
+ }
443
+
444
+ // Optional string member: absent (or null) is SUCCESS with an empty value.
445
+ // "verified_at" is omitted entirely for a credential that was stored and never
446
+ // verified — the normal, permanent state of a lane the node has no verifier
447
+ // for. Treating that as a parse failure would turn an honest "unverified" into
448
+ // an error.
449
+ inline bool result_optional_string(std::string_view meta, std::string_view field, std::string* out) {
450
+ size_t result = 0;
451
+ if (!result_object(meta, &result)) {
452
+ return false;
453
+ }
454
+ size_t value = 0;
455
+ if (!find_member(meta, result, field, &value)) {
456
+ out->clear();
457
+ return true;
458
+ }
459
+ value = skip_ws(meta, value);
460
+ if (value < meta.size() && meta.compare(value, 4, "null") == 0) {
461
+ out->clear();
462
+ return true;
463
+ }
464
+ return parse_string(meta, &value, out);
465
+ }
466
+
467
+ inline std::string lane_request(std::string_view lane) {
468
+ return "{\"id\":\"" + escape_json_string(lane) + "\"}";
469
+ }
470
+
471
+ } // namespace detail
472
+
473
+ // Credential is one lane's operator-entered credential.
474
+ //
475
+ // `secret` IS THE PLAINTEXT. See rule 4 in the header comment: do not log it,
476
+ // do not persist it, do not put it in an error message, and wipe() it as soon
477
+ // as the provider call is done.
478
+ struct Credential {
479
+ std::string username;
480
+ std::string secret;
481
+ };
482
+
483
+ // Status reports whether a lane holds a credential, WITHOUT disclosing it.
484
+ //
485
+ // `verified_at` is empty when the node has never successfully probed this
486
+ // credential. For an operator-defined lane that is permanent and correct — the
487
+ // node has no verifier for a service it knows nothing about — so an empty
488
+ // `verified_at` is NOT an error and must not be treated as one.
489
+ struct Status {
490
+ std::string id;
491
+ bool configured = false;
492
+ std::string username_masked;
493
+ std::string updated_at;
494
+ std::string verified_at;
495
+ };
496
+
497
+ // wipe overwrites a credential's buffers in place and clears them. Call it on
498
+ // EVERY path once the credential has been used, including error paths.
499
+ //
500
+ // This bounds the window during which the plaintext sits in linear memory. It
501
+ // is not a defense against a host that reads guest memory (nothing in a guest
502
+ // could be), and a std::string that reallocated while being built may have left
503
+ // an older copy behind — so keep the credential's lifetime short as well.
504
+ inline void wipe(Credential* credential) {
505
+ if (!credential) {
506
+ return;
507
+ }
508
+ for (size_t i = 0; i < credential->secret.size(); ++i) {
509
+ credential->secret[i] = '\0';
510
+ }
511
+ for (size_t i = 0; i < credential->username.size(); ++i) {
512
+ credential->username[i] = '\0';
513
+ }
514
+ credential->secret.clear();
515
+ credential->username.clear();
516
+ }
517
+
518
+ // secrets_get returns the operator-entered credential for `lane`.
519
+ //
520
+ // Requires the "secrets:<lane>" capability, declared in the manifest AND
521
+ // approved by the operator for this module's content hash. Returns false —
522
+ // leaving `credential_out` untouched — when the module is not approved for this
523
+ // lane, the lane holds no credential, the node has no keystore, or the response
524
+ // cannot be parsed. A false return NEVER means "empty credential"; it means no
525
+ // credential was obtained.
526
+ inline bool secrets_get(std::string_view lane, Credential* credential_out) {
527
+ if (!credential_out || lane.empty()) {
528
+ return false;
529
+ }
530
+ sdm_hostcall::Response response;
531
+ if (!sdm_hostcall::call("secrets.get", detail::lane_request(lane), {}, &response)) {
532
+ return false;
533
+ }
534
+ std::string username;
535
+ std::string secret;
536
+ if (!detail::result_string(response.meta, "username", &username)) {
537
+ return false;
538
+ }
539
+ if (!detail::result_string(response.meta, "secret", &secret)) {
540
+ return false;
541
+ }
542
+ credential_out->username = username;
543
+ credential_out->secret = secret;
544
+ return true;
545
+ }
546
+
547
+ // secrets_status reports whether `lane` is configured, without returning the
548
+ // credential. It is gated by the SAME per-lane capability as secrets_get: an
549
+ // unapproved module cannot use it to probe which credentials the node holds.
550
+ //
551
+ // Use it to decide whether a fetch is worth attempting, or to surface
552
+ // "credential not configured" to the operator, without ever touching plaintext.
553
+ inline bool secrets_status(std::string_view lane, Status* status_out) {
554
+ if (!status_out || lane.empty()) {
555
+ return false;
556
+ }
557
+ sdm_hostcall::Response response;
558
+ if (!sdm_hostcall::call("secrets.status", detail::lane_request(lane), {}, &response)) {
559
+ return false;
560
+ }
561
+ Status parsed;
562
+ if (!detail::result_bool(response.meta, "configured", &parsed.configured)) {
563
+ return false;
564
+ }
565
+ if (!detail::result_optional_string(response.meta, "id", &parsed.id)) {
566
+ return false;
567
+ }
568
+ if (!detail::result_optional_string(response.meta, "username_masked", &parsed.username_masked)) {
569
+ return false;
570
+ }
571
+ if (!detail::result_optional_string(response.meta, "updated_at", &parsed.updated_at)) {
572
+ return false;
573
+ }
574
+ if (!detail::result_optional_string(response.meta, "verified_at", &parsed.verified_at)) {
575
+ return false;
576
+ }
577
+ *status_out = parsed;
578
+ return true;
579
+ }
580
+
581
+ } // namespace sdm_secrets
582
+
583
+ #endif // SDM_SECRETS_CLIENT_HPP