@voxgig/sdkgen 4.10.0 → 4.11.0

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 (304) hide show
  1. package/bin/voxgig-sdkgen +1 -1
  2. package/package.json +1 -1
  3. package/project/.sdk/model/feature/secrets.aon +330 -0
  4. package/project/.sdk/model/target/c.aon +15 -2
  5. package/project/.sdk/model/target/cpp.aon +18 -0
  6. package/project/.sdk/model/target/lua.aon +17 -0
  7. package/project/.sdk/model/target/ocaml.aon +48 -5
  8. package/project/.sdk/model/target/zig.aon +30 -4
  9. package/project/.sdk/src/cmp/c/Config_c.ts +338 -1
  10. package/project/.sdk/src/cmp/c/Main_c.ts +57 -2
  11. package/project/.sdk/src/cmp/c/Package_c.ts +12 -2
  12. package/project/.sdk/src/cmp/cpp/Config_cpp.ts +324 -2
  13. package/project/.sdk/src/cmp/cpp/Gitignore_cpp.ts +2 -0
  14. package/project/.sdk/src/cmp/cpp/Main_cpp.ts +62 -4
  15. package/project/.sdk/src/cmp/cpp/Package_cpp.ts +10 -0
  16. package/project/.sdk/src/cmp/lua/Config_lua.ts +88 -0
  17. package/project/.sdk/src/cmp/lua/Gitignore_lua.ts +4 -0
  18. package/project/.sdk/src/cmp/lua/Main_lua.ts +93 -3
  19. package/project/.sdk/src/cmp/lua/Package_lua.ts +60 -0
  20. package/project/.sdk/src/cmp/lua/fragment/Main.fragment.lua +10 -0
  21. package/project/.sdk/src/cmp/ocaml/Config_ocaml.ts +183 -5
  22. package/project/.sdk/src/cmp/ocaml/Main_ocaml.ts +160 -3
  23. package/project/.sdk/src/cmp/ocaml/Package_ocaml.ts +25 -1
  24. package/project/.sdk/src/cmp/zig/Config_zig.ts +130 -9
  25. package/project/.sdk/src/cmp/zig/Main_zig.ts +208 -4
  26. package/project/.sdk/{tm/zig/build.zig → src/cmp/zig/fragment/Build.fragment.zig} +7 -0
  27. package/project/.sdk/src/cmp/zig/fragment/Main.fragment.zig +25 -0
  28. package/project/.sdk/{tm/zig/root.zig → src/cmp/zig/fragment/Root.fragment.zig} +9 -0
  29. package/project/.sdk/tm/c/Makefile +58 -9
  30. package/project/.sdk/tm/c/core/sdk.h +10 -0
  31. package/project/.sdk/tm/c/feature/secrets/plugin/capability.c +133 -0
  32. package/project/.sdk/tm/c/feature/secrets/plugin/capability.h +39 -0
  33. package/project/.sdk/tm/c/feature/secrets/plugin/catalog.c +83 -0
  34. package/project/.sdk/tm/c/feature/secrets/plugin/catalog.h +48 -0
  35. package/project/.sdk/tm/c/feature/secrets/plugin/config.c +413 -0
  36. package/project/.sdk/tm/c/feature/secrets/plugin/config.h +24 -0
  37. package/project/.sdk/tm/c/feature/secrets/plugin/depend.c +264 -0
  38. package/project/.sdk/tm/c/feature/secrets/plugin/depend.h +29 -0
  39. package/project/.sdk/tm/c/feature/secrets/plugin/env.c +220 -0
  40. package/project/.sdk/tm/c/feature/secrets/plugin/env.h +19 -0
  41. package/project/.sdk/tm/c/feature/secrets/plugin/export.c +97 -0
  42. package/project/.sdk/tm/c/feature/secrets/plugin/export.h +19 -0
  43. package/project/.sdk/tm/c/feature/secrets/plugin/graph.c +237 -0
  44. package/project/.sdk/tm/c/feature/secrets/plugin/graph.h +17 -0
  45. package/project/.sdk/tm/c/feature/secrets/plugin/host.c +1494 -0
  46. package/project/.sdk/tm/c/feature/secrets/plugin/host.h +135 -0
  47. package/project/.sdk/tm/c/feature/secrets/plugin/order.c +288 -0
  48. package/project/.sdk/tm/c/feature/secrets/plugin/order.h +18 -0
  49. package/project/.sdk/tm/c/feature/secrets/plugin/point.c +141 -0
  50. package/project/.sdk/tm/c/feature/secrets/plugin/point.h +80 -0
  51. package/project/.sdk/tm/c/feature/secrets/plugin/ref.c +170 -0
  52. package/project/.sdk/tm/c/feature/secrets/plugin/ref.h +52 -0
  53. package/project/.sdk/tm/c/feature/secrets/plugin/resolve.c +98 -0
  54. package/project/.sdk/tm/c/feature/secrets/plugin/resolve.h +18 -0
  55. package/project/.sdk/tm/c/feature/secrets/plugin/types.c +150 -0
  56. package/project/.sdk/tm/c/feature/secrets/plugin/types.h +104 -0
  57. package/project/.sdk/tm/c/feature/secrets/plugin/value.c +649 -0
  58. package/project/.sdk/tm/c/feature/secrets/plugin/value.h +135 -0
  59. package/project/.sdk/tm/c/feature/secrets/plugin/version.c +151 -0
  60. package/project/.sdk/tm/c/feature/secrets/plugin/version.h +34 -0
  61. package/project/.sdk/tm/c/feature/secrets/plugins/aws.c +281 -0
  62. package/project/.sdk/tm/c/feature/secrets/plugins/azuresecrets.c +207 -0
  63. package/project/.sdk/tm/c/feature/secrets/plugins/boru.c +164 -0
  64. package/project/.sdk/tm/c/feature/secrets/plugins/clock.c +75 -0
  65. package/project/.sdk/tm/c/feature/secrets/plugins/doppler.c +141 -0
  66. package/project/.sdk/tm/c/feature/secrets/plugins/encode.c +144 -0
  67. package/project/.sdk/tm/c/feature/secrets/plugins/gcpsecrets.c +177 -0
  68. package/project/.sdk/tm/c/feature/secrets/plugins/hashicorp.c +239 -0
  69. package/project/.sdk/tm/c/feature/secrets/plugins/httpjson.c +599 -0
  70. package/project/.sdk/tm/c/feature/secrets/plugins/infisical.c +165 -0
  71. package/project/.sdk/tm/c/feature/secrets/plugins/onepassword.c +194 -0
  72. package/project/.sdk/tm/c/feature/secrets/plugins/proc.c +233 -0
  73. package/project/.sdk/tm/c/feature/secrets/plugins/secretspec.c +125 -0
  74. package/project/.sdk/tm/c/feature/secrets/plugins/sekretoplugins.h +125 -0
  75. package/project/.sdk/tm/c/feature/secrets/plugins/sha256.c +270 -0
  76. package/project/.sdk/tm/c/feature/secrets/plugins/sigv4.c +382 -0
  77. package/project/.sdk/tm/c/feature/secrets/plugins/support.h +153 -0
  78. package/project/.sdk/tm/c/feature/secrets/plugins/tls.c +420 -0
  79. package/project/.sdk/tm/c/feature/secrets/sekreto/internal.h +86 -0
  80. package/project/.sdk/tm/c/feature/secrets/sekreto/json.c +721 -0
  81. package/project/.sdk/tm/c/feature/secrets/sekreto/providers.c +813 -0
  82. package/project/.sdk/tm/c/feature/secrets/sekreto/sekreto.c +944 -0
  83. package/project/.sdk/tm/c/feature/secrets/sekreto/sekreto.h +490 -0
  84. package/project/.sdk/tm/c/feature/secrets/sekreto/util.c +442 -0
  85. package/project/.sdk/tm/c/feature/secrets.c +797 -0
  86. package/project/.sdk/tm/c/feature/secrets.h +46 -0
  87. package/project/.sdk/tm/c/src/feature/secrets/.gitkeep +0 -0
  88. package/project/.sdk/tm/c/tests/feature/secrets/secrets_test.c +802 -0
  89. package/project/.sdk/tm/clojure/feature/secrets/sdk/feature/secrets.clj +38 -11
  90. package/project/.sdk/tm/clojure/test/sdk/test/feature/secrets.clj +40 -6
  91. package/project/.sdk/tm/cpp/Makefile +48 -4
  92. package/project/.sdk/tm/cpp/feature/secrets/plugin/capability.cpp +121 -0
  93. package/project/.sdk/tm/cpp/feature/secrets/plugin/capability.hpp +41 -0
  94. package/project/.sdk/tm/cpp/feature/secrets/plugin/catalog.cpp +60 -0
  95. package/project/.sdk/tm/cpp/feature/secrets/plugin/catalog.hpp +66 -0
  96. package/project/.sdk/tm/cpp/feature/secrets/plugin/config.cpp +376 -0
  97. package/project/.sdk/tm/cpp/feature/secrets/plugin/config.hpp +29 -0
  98. package/project/.sdk/tm/cpp/feature/secrets/plugin/depend.cpp +230 -0
  99. package/project/.sdk/tm/cpp/feature/secrets/plugin/depend.hpp +31 -0
  100. package/project/.sdk/tm/cpp/feature/secrets/plugin/env.cpp +205 -0
  101. package/project/.sdk/tm/cpp/feature/secrets/plugin/env.hpp +25 -0
  102. package/project/.sdk/tm/cpp/feature/secrets/plugin/export.cpp +84 -0
  103. package/project/.sdk/tm/cpp/feature/secrets/plugin/export.hpp +24 -0
  104. package/project/.sdk/tm/cpp/feature/secrets/plugin/graph.cpp +222 -0
  105. package/project/.sdk/tm/cpp/feature/secrets/plugin/graph.hpp +21 -0
  106. package/project/.sdk/tm/cpp/feature/secrets/plugin/host.cpp +1200 -0
  107. package/project/.sdk/tm/cpp/feature/secrets/plugin/host.hpp +250 -0
  108. package/project/.sdk/tm/cpp/feature/secrets/plugin/order.cpp +250 -0
  109. package/project/.sdk/tm/cpp/feature/secrets/plugin/order.hpp +22 -0
  110. package/project/.sdk/tm/cpp/feature/secrets/plugin/point.cpp +110 -0
  111. package/project/.sdk/tm/cpp/feature/secrets/plugin/point.hpp +79 -0
  112. package/project/.sdk/tm/cpp/feature/secrets/plugin/ref.cpp +136 -0
  113. package/project/.sdk/tm/cpp/feature/secrets/plugin/ref.hpp +60 -0
  114. package/project/.sdk/tm/cpp/feature/secrets/plugin/resolve.cpp +82 -0
  115. package/project/.sdk/tm/cpp/feature/secrets/plugin/resolve.hpp +25 -0
  116. package/project/.sdk/tm/cpp/feature/secrets/plugin/types.cpp +90 -0
  117. package/project/.sdk/tm/cpp/feature/secrets/plugin/types.hpp +65 -0
  118. package/project/.sdk/tm/cpp/feature/secrets/plugin/value.cpp +491 -0
  119. package/project/.sdk/tm/cpp/feature/secrets/plugin/value.hpp +120 -0
  120. package/project/.sdk/tm/cpp/feature/secrets/plugin/version.cpp +143 -0
  121. package/project/.sdk/tm/cpp/feature/secrets/plugin/version.hpp +36 -0
  122. package/project/.sdk/tm/cpp/feature/secrets/plugins/Aws.cpp +248 -0
  123. package/project/.sdk/tm/cpp/feature/secrets/plugins/Aws.hpp +30 -0
  124. package/project/.sdk/tm/cpp/feature/secrets/plugins/Azuresecrets.cpp +149 -0
  125. package/project/.sdk/tm/cpp/feature/secrets/plugins/Azuresecrets.hpp +23 -0
  126. package/project/.sdk/tm/cpp/feature/secrets/plugins/Boru.cpp +117 -0
  127. package/project/.sdk/tm/cpp/feature/secrets/plugins/Boru.hpp +27 -0
  128. package/project/.sdk/tm/cpp/feature/secrets/plugins/Crypto.cpp +180 -0
  129. package/project/.sdk/tm/cpp/feature/secrets/plugins/Crypto.hpp +52 -0
  130. package/project/.sdk/tm/cpp/feature/secrets/plugins/Doppler.cpp +87 -0
  131. package/project/.sdk/tm/cpp/feature/secrets/plugins/Doppler.hpp +23 -0
  132. package/project/.sdk/tm/cpp/feature/secrets/plugins/Gcpsecrets.cpp +121 -0
  133. package/project/.sdk/tm/cpp/feature/secrets/plugins/Gcpsecrets.hpp +23 -0
  134. package/project/.sdk/tm/cpp/feature/secrets/plugins/Hashicorp.cpp +153 -0
  135. package/project/.sdk/tm/cpp/feature/secrets/plugins/Hashicorp.hpp +23 -0
  136. package/project/.sdk/tm/cpp/feature/secrets/plugins/Httpjson.cpp +666 -0
  137. package/project/.sdk/tm/cpp/feature/secrets/plugins/Httpjson.hpp +160 -0
  138. package/project/.sdk/tm/cpp/feature/secrets/plugins/Infisical.cpp +123 -0
  139. package/project/.sdk/tm/cpp/feature/secrets/plugins/Infisical.hpp +23 -0
  140. package/project/.sdk/tm/cpp/feature/secrets/plugins/Onepassword.cpp +125 -0
  141. package/project/.sdk/tm/cpp/feature/secrets/plugins/Onepassword.hpp +23 -0
  142. package/project/.sdk/tm/cpp/feature/secrets/plugins/Proc.cpp +223 -0
  143. package/project/.sdk/tm/cpp/feature/secrets/plugins/Proc.hpp +47 -0
  144. package/project/.sdk/tm/cpp/feature/secrets/plugins/Secretspec.cpp +104 -0
  145. package/project/.sdk/tm/cpp/feature/secrets/plugins/Secretspec.hpp +27 -0
  146. package/project/.sdk/tm/cpp/feature/secrets/plugins/Sigv4.cpp +242 -0
  147. package/project/.sdk/tm/cpp/feature/secrets/plugins/Sigv4.hpp +58 -0
  148. package/project/.sdk/tm/cpp/feature/secrets/plugins/Tls.cpp +260 -0
  149. package/project/.sdk/tm/cpp/feature/secrets/plugins/Tls.hpp +47 -0
  150. package/project/.sdk/tm/cpp/feature/secrets/sekreto/Json.cpp +476 -0
  151. package/project/.sdk/tm/cpp/feature/secrets/sekreto/Json.hpp +89 -0
  152. package/project/.sdk/tm/cpp/feature/secrets/sekreto/Provider.cpp +312 -0
  153. package/project/.sdk/tm/cpp/feature/secrets/sekreto/Provider.hpp +263 -0
  154. package/project/.sdk/tm/cpp/feature/secrets/sekreto/Providers.cpp +354 -0
  155. package/project/.sdk/tm/cpp/feature/secrets/sekreto/Providers.hpp +111 -0
  156. package/project/.sdk/tm/cpp/feature/secrets/sekreto/Sekreto.cpp +613 -0
  157. package/project/.sdk/tm/cpp/feature/secrets/sekreto/Sekreto.hpp +227 -0
  158. package/project/.sdk/tm/cpp/feature/secrets.hpp +745 -0
  159. package/project/.sdk/tm/cpp/src/feature/secrets/.gitkeep +0 -0
  160. package/project/.sdk/tm/cpp/test/feature/secrets/secrets_test.cpp +808 -0
  161. package/project/.sdk/tm/csharp/feature/SecretsFeature.cs +34 -8
  162. package/project/.sdk/tm/csharp/test/feature/secrets/SecretsFeatureTest.cs +85 -0
  163. package/project/.sdk/tm/elixir/lib/projectname/feature/secrets.ex +17 -2
  164. package/project/.sdk/tm/elixir/test/feature/secrets/secrets_test.exs +41 -0
  165. package/project/.sdk/tm/go/feature/secrets_feature.go +32 -10
  166. package/project/.sdk/tm/go/test/feature/secrets/secrets_feature_test.go +116 -0
  167. package/project/.sdk/tm/java/feature/SecretsFeature.java +33 -8
  168. package/project/.sdk/tm/java/test/feature/secrets/SecretsFeatureTest.java +64 -0
  169. package/project/.sdk/tm/js/src/feature/secrets/SecretsFeature.js +34 -11
  170. package/project/.sdk/tm/js/test/feature/secrets/Secrets.test.js +73 -0
  171. package/project/.sdk/tm/kotlin/feature/SecretsFeature.kt +32 -7
  172. package/project/.sdk/tm/kotlin/test/feature/secrets/SecretsTest.kt +69 -0
  173. package/project/.sdk/tm/lua/Makefile +15 -4
  174. package/project/.sdk/tm/lua/feature/secrets/native/sekretonet.c +806 -0
  175. package/project/.sdk/tm/lua/feature/secrets/plugin/capability.lua +135 -0
  176. package/project/.sdk/tm/lua/feature/secrets/plugin/catalog.lua +63 -0
  177. package/project/.sdk/tm/lua/feature/secrets/plugin/config.lua +361 -0
  178. package/project/.sdk/tm/lua/feature/secrets/plugin/depend.lua +232 -0
  179. package/project/.sdk/tm/lua/feature/secrets/plugin/env.lua +168 -0
  180. package/project/.sdk/tm/lua/feature/secrets/plugin/export.lua +66 -0
  181. package/project/.sdk/tm/lua/feature/secrets/plugin/graph.lua +194 -0
  182. package/project/.sdk/tm/lua/feature/secrets/plugin/host.lua +1190 -0
  183. package/project/.sdk/tm/lua/feature/secrets/plugin/json.lua +169 -0
  184. package/project/.sdk/tm/lua/feature/secrets/plugin/order.lua +207 -0
  185. package/project/.sdk/tm/lua/feature/secrets/plugin/point.lua +106 -0
  186. package/project/.sdk/tm/lua/feature/secrets/plugin/ref.lua +115 -0
  187. package/project/.sdk/tm/lua/feature/secrets/plugin/resolve.lua +78 -0
  188. package/project/.sdk/tm/lua/feature/secrets/plugin/types.lua +275 -0
  189. package/project/.sdk/tm/lua/feature/secrets/plugin/version.lua +131 -0
  190. package/project/.sdk/tm/lua/feature/secrets/plugin.lua +76 -0
  191. package/project/.sdk/tm/lua/feature/secrets/sekreto/addr.lua +124 -0
  192. package/project/.sdk/tm/lua/feature/secrets/sekreto/err.lua +47 -0
  193. package/project/.sdk/tm/lua/feature/secrets/sekreto/name.lua +315 -0
  194. package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/aws.lua +228 -0
  195. package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/azuresecrets.lua +137 -0
  196. package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/boru.lua +124 -0
  197. package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/crypto.lua +212 -0
  198. package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/doppler.lua +89 -0
  199. package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/gcpsecrets.lua +129 -0
  200. package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/hashicorp.lua +154 -0
  201. package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/httpjson.lua +248 -0
  202. package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/infisical.lua +113 -0
  203. package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/json.lua +449 -0
  204. package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/net.lua +198 -0
  205. package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/onepassword.lua +126 -0
  206. package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/secretspec.lua +93 -0
  207. package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/sigv4.lua +269 -0
  208. package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/support.lua +146 -0
  209. package/project/.sdk/tm/lua/feature/secrets/sekreto/providers.lua +346 -0
  210. package/project/.sdk/tm/lua/feature/secrets/sekreto.lua +479 -0
  211. package/project/.sdk/tm/lua/feature/secrets_feature.lua +690 -0
  212. package/project/.sdk/tm/lua/src/feature/secrets/.gitkeep +0 -0
  213. package/project/.sdk/tm/lua/test/extend_test.lua +105 -0
  214. package/project/.sdk/tm/lua/test/feature/secrets/secrets_feature_test.lua +862 -0
  215. package/project/.sdk/tm/ocaml/Makefile +52 -8
  216. package/project/.sdk/tm/ocaml/feature/secrets/plugin/capability.ml +106 -0
  217. package/project/.sdk/tm/ocaml/feature/secrets/plugin/catalog.ml +43 -0
  218. package/project/.sdk/tm/ocaml/feature/secrets/plugin/config.ml +349 -0
  219. package/project/.sdk/tm/ocaml/feature/secrets/plugin/defs.ml +143 -0
  220. package/project/.sdk/tm/ocaml/feature/secrets/plugin/depend.ml +217 -0
  221. package/project/.sdk/tm/ocaml/feature/secrets/plugin/env.ml +197 -0
  222. package/project/.sdk/tm/ocaml/feature/secrets/plugin/export.ml +89 -0
  223. package/project/.sdk/tm/ocaml/feature/secrets/plugin/graph.ml +227 -0
  224. package/project/.sdk/tm/ocaml/feature/secrets/plugin/host.ml +1112 -0
  225. package/project/.sdk/tm/ocaml/feature/secrets/plugin/order.ml +202 -0
  226. package/project/.sdk/tm/ocaml/feature/secrets/plugin/point.ml +138 -0
  227. package/project/.sdk/tm/ocaml/feature/secrets/plugin/ref.ml +126 -0
  228. package/project/.sdk/tm/ocaml/feature/secrets/plugin/resolve.ml +62 -0
  229. package/project/.sdk/tm/ocaml/feature/secrets/plugin/types.ml +97 -0
  230. package/project/.sdk/tm/ocaml/feature/secrets/plugin/value.ml +387 -0
  231. package/project/.sdk/tm/ocaml/feature/secrets/plugin/version.ml +139 -0
  232. package/project/.sdk/tm/ocaml/feature/secrets/plugins/aws.ml +171 -0
  233. package/project/.sdk/tm/ocaml/feature/secrets/plugins/azuresecrets.ml +116 -0
  234. package/project/.sdk/tm/ocaml/feature/secrets/plugins/boru.ml +95 -0
  235. package/project/.sdk/tm/ocaml/feature/secrets/plugins/crypto.ml +149 -0
  236. package/project/.sdk/tm/ocaml/feature/secrets/plugins/doppler.ml +61 -0
  237. package/project/.sdk/tm/ocaml/feature/secrets/plugins/gcpsecrets.ml +93 -0
  238. package/project/.sdk/tm/ocaml/feature/secrets/plugins/hashicorp.ml +120 -0
  239. package/project/.sdk/tm/ocaml/feature/secrets/plugins/http.ml +421 -0
  240. package/project/.sdk/tm/ocaml/feature/secrets/plugins/httpjson.ml +66 -0
  241. package/project/.sdk/tm/ocaml/feature/secrets/plugins/infisical.ml +85 -0
  242. package/project/.sdk/tm/ocaml/feature/secrets/plugins/onepassword.ml +112 -0
  243. package/project/.sdk/tm/ocaml/feature/secrets/plugins/runcmd.ml +97 -0
  244. package/project/.sdk/tm/ocaml/feature/secrets/plugins/secretspec.ml +68 -0
  245. package/project/.sdk/tm/ocaml/feature/secrets/plugins/sigv4.ml +259 -0
  246. package/project/.sdk/tm/ocaml/feature/secrets/plugins/tls.ml +44 -0
  247. package/project/.sdk/tm/ocaml/feature/secrets/plugins/tls_stubs.c +358 -0
  248. package/project/.sdk/tm/ocaml/feature/secrets/sekreto/json.ml +376 -0
  249. package/project/.sdk/tm/ocaml/feature/secrets/sekreto/provider.ml +647 -0
  250. package/project/.sdk/tm/ocaml/feature/secrets/sekreto/secret.ml +299 -0
  251. package/project/.sdk/tm/ocaml/feature/secrets/sekreto/sekreto.ml +347 -0
  252. package/project/.sdk/tm/ocaml/feature/secrets_feature.ml +453 -0
  253. package/project/.sdk/tm/ocaml/src/feature/secrets/.gitkeep +0 -0
  254. package/project/.sdk/tm/ocaml/test/feature/secrets/t_secrets.ml +670 -0
  255. package/project/.sdk/tm/perl/feature/secrets_feature.pm +33 -12
  256. package/project/.sdk/tm/perl/t/feature/secrets/secrets.t +47 -0
  257. package/project/.sdk/tm/php/feature/SecretsFeature.php +30 -6
  258. package/project/.sdk/tm/php/test/feature/secrets/SecretsTest.php +98 -0
  259. package/project/.sdk/tm/py/pkg/feature/secrets_feature.py +28 -6
  260. package/project/.sdk/tm/py/test/feature/secrets/test_secrets.py +114 -0
  261. package/project/.sdk/tm/rb/feature/secrets_feature.rb +28 -6
  262. package/project/.sdk/tm/rb/test/feature/secrets/secrets_feature_test.rb +93 -0
  263. package/project/.sdk/tm/rust/feature/secrets.rs +33 -10
  264. package/project/.sdk/tm/rust/tests/feature/secrets/main.rs +96 -0
  265. package/project/.sdk/tm/scala/feature/SecretsFeature.scala +29 -7
  266. package/project/.sdk/tm/scala/sdktest/feature/secrets/SecretsTestMain.scala +71 -0
  267. package/project/.sdk/tm/ts/src/feature/secrets/SecretsFeature.ts +35 -12
  268. package/project/.sdk/tm/ts/test/feature/secrets/Secrets.test.ts +73 -0
  269. package/project/.sdk/tm/zig/feature/secrets/plugin/capability.zig +137 -0
  270. package/project/.sdk/tm/zig/feature/secrets/plugin/catalog.zig +90 -0
  271. package/project/.sdk/tm/zig/feature/secrets/plugin/config.zig +346 -0
  272. package/project/.sdk/tm/zig/feature/secrets/plugin/depend.zig +244 -0
  273. package/project/.sdk/tm/zig/feature/secrets/plugin/env.zig +201 -0
  274. package/project/.sdk/tm/zig/feature/secrets/plugin/export.zig +83 -0
  275. package/project/.sdk/tm/zig/feature/secrets/plugin/graph.zig +212 -0
  276. package/project/.sdk/tm/zig/feature/secrets/plugin/host.zig +1224 -0
  277. package/project/.sdk/tm/zig/feature/secrets/plugin/inst.zig +126 -0
  278. package/project/.sdk/tm/zig/feature/secrets/plugin/order.zig +228 -0
  279. package/project/.sdk/tm/zig/feature/secrets/plugin/plugin.zig +34 -0
  280. package/project/.sdk/tm/zig/feature/secrets/plugin/point.zig +166 -0
  281. package/project/.sdk/tm/zig/feature/secrets/plugin/ref.zig +147 -0
  282. package/project/.sdk/tm/zig/feature/secrets/plugin/resolve.zig +74 -0
  283. package/project/.sdk/tm/zig/feature/secrets/plugin/types.zig +140 -0
  284. package/project/.sdk/tm/zig/feature/secrets/plugin/value.zig +662 -0
  285. package/project/.sdk/tm/zig/feature/secrets/plugin/version.zig +139 -0
  286. package/project/.sdk/tm/zig/feature/secrets/plugins/aws.zig +294 -0
  287. package/project/.sdk/tm/zig/feature/secrets/plugins/azuresecrets.zig +222 -0
  288. package/project/.sdk/tm/zig/feature/secrets/plugins/boru.zig +188 -0
  289. package/project/.sdk/tm/zig/feature/secrets/plugins/doppler.zig +135 -0
  290. package/project/.sdk/tm/zig/feature/secrets/plugins/gcpsecrets.zig +170 -0
  291. package/project/.sdk/tm/zig/feature/secrets/plugins/hashicorp.zig +242 -0
  292. package/project/.sdk/tm/zig/feature/secrets/plugins/httpjson.zig +535 -0
  293. package/project/.sdk/tm/zig/feature/secrets/plugins/infisical.zig +167 -0
  294. package/project/.sdk/tm/zig/feature/secrets/plugins/onepassword.zig +202 -0
  295. package/project/.sdk/tm/zig/feature/secrets/plugins/secretspec.zig +160 -0
  296. package/project/.sdk/tm/zig/feature/secrets/plugins/sigv4.zig +336 -0
  297. package/project/.sdk/tm/zig/feature/secrets/sekreto/addr.zig +148 -0
  298. package/project/.sdk/tm/zig/feature/secrets/sekreto/builtins.zig +259 -0
  299. package/project/.sdk/tm/zig/feature/secrets/sekreto/provider.zig +440 -0
  300. package/project/.sdk/tm/zig/feature/secrets/sekreto/sekreto.zig +944 -0
  301. package/project/.sdk/tm/zig/feature/secrets.zig +854 -0
  302. package/project/.sdk/tm/zig/src/feature/secrets/.gitkeep +0 -0
  303. package/project/.sdk/tm/zig/test/feature/secrets/secrets_test.zig +891 -0
  304. package/project/sdkgen-package.json +1 -1
@@ -0,0 +1,813 @@
1
+ // VENDORED: @voxgig/sekreto sdk-20260908-1556-0 (c/src/providers.c)
2
+ // Source: https://github.com/voxgig/sekreto @ 1267ee2e5f49566bc92695bc9eb3a60ef4924998 [tag: sdk-20260908-1556-0]
3
+ // License: MIT (c) voxgig - see repository LICENSE. Do not edit: resync from upstream.
4
+ /* What a provider is, what its declarative form looks like, how a provider
5
+ * kind becomes a voxgig/plugin definition - and the four BUILT-IN kinds.
6
+ *
7
+ * A provider answers one question: "do you have this secret?" It returns
8
+ * the value, or a miss to mean "ask the next one". Nothing else about a
9
+ * provider is visible to the caller - which is the point: an app reads
10
+ * `api.token` and never learns whether it came from the environment, a
11
+ * .env file, HashiCorp Vault, AWS, GCP, Azure or a boru vault.
12
+ *
13
+ * TWO FAILURE SHAPES, AND THEY ARE NEVER INTERCHANGEABLE. A store that
14
+ * does not hold the secret is a MISS (`*out = NULL`, no error) and the
15
+ * chain carries on. A store that could not answer - bad credentials,
16
+ * unreachable host, missing configuration - is an ERROR: falling through
17
+ * there would quietly reach for a weaker store.
18
+ *
19
+ * THIS FILE NAMES NO SOCKET, NO CHILD PROCESS AND NO HASH FUNCTION. What
20
+ * makes a kind built in is that it needs nothing of the platform beyond
21
+ * the environment and reading a local file; every kind that opens a
22
+ * socket, signs a request or spawns a process is a plugin under
23
+ * `plugins/`, in its own translation unit, linked only by a binary whose
24
+ * link line names it (docs/design/plugin-providers.md).
25
+ *
26
+ * A port of typescript/src/provider/support.ts and
27
+ * typescript/src/provider/builtin.ts, which are canonical.
28
+ */
29
+
30
+ #define _POSIX_C_SOURCE 200809L
31
+
32
+ #include <stddef.h>
33
+ #include <stdio.h>
34
+ #include <stdlib.h>
35
+ #include <string.h>
36
+
37
+ #include "internal.h"
38
+
39
+ /* ---- spec ---------------------------------------------------------- */
40
+
41
+ sek_spec sek_spec_new(const char *kind) {
42
+ sek_spec spec;
43
+
44
+ memset(&spec, 0, sizeof(spec));
45
+ spec.kind = kind;
46
+
47
+ return spec;
48
+ }
49
+
50
+ /* What a credential field reports about itself: whether it is set, never
51
+ * what it is. */
52
+ static const char *setornot(const char *value) { return sek_empty(value) ? "[unset]" : "[set]"; }
53
+
54
+ char *sek_authspec_show(sek_pool *pool, const sek_authspec *auth) {
55
+ if (NULL == auth) {
56
+ return sek_strdup(pool, "(none)");
57
+ }
58
+
59
+ return sek_fmt(pool,
60
+ "AuthSpec(method=%s, mount=%s, role=%s, jwtfile=%s, roleid=%s, jwt=%s, "
61
+ "secretid=%s)",
62
+ sek_orempty(auth->method), sek_orempty(auth->mount), sek_orempty(auth->role),
63
+ sek_orempty(auth->jwtfile), sek_orempty(auth->roleid), setornot(auth->jwt),
64
+ setornot(auth->secretid));
65
+ }
66
+
67
+ /* Printed without its credentials. The obvious debug print of a chain
68
+ * that will not build - which is exactly what someone writes when a chain
69
+ * will not build - would otherwise put the Vault token, the AWS secret
70
+ * access key and the Azure client secret wherever it was printed. */
71
+ char *sek_spec_show(sek_pool *pool, const sek_spec *spec) {
72
+ return sek_fmt(pool,
73
+ "ProviderSpec(kind=%s, name=%s, addr=%s, token=%s, secret=%s, clientsecret=%s, "
74
+ "auth=%s)",
75
+ sek_orempty(spec->kind), sek_orempty(spec->name), sek_orempty(spec->addr),
76
+ setornot(spec->token), setornot(spec->secret), setornot(spec->clientsecret),
77
+ sek_authspec_show(pool, spec->auth));
78
+ }
79
+
80
+ /* ---- addresses ----------------------------------------------------- */
81
+
82
+ /* Every refusal below names the address it refused, and one of them fires
83
+ * precisely because the address carries a credential - so printing it
84
+ * verbatim would write that password to stderr and into the logs. It
85
+ * cannot be cleaned up afterwards either: that password was never
86
+ * resolved as a secret, so redact() has never seen it and never will. */
87
+ char *sek_safeaddr(sek_pool *pool, const char *addr) {
88
+ const char *mark = strstr(addr, "://");
89
+ const char *rest;
90
+ const char *stop;
91
+ char *authority;
92
+ const char *at;
93
+ size_t head;
94
+
95
+ if (NULL == mark) {
96
+ return sek_strdup(pool, addr);
97
+ }
98
+
99
+ rest = mark + 3;
100
+ stop = rest;
101
+ while ('\0' != *stop && '/' != *stop && '?' != *stop && '#' != *stop) {
102
+ stop++;
103
+ }
104
+
105
+ authority = sek_strndup(pool, rest, (size_t)(stop - rest));
106
+ at = strrchr(authority, '@');
107
+
108
+ if (NULL == at) {
109
+ return sek_strdup(pool, addr);
110
+ }
111
+
112
+ head = (size_t)(rest - addr);
113
+
114
+ return sek_fmt(pool, "%.*s[redacted]%s", (int)head, addr, rest + (size_t)(at - authority));
115
+ }
116
+
117
+ /* Refuse to send a secret-bearing credential in the clear.
118
+ *
119
+ * A vault API is HTTPS in any real deployment; plaintext is a dev-mode
120
+ * convenience. Sending a token over http to anything but the local
121
+ * machine puts both the token and the secret it fetches on the wire for
122
+ * anyone on the path, so sekreto will not do it. Loopback stays allowed:
123
+ * that is `vault server -dev`, `boru vault serve` and this repository's
124
+ * own test harness.
125
+ *
126
+ * The address is read BY HAND, in the same handful of steps in every
127
+ * port, rather than by a platform URL parser. Twelve parsers disagree
128
+ * about malformed input - where userinfo ends, whether `0177.0.0.1` is
129
+ * loopback, what an unclosed bracket means - and a check that answers
130
+ * differently in different ports is not a check.
131
+ *
132
+ * The rule this parse obeys, and the reason it can be trusted: it is
133
+ * never MORE PERMISSIVE than the HTTP client that will dial the address.
134
+ * It ends the authority at `/`, `?` or `#` only, so a client that also
135
+ * breaks on `\` can only ever see a SHORTER host than this does. It
136
+ * refuses userinfo outright rather than locating its end. It compares the
137
+ * host literally, so a numeric form no parser agrees on is refused rather
138
+ * than guessed at. */
139
+ sek_err sek_checkaddr(sek_pool *pool, const char *addr) {
140
+ const char *rest;
141
+ const char *stop;
142
+ char *authority;
143
+ char *host;
144
+ int tls;
145
+
146
+ if (NULL == addr) {
147
+ addr = "";
148
+ }
149
+
150
+ /* A literal, case-sensitive prefix. `HTTP://localhost` is refused. */
151
+ if (sek_has_prefix(addr, "https://")) {
152
+ rest = addr + 8;
153
+ tls = 1;
154
+ } else if (sek_has_prefix(addr, "http://")) {
155
+ rest = addr + 7;
156
+ tls = 0;
157
+ } else {
158
+ return sek_fmt(pool, "sekreto: not an http(s) address: %s", sek_safeaddr(pool, addr));
159
+ }
160
+
161
+ stop = rest;
162
+ while ('\0' != *stop && '/' != *stop && '?' != *stop && '#' != *stop) {
163
+ stop++;
164
+ }
165
+ authority = sek_strndup(pool, rest, (size_t)(stop - rest));
166
+
167
+ /* Userinfo is refused outright rather than parsed around, and on https
168
+ * as well as http. No store this library speaks authenticates by
169
+ * userinfo - they take a token or a signature - so an address carrying
170
+ * one is a mistake at best. At worst it is the attack this whole
171
+ * function exists to stop: `http://localhost:8200@evil.example.com/` is
172
+ * a request to evil.example.com that reads, to anything splitting the
173
+ * authority on ':', as loopback. */
174
+ if (NULL != strchr(authority, '@')) {
175
+ return sek_fmt(pool, "sekreto: refusing an address with embedded credentials: %s",
176
+ sek_safeaddr(pool, addr));
177
+ }
178
+
179
+ /* An opening bracket with no closing one is not an address at all. */
180
+ if ('[' == authority[0] && NULL == strchr(authority, ']')) {
181
+ return sek_fmt(pool, "sekreto: not a valid http(s) address: %s", sek_safeaddr(pool, addr));
182
+ }
183
+
184
+ if (tls) {
185
+ return NULL;
186
+ }
187
+
188
+ /* A bracketed IPv6 literal keeps its brackets. Splitting the authority
189
+ * on the first colon yields `[`, so `http://[::1]:8200` could never
190
+ * match the allowlist below - which refuses a legitimate local vault. */
191
+ if ('[' == authority[0]) {
192
+ const char *close = strchr(authority, ']');
193
+ host = sek_strndup(pool, authority, (size_t)(close - authority) + 1);
194
+ } else {
195
+ const char *colon = strchr(authority, ':');
196
+ host = NULL == colon ? sek_strdup(pool, authority)
197
+ : sek_strndup(pool, authority, (size_t)(colon - authority));
198
+ }
199
+ host = sek_lowercase(pool, host);
200
+
201
+ /* Literal, and exactly four entries. Nothing is normalised:
202
+ * `0177.0.0.1`, `2130706433`, `127.0.0.2` and `[::ffff:127.0.0.1]` are
203
+ * all refused, because no two URL parsers agree on what they mean. */
204
+ if (0 == strcmp(host, "localhost") || 0 == strcmp(host, "127.0.0.1") ||
205
+ 0 == strcmp(host, "::1") || 0 == strcmp(host, "[::1]")) {
206
+ return NULL;
207
+ }
208
+
209
+ return sek_fmt(pool, "sekreto: refusing to send a token in plaintext to %s (use https)",
210
+ sek_safeaddr(pool, addr));
211
+ }
212
+
213
+ /* ---- the four built-in kinds --------------------------------------- */
214
+
215
+ /* `env`, `memory`, `dotenv` and `file`: the floor every chain stands on.
216
+ * A chain of these works with no plugin loaded at all, which is the
217
+ * property the whole split exists to give a consumer.
218
+ *
219
+ * Each is the same shape as a plugin - a lookup, a describe, and a `make`
220
+ * that a voxgig/plugin definition calls - so there is one mechanism here
221
+ * and not two. */
222
+
223
+ /* ---- env ----------------------------------------------------------- */
224
+
225
+ typedef struct {
226
+ sek_pool *pool;
227
+ const char *prefix;
228
+ char *described;
229
+ } envdata;
230
+
231
+ static sek_err env_lookup(sek_provider *self, const char *name, char **out) {
232
+ envdata *data = (envdata *)self->data;
233
+ char *key = NULL;
234
+ sek_err err = sek_envkey(data->pool, name, data->prefix, &key);
235
+ const char *found;
236
+
237
+ *out = NULL;
238
+
239
+ if (NULL != err) {
240
+ return err;
241
+ }
242
+
243
+ found = getenv(key);
244
+ if (NULL != found) {
245
+ *out = sek_strdup(data->pool, found);
246
+ }
247
+
248
+ return NULL;
249
+ }
250
+
251
+ static const char *env_describe(sek_provider *self) {
252
+ return ((envdata *)self->data)->described;
253
+ }
254
+
255
+ /* ---- memory -------------------------------------------------------- */
256
+
257
+ typedef struct {
258
+ sek_pool *pool;
259
+ sek_map *values;
260
+ const char *prefix;
261
+ char *described;
262
+ } memorydata;
263
+
264
+ static sek_err memory_lookup(sek_provider *self, const char *name, char **out) {
265
+ memorydata *data = (memorydata *)self->data;
266
+ char *key = NULL;
267
+ sek_err err = sek_envkey(data->pool, name, data->prefix, &key);
268
+ const char *found;
269
+
270
+ *out = NULL;
271
+
272
+ if (NULL != err) {
273
+ return err;
274
+ }
275
+
276
+ /* An absent key is a miss and the empty string is a HIT, so this asks
277
+ * the map rather than reading a value and testing it for emptiness. */
278
+ found = sek_map_get(data->values, key);
279
+ if (NULL != found) {
280
+ *out = sek_strdup(data->pool, found);
281
+ }
282
+
283
+ return NULL;
284
+ }
285
+
286
+ static const char *memory_describe(sek_provider *self) {
287
+ return ((memorydata *)self->data)->described;
288
+ }
289
+
290
+ /* ---- dotenv -------------------------------------------------------- */
291
+
292
+ typedef struct {
293
+ sek_pool *pool;
294
+ const char *file;
295
+ const char *prefix;
296
+ sek_map *values; /* NULL until the first lookup */
297
+ char *described;
298
+ } dotenvdata;
299
+
300
+ /* Read once, LAZILY, and memoised. Lazily because the `stores` corpus
301
+ * group puts a dotenv provider in a chain and never looks anything up: an
302
+ * eager constructor would read whatever .env happened to sit in the
303
+ * test's working directory. */
304
+ static sek_err dotenv_load(dotenvdata *data) {
305
+ char *text;
306
+ int why = 0;
307
+
308
+ if (NULL != data->values) {
309
+ return NULL;
310
+ }
311
+
312
+ text = sek_readfile(data->pool, data->file, &why);
313
+
314
+ if (NULL == text) {
315
+ if (sek_absent(why)) {
316
+ /* No file, or no directory: "no secrets here", not a failure. */
317
+ data->values = sek_map_new(data->pool);
318
+ return NULL;
319
+ }
320
+ return sek_fmt(data->pool, "sekreto: dotenv provider cannot read %s: %s", data->file,
321
+ strerror(why));
322
+ }
323
+
324
+ data->values = sek_parsedotenv(data->pool, text);
325
+
326
+ return NULL;
327
+ }
328
+
329
+ static sek_err dotenv_lookup(sek_provider *self, const char *name, char **out) {
330
+ dotenvdata *data = (dotenvdata *)self->data;
331
+ char *key = NULL;
332
+ sek_err err;
333
+ const char *found;
334
+
335
+ *out = NULL;
336
+
337
+ err = sek_envkey(data->pool, name, data->prefix, &key);
338
+ if (NULL != err) {
339
+ return err;
340
+ }
341
+
342
+ err = dotenv_load(data);
343
+ if (NULL != err) {
344
+ return err;
345
+ }
346
+
347
+ found = sek_map_get(data->values, key);
348
+ if (NULL != found) {
349
+ *out = sek_strdup(data->pool, found);
350
+ }
351
+
352
+ return NULL;
353
+ }
354
+
355
+ static const char *dotenv_describe(sek_provider *self) {
356
+ return ((dotenvdata *)self->data)->described;
357
+ }
358
+
359
+ /* ---- file ---------------------------------------------------------- */
360
+
361
+ typedef struct {
362
+ sek_pool *pool;
363
+ const char *dir;
364
+ const char *prefix;
365
+ char *described;
366
+ } filedata;
367
+
368
+ /* One secret per file, keyed like the environment: `api.token` reads
369
+ * `<dir>/API_TOKEN`. This is the shape of a mounted Kubernetes Secret, a
370
+ * Docker or Swarm secret, and a systemd credentials directory, so those
371
+ * all work with no further configuration. Read on EVERY lookup, with no
372
+ * caching: a rotated secret is a rewritten file. */
373
+ static sek_err file_lookup(sek_provider *self, const char *name, char **out) {
374
+ filedata *data = (filedata *)self->data;
375
+ char *key = NULL;
376
+ sek_err err = sek_envkey(data->pool, name, data->prefix, &key);
377
+ char *path;
378
+ char *text;
379
+ size_t len;
380
+ int why = 0;
381
+
382
+ *out = NULL;
383
+
384
+ if (NULL != err) {
385
+ return err;
386
+ }
387
+
388
+ path = sek_empty(data->dir) ? key : sek_fmt(data->pool, "%s/%s", data->dir, key);
389
+
390
+ text = sek_readfile(data->pool, path, &why);
391
+
392
+ if (NULL == text) {
393
+ if (sek_absent(why)) {
394
+ return NULL;
395
+ }
396
+ /* The JOINED path, not the directory: that is what could not be
397
+ * read. */
398
+ return sek_fmt(data->pool, "sekreto: file provider cannot read %s: %s", path, strerror(why));
399
+ }
400
+
401
+ /* Exactly one trailing newline, `\r\n` before `\n`, and only at the
402
+ * end. Tools that write these files disagree about it, and a newline is
403
+ * never part of a secret on purpose - one left on turns a bearer header
404
+ * into a malformed one. */
405
+ len = strlen(text);
406
+ if (2 <= len && '\r' == text[len - 2] && '\n' == text[len - 1]) {
407
+ text = sek_strndup(data->pool, text, len - 2);
408
+ } else if (1 <= len && '\n' == text[len - 1]) {
409
+ text = sek_strndup(data->pool, text, len - 1);
410
+ }
411
+
412
+ *out = text;
413
+
414
+ return NULL;
415
+ }
416
+
417
+ static const char *file_describe(sek_provider *self) {
418
+ return ((filedata *)self->data)->described;
419
+ }
420
+
421
+
422
+ /* ---- a spec, as a plugin instance's options ------------------------ */
423
+
424
+ /* The spec's own key names - the ones the shared spec and a config file
425
+ * use - paired with where each lands in a sek_spec.
426
+ *
427
+ * A TABLE RATHER THAN THIRTY LINES EACH WAY, because the two directions
428
+ * must not drift: a field written but not read is a store configured with
429
+ * a value it never sees, and the conformance suite only notices for the
430
+ * handful of fields its chains set. Every string field is here; `values`,
431
+ * `kv` and `auth` are not strings and are handled below. */
432
+ typedef struct {
433
+ const char *key;
434
+ size_t at;
435
+ } strfield;
436
+
437
+ #define SEK_FIELD(name, member) {name, offsetof(sek_spec, member)}
438
+ #define SEK_FIELD_AUTH(name, member) {name, offsetof(sek_authspec, member)}
439
+
440
+ static const strfield STRFIELDS[] = {
441
+ SEK_FIELD("kind", kind),
442
+ SEK_FIELD("name", name),
443
+ SEK_FIELD("prefix", prefix),
444
+ SEK_FIELD("file", file),
445
+ SEK_FIELD("dir", dir),
446
+ SEK_FIELD("addr", addr),
447
+ SEK_FIELD("token", token),
448
+ SEK_FIELD("mount", mount),
449
+ SEK_FIELD("vaultnamespace", vaultnamespace),
450
+ SEK_FIELD("command", command),
451
+ SEK_FIELD("profile", profile),
452
+ SEK_FIELD("backend", backend),
453
+ SEK_FIELD("reason", reason),
454
+ /* `namespace` is a keyword in C++ and several of the ports, so the C
455
+ * struct spells it `namespace_`; the wire key is the spec's. */
456
+ SEK_FIELD("namespace", namespace_),
457
+ SEK_FIELD("home", home),
458
+ SEK_FIELD("region", region),
459
+ SEK_FIELD("keyid", keyid),
460
+ SEK_FIELD("secret", secret),
461
+ SEK_FIELD("session", session),
462
+ SEK_FIELD("project", project),
463
+ SEK_FIELD("vault", vault),
464
+ SEK_FIELD("tenant", tenant),
465
+ SEK_FIELD("clientid", clientid),
466
+ SEK_FIELD("clientsecret", clientsecret),
467
+ SEK_FIELD("loginaddr", loginaddr),
468
+ SEK_FIELD("imdsaddr", imdsaddr),
469
+ SEK_FIELD("metadataaddr", metadataaddr),
470
+ SEK_FIELD("apiversion", apiversion),
471
+ SEK_FIELD("config", config),
472
+ SEK_FIELD("environment", environment),
473
+ SEK_FIELD("path", path),
474
+ };
475
+
476
+ static const strfield AUTHFIELDS[] = {
477
+ SEK_FIELD_AUTH("method", method), SEK_FIELD_AUTH("mount", mount),
478
+ SEK_FIELD_AUTH("role", role), SEK_FIELD_AUTH("jwt", jwt),
479
+ SEK_FIELD_AUTH("jwtfile", jwtfile), SEK_FIELD_AUTH("roleid", roleid),
480
+ SEK_FIELD_AUTH("secretid", secretid),
481
+ };
482
+
483
+ static const char **fieldof(sek_spec *spec, size_t at) {
484
+ return (const char **)((char *)spec + at);
485
+ }
486
+
487
+ static const char *const *readfield(const sek_spec *spec, size_t at) {
488
+ return (const char *const *)((const char *)spec + at);
489
+ }
490
+
491
+ static const char **authfieldof(sek_authspec *auth, size_t at) {
492
+ return (const char **)((char *)auth + at);
493
+ }
494
+
495
+ static const char *const *readauth(const sek_authspec *auth, size_t at) {
496
+ return (const char *const *)((const char *)auth + at);
497
+ }
498
+
499
+ /* A spec as the options map its plugin instance is declared with.
500
+ *
501
+ * Only fields that are SET are written, so an instance's options read
502
+ * like the chain entry that produced them. An empty string is set: it
503
+ * means the same as unset everywhere in this library, but round-tripping
504
+ * it unchanged is what keeps the two directions honest. */
505
+ Value *sek_optionsof(const sek_spec *spec) {
506
+ Value *options = vmap();
507
+ size_t index;
508
+
509
+ for (index = 0; index < sizeof(STRFIELDS) / sizeof(STRFIELDS[0]); index++) {
510
+ const char *value = *readfield(spec, STRFIELDS[index].at);
511
+ if (NULL != value) {
512
+ vset(options, STRFIELDS[index].key, vstr(value));
513
+ }
514
+ }
515
+
516
+ if (NULL != spec->values) {
517
+ Value *values = vmap();
518
+ size_t at;
519
+ for (at = 0; at < spec->values->len; at++) {
520
+ vset(values, spec->values->keys[at], vstr(spec->values->vals[at]));
521
+ }
522
+ vset(options, "values", values);
523
+ }
524
+
525
+ if (spec->haskv) {
526
+ vset(options, "kv", vnum(spec->kv));
527
+ }
528
+
529
+ if (NULL != spec->auth) {
530
+ Value *auth = vmap();
531
+ for (index = 0; index < sizeof(AUTHFIELDS) / sizeof(AUTHFIELDS[0]); index++) {
532
+ const char *value = *readauth(spec->auth, AUTHFIELDS[index].at);
533
+ if (NULL != value) {
534
+ vset(auth, AUTHFIELDS[index].key, vstr(value));
535
+ }
536
+ }
537
+ vset(options, "auth", auth);
538
+ }
539
+
540
+ return options;
541
+ }
542
+
543
+ /* ...and back, as the kind's `define` reads it.
544
+ *
545
+ * Every string is copied into the pool. The options map lives in
546
+ * voxgig/plugin's arena, which this library never resets and therefore
547
+ * never frees; copying keeps the ownership rule this header states - a
548
+ * provider's strings come from the pool it was built with - true anyway,
549
+ * rather than true by accident. */
550
+ static sek_spec specof(sek_pool *pool, Value *options) {
551
+ sek_spec spec = sek_spec_new(NULL);
552
+ Value *values = vget(options, "values");
553
+ Value *kv = vget(options, "kv");
554
+ Value *auth = vget(options, "auth");
555
+ size_t index;
556
+
557
+ for (index = 0; index < sizeof(STRFIELDS) / sizeof(STRFIELDS[0]); index++) {
558
+ Value *held = vget(options, STRFIELDS[index].key);
559
+ if (visstr(held)) {
560
+ *fieldof(&spec, STRFIELDS[index].at) = sek_strdup(pool, vasstr(held));
561
+ }
562
+ }
563
+
564
+ if (vismap(values)) {
565
+ const char **keys;
566
+ size_t count = vkeys(values, &keys);
567
+ size_t at;
568
+ spec.values = sek_map_new(pool);
569
+ for (at = 0; at < count; at++) {
570
+ Value *held = vget(values, keys[at]);
571
+ sek_map_set(spec.values, keys[at], visstr(held) ? vasstr(held) : vjson(held));
572
+ }
573
+ }
574
+
575
+ if (visnum(kv)) {
576
+ spec.kv = (int)vasnum(kv);
577
+ spec.haskv = 1;
578
+ }
579
+
580
+ if (vismap(auth)) {
581
+ sek_authspec *use = (sek_authspec *)sek_alloc(pool, sizeof(sek_authspec));
582
+ for (index = 0; index < sizeof(AUTHFIELDS) / sizeof(AUTHFIELDS[0]); index++) {
583
+ Value *held = vget(auth, AUTHFIELDS[index].key);
584
+ if (visstr(held)) {
585
+ *authfieldof(use, AUTHFIELDS[index].at) = sek_strdup(pool, vasstr(held));
586
+ }
587
+ }
588
+ spec.auth = use;
589
+ }
590
+
591
+ return spec;
592
+ }
593
+
594
+ /* ---- the bridge ---------------------------------------------------- */
595
+
596
+ /* WHAT `define` NEEDS AND A voxgig/plugin Definition CANNOT CARRY.
597
+ *
598
+ * plugin's value model holds numbers and strings, never pointers, and a
599
+ * Definition is data with function pointers in it and no context. So the
600
+ * pool a provider is allocated from, and the providers themselves, travel
601
+ * through this file-scope slot for the duration of one sek_new - the same
602
+ * shape the zig port uses, and the shape plugin's own C port uses for its
603
+ * pending error. A definition exports the INDEX of the provider it built
604
+ * and sek_new reads it back.
605
+ *
606
+ * The port claims no thread safety across constructions, and says so on
607
+ * sek_new. Nothing here is touched after sek_new returns. */
608
+ typedef struct {
609
+ sek_pool *pool;
610
+ sek_provider **built;
611
+ size_t len;
612
+ size_t cap;
613
+ } building;
614
+
615
+ static building SLOT;
616
+ static building *BUILDING = NULL;
617
+
618
+ void sek_build_begin(sek_pool *pool) {
619
+ memset(&SLOT, 0, sizeof(SLOT));
620
+ SLOT.pool = pool;
621
+ BUILDING = &SLOT;
622
+ }
623
+
624
+ void sek_build_end(void) { BUILDING = NULL; }
625
+
626
+ /* The provider a definition exported, by the index it exported. Answers
627
+ * NULL for an index no `define` of this construction handed out, which is
628
+ * how a Definition that is not a provider plugin at all is caught.
629
+ *
630
+ * THE RANGE IS CHECKED AS A DOUBLE, BEFORE THE CAST. An export is a plugin
631
+ * number, so a hand-written definition may put any double under the export
632
+ * key, and converting one that does not fit a size_t is undefined - on
633
+ * x86-64 gcc it wraps, and 1e30 came back as index 0, which is a live
634
+ * provider of this construction rather than the NULL this function
635
+ * promises. Written as `!(index < len)` rather than `index >= len` so that
636
+ * a NaN, which compares false with everything, is refused as well. */
637
+ sek_provider *sek_build_at(double index) {
638
+ if (NULL == BUILDING || !(0 <= index) || !(index < (double)BUILDING->len)) {
639
+ return NULL;
640
+ }
641
+
642
+ return BUILDING->built[(size_t)index];
643
+ }
644
+
645
+ static double keep(sek_provider *provider) {
646
+ if (BUILDING->len == BUILDING->cap) {
647
+ size_t cap = 0 == BUILDING->cap ? 8 : BUILDING->cap * 2;
648
+ sek_provider **bigger =
649
+ (sek_provider **)sek_alloc(BUILDING->pool, cap * sizeof(sek_provider *));
650
+ /* Guarded: the first growth copies from a NULL `built`, and memcpy's
651
+ * source is declared never-null even for a length of zero. */
652
+ if (0 < BUILDING->len) {
653
+ memcpy(bigger, BUILDING->built, BUILDING->len * sizeof(sek_provider *));
654
+ }
655
+ BUILDING->built = bigger;
656
+ BUILDING->cap = cap;
657
+ }
658
+
659
+ BUILDING->built[BUILDING->len] = provider;
660
+
661
+ return (double)BUILDING->len++;
662
+ }
663
+
664
+ /* The one `define` every provider kind shares.
665
+ *
666
+ * It finds its own kind's `make` by asking the host's catalog for the
667
+ * definition registered under this instance's name and casting it back to
668
+ * the sek_providerkind it is the first member of. That is why `def` must
669
+ * stay first, and it is what makes a plugin a data structure rather than
670
+ * a generated function per kind. A Definition that is NOT one of ours
671
+ * never reaches here - it has its own `define`, or none - and sek_new
672
+ * refuses it by name when it exports no provider. */
673
+ static void provider_define(Inst *inst) {
674
+ Definition *def = catalog_get(host_catalog(inst_host(inst)), inst_name(inst));
675
+ sek_providerkind *kind = (sek_providerkind *)def;
676
+ sek_provider *made = NULL;
677
+ sek_spec spec;
678
+ sek_err err;
679
+
680
+ spec = specof(BUILDING->pool, inst_options(inst));
681
+
682
+ err = kind->make(BUILDING->pool, &spec, &made);
683
+
684
+ /* A refusal crosses the boundary under sekreto's own code, carrying the
685
+ * message as `cause`, and sek_new turns it back into a sek_err. The
686
+ * shared spec pins these byte for byte, so the host must not rewrite
687
+ * them - and it does not: plugin keeps an error that already has a
688
+ * code, and only wraps a code-less one as plugin_define_failed. */
689
+ if (NULL != err) {
690
+ fail(SEK_ERROR_CODE, err, details2("ref", vstr(inst_ref(inst)), "cause", vstr(err)));
691
+ }
692
+
693
+ inst_export(inst, SEK_PROVIDER_EXPORT, vnum(keep(made)));
694
+ }
695
+
696
+ Definition *sek_providerplugin(sek_providerkind *slot, const char *kind, sek_makefn make) {
697
+ memset(slot, 0, sizeof(*slot));
698
+
699
+ slot->def.name = kind;
700
+ slot->def.define = provider_define;
701
+ slot->make = make;
702
+
703
+ return &slot->def;
704
+ }
705
+
706
+ /* ---- the built-in kinds, as definitions ---------------------------- */
707
+
708
+ /* A spec string, copied into the pool: a spec is the caller's and may be
709
+ * a stack value that is gone by the first lookup.
710
+ *
711
+ * Not static, and neither is the one below it: every plugin's `make` is
712
+ * written against the same two, so a kind under `plugins/` is built
713
+ * exactly the way a built-in is. */
714
+ const char *sek_own(sek_pool *pool, const char *text) {
715
+ return NULL == text ? NULL : sek_strdup(pool, text);
716
+ }
717
+
718
+ sek_provider *sek_provider_new(sek_pool *pool,
719
+ sek_err (*lookup)(sek_provider *, const char *, char **),
720
+ const char *(*describe)(sek_provider *), void *data) {
721
+ sek_provider *out = (sek_provider *)sek_alloc(pool, sizeof(sek_provider));
722
+
723
+ out->lookup = lookup;
724
+ out->describe = describe;
725
+ out->data = data;
726
+ out->pool = pool;
727
+
728
+ return out;
729
+ }
730
+
731
+ static sek_err env_make(sek_pool *pool, const sek_spec *spec, sek_provider **out) {
732
+ envdata *data = (envdata *)sek_alloc(pool, sizeof(envdata));
733
+
734
+ data->pool = pool;
735
+ data->prefix = sek_own(pool, spec->prefix);
736
+ data->described =
737
+ sek_empty(spec->prefix) ? sek_strdup(pool, "env") : sek_fmt(pool, "env:%s", spec->prefix);
738
+
739
+ *out = sek_provider_new(pool, env_lookup, env_describe, data);
740
+
741
+ return NULL;
742
+ }
743
+
744
+ static sek_err memory_make(sek_pool *pool, const sek_spec *spec, sek_provider **out) {
745
+ memorydata *data = (memorydata *)sek_alloc(pool, sizeof(memorydata));
746
+
747
+ data->pool = pool;
748
+ data->prefix = sek_own(pool, spec->prefix);
749
+ data->values = sek_map_new(pool);
750
+ if (NULL != spec->values) {
751
+ size_t index;
752
+ for (index = 0; index < spec->values->len; index++) {
753
+ sek_map_set(data->values, spec->values->keys[index], spec->values->vals[index]);
754
+ }
755
+ }
756
+ data->described = sek_empty(spec->prefix) ? sek_strdup(pool, "memory")
757
+ : sek_fmt(pool, "memory:%s", spec->prefix);
758
+
759
+ *out = sek_provider_new(pool, memory_lookup, memory_describe, data);
760
+
761
+ return NULL;
762
+ }
763
+
764
+ static sek_err dotenv_make(sek_pool *pool, const sek_spec *spec, sek_provider **out) {
765
+ dotenvdata *data = (dotenvdata *)sek_alloc(pool, sizeof(dotenvdata));
766
+
767
+ data->pool = pool;
768
+ data->file = sek_own(pool, sek_empty(spec->file) ? ".env" : spec->file);
769
+ data->prefix = sek_own(pool, spec->prefix);
770
+ data->values = NULL;
771
+ data->described = sek_fmt(pool, "dotenv:%s", data->file);
772
+
773
+ *out = sek_provider_new(pool, dotenv_lookup, dotenv_describe, data);
774
+
775
+ return NULL;
776
+ }
777
+
778
+ static sek_err file_make(sek_pool *pool, const sek_spec *spec, sek_provider **out) {
779
+ filedata *data = (filedata *)sek_alloc(pool, sizeof(filedata));
780
+
781
+ data->pool = pool;
782
+ data->dir = sek_own(pool, sek_orempty(spec->dir));
783
+ data->prefix = sek_own(pool, spec->prefix);
784
+ data->described = sek_fmt(pool, "file:%s", data->dir);
785
+
786
+ *out = sek_provider_new(pool, file_lookup, file_describe, data);
787
+
788
+ return NULL;
789
+ }
790
+
791
+ /* The four, as definitions, in the order sek_new puts them in a catalog.
792
+ * File-scope storage rather than a pool allocation: a definition is code
793
+ * plus a name, the same for every Sekreto in the process, and nothing
794
+ * here is written after the first call. */
795
+ static sek_providerkind BUILTINKINDS[4];
796
+ static Definition *BUILTINDEFS[4];
797
+
798
+ size_t sek_builtins(Definition ***out) {
799
+ BUILTINDEFS[0] = sek_providerplugin(&BUILTINKINDS[0], "env", env_make);
800
+ BUILTINDEFS[1] = sek_providerplugin(&BUILTINKINDS[1], "memory", memory_make);
801
+ BUILTINDEFS[2] = sek_providerplugin(&BUILTINKINDS[2], "dotenv", dotenv_make);
802
+ BUILTINDEFS[3] = sek_providerplugin(&BUILTINKINDS[3], "file", file_make);
803
+
804
+ *out = BUILTINDEFS;
805
+
806
+ return 4;
807
+ }
808
+
809
+ const char *const SEK_BUILTIN_KINDS[] = {"env", "memory", "dotenv", "file", NULL};
810
+
811
+ const char *const SEK_PLUGIN_KINDS[] = {
812
+ "hashicorp", "boru", "awssecrets", "awsparams", "gcpsecrets",
813
+ "azuresecrets", "onepassword", "doppler", "infisical", "secretspec", NULL};