@voxgig/sdkgen-langpack 0.0.1

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 (300) hide show
  1. package/.sdk/model/target/dart.aon +63 -0
  2. package/.sdk/model/target/haskell.aon +72 -0
  3. package/.sdk/model/target/lean.aon +91 -0
  4. package/.sdk/src/cmp/dart/Config_dart.ts +248 -0
  5. package/.sdk/src/cmp/dart/EntityBase_dart.ts +34 -0
  6. package/.sdk/src/cmp/dart/EntityOperation_dart.ts +43 -0
  7. package/.sdk/src/cmp/dart/EntityTypes_dart.ts +207 -0
  8. package/.sdk/src/cmp/dart/Entity_dart.ts +87 -0
  9. package/.sdk/src/cmp/dart/Gitignore_dart.ts +34 -0
  10. package/.sdk/src/cmp/dart/MainEntity_dart.ts +33 -0
  11. package/.sdk/src/cmp/dart/Main_dart.ts +178 -0
  12. package/.sdk/src/cmp/dart/Package_dart.ts +82 -0
  13. package/.sdk/src/cmp/dart/ReadmeEntity_dart.ts +177 -0
  14. package/.sdk/src/cmp/dart/ReadmeExamplesTest_dart.ts +238 -0
  15. package/.sdk/src/cmp/dart/ReadmeExplanation_dart.ts +53 -0
  16. package/.sdk/src/cmp/dart/ReadmeHowto_dart.ts +152 -0
  17. package/.sdk/src/cmp/dart/ReadmeInstall_dart.ts +59 -0
  18. package/.sdk/src/cmp/dart/ReadmeIntro_dart.ts +65 -0
  19. package/.sdk/src/cmp/dart/ReadmeModel_dart.ts +151 -0
  20. package/.sdk/src/cmp/dart/ReadmeOptions_dart.ts +63 -0
  21. package/.sdk/src/cmp/dart/ReadmeQuick_dart.ts +225 -0
  22. package/.sdk/src/cmp/dart/ReadmeRef_dart.ts +397 -0
  23. package/.sdk/src/cmp/dart/ReadmeTopHowto_dart.ts +24 -0
  24. package/.sdk/src/cmp/dart/ReadmeTopQuick_dart.ts +106 -0
  25. package/.sdk/src/cmp/dart/ReadmeTopTest_dart.ts +78 -0
  26. package/.sdk/src/cmp/dart/SdkError_dart.ts +42 -0
  27. package/.sdk/src/cmp/dart/TestDirect_dart.ts +516 -0
  28. package/.sdk/src/cmp/dart/TestEntity_dart.ts +628 -0
  29. package/.sdk/src/cmp/dart/Test_dart.ts +138 -0
  30. package/.sdk/src/cmp/dart/fragment/Config.data.fragment.dart +98 -0
  31. package/.sdk/src/cmp/dart/fragment/Config.fragment.dart +70 -0
  32. package/.sdk/src/cmp/dart/fragment/Direct.test.fragment.dart +25 -0
  33. package/.sdk/src/cmp/dart/fragment/Entity.fragment.dart +29 -0
  34. package/.sdk/src/cmp/dart/fragment/Entity.test.fragment.dart +28 -0
  35. package/.sdk/src/cmp/dart/fragment/EntityBase.fragment.dart +302 -0
  36. package/.sdk/src/cmp/dart/fragment/EntityCreateOp.fragment.dart +98 -0
  37. package/.sdk/src/cmp/dart/fragment/EntityListOp.fragment.dart +90 -0
  38. package/.sdk/src/cmp/dart/fragment/EntityLoadOp.fragment.dart +102 -0
  39. package/.sdk/src/cmp/dart/fragment/EntityRemoveOp.fragment.dart +108 -0
  40. package/.sdk/src/cmp/dart/fragment/EntityUpdateOp.fragment.dart +102 -0
  41. package/.sdk/src/cmp/dart/fragment/Main.fragment.dart +339 -0
  42. package/.sdk/src/cmp/dart/fragment/SdkError.fragment.dart +26 -0
  43. package/.sdk/src/cmp/dart/tsconfig.json +15 -0
  44. package/.sdk/src/cmp/dart/utility_dart.ts +155 -0
  45. package/.sdk/src/cmp/haskell/Config_haskell.ts +98 -0
  46. package/.sdk/src/cmp/haskell/Entity_haskell.ts +13 -0
  47. package/.sdk/src/cmp/haskell/Gitignore_haskell.ts +27 -0
  48. package/.sdk/src/cmp/haskell/Main_haskell.ts +123 -0
  49. package/.sdk/src/cmp/haskell/Package_haskell.ts +60 -0
  50. package/.sdk/src/cmp/haskell/ReadmeEntity_haskell.ts +186 -0
  51. package/.sdk/src/cmp/haskell/ReadmeExamplesTest_haskell.ts +135 -0
  52. package/.sdk/src/cmp/haskell/ReadmeExplanation_haskell.ts +48 -0
  53. package/.sdk/src/cmp/haskell/ReadmeHowto_haskell.ts +168 -0
  54. package/.sdk/src/cmp/haskell/ReadmeInstall_haskell.ts +51 -0
  55. package/.sdk/src/cmp/haskell/ReadmeIntro_haskell.ts +67 -0
  56. package/.sdk/src/cmp/haskell/ReadmeModel_haskell.ts +162 -0
  57. package/.sdk/src/cmp/haskell/ReadmeOptions_haskell.ts +74 -0
  58. package/.sdk/src/cmp/haskell/ReadmeQuick_haskell.ts +241 -0
  59. package/.sdk/src/cmp/haskell/ReadmeRef_haskell.ts +408 -0
  60. package/.sdk/src/cmp/haskell/ReadmeTopHowto_haskell.ts +31 -0
  61. package/.sdk/src/cmp/haskell/ReadmeTopQuick_haskell.ts +104 -0
  62. package/.sdk/src/cmp/haskell/ReadmeTopTest_haskell.ts +80 -0
  63. package/.sdk/src/cmp/haskell/Test_haskell.ts +297 -0
  64. package/.sdk/src/cmp/haskell/tsconfig.json +15 -0
  65. package/.sdk/src/cmp/haskell/utility_haskell.ts +166 -0
  66. package/.sdk/src/cmp/lean/Config_lean.ts +93 -0
  67. package/.sdk/src/cmp/lean/Entity_lean.ts +9 -0
  68. package/.sdk/src/cmp/lean/Gitignore_lean.ts +18 -0
  69. package/.sdk/src/cmp/lean/Main_lean.ts +120 -0
  70. package/.sdk/src/cmp/lean/Package_lean.ts +93 -0
  71. package/.sdk/src/cmp/lean/ReadmeEntity_lean.ts +29 -0
  72. package/.sdk/src/cmp/lean/ReadmeExplanation_lean.ts +19 -0
  73. package/.sdk/src/cmp/lean/ReadmeHowto_lean.ts +25 -0
  74. package/.sdk/src/cmp/lean/ReadmeInstall_lean.ts +39 -0
  75. package/.sdk/src/cmp/lean/ReadmeIntro_lean.ts +25 -0
  76. package/.sdk/src/cmp/lean/ReadmeModel_lean.ts +24 -0
  77. package/.sdk/src/cmp/lean/ReadmeOptions_lean.ts +22 -0
  78. package/.sdk/src/cmp/lean/ReadmeQuick_lean.ts +50 -0
  79. package/.sdk/src/cmp/lean/ReadmeRef_lean.ts +40 -0
  80. package/.sdk/src/cmp/lean/ReadmeTopHowto_lean.ts +16 -0
  81. package/.sdk/src/cmp/lean/ReadmeTopQuick_lean.ts +23 -0
  82. package/.sdk/src/cmp/lean/ReadmeTopTest_lean.ts +19 -0
  83. package/.sdk/src/cmp/lean/Test_lean.ts +261 -0
  84. package/.sdk/src/cmp/lean/utility_lean.ts +129 -0
  85. package/.sdk/tm/dart/LICENSE +22 -0
  86. package/.sdk/tm/dart/Makefile +50 -0
  87. package/.sdk/tm/dart/lib/Context.dart +150 -0
  88. package/.sdk/tm/dart/lib/Control.dart +15 -0
  89. package/.sdk/tm/dart/lib/Operation.dart +31 -0
  90. package/.sdk/tm/dart/lib/Point.dart +51 -0
  91. package/.sdk/tm/dart/lib/Response.dart +32 -0
  92. package/.sdk/tm/dart/lib/Result.dart +39 -0
  93. package/.sdk/tm/dart/lib/Spec.dart +49 -0
  94. package/.sdk/tm/dart/lib/feature/audit/AuditFeature.dart +103 -0
  95. package/.sdk/tm/dart/lib/feature/base/BaseFeature.dart +76 -0
  96. package/.sdk/tm/dart/lib/feature/cache/CacheFeature.dart +152 -0
  97. package/.sdk/tm/dart/lib/feature/clienttrack/ClienttrackFeature.dart +104 -0
  98. package/.sdk/tm/dart/lib/feature/cost/CostFeature.dart +446 -0
  99. package/.sdk/tm/dart/lib/feature/debug/DebugFeature.dart +153 -0
  100. package/.sdk/tm/dart/lib/feature/idempotency/IdempotencyFeature.dart +92 -0
  101. package/.sdk/tm/dart/lib/feature/log/LogFeature.dart +85 -0
  102. package/.sdk/tm/dart/lib/feature/metrics/MetricsFeature.dart +103 -0
  103. package/.sdk/tm/dart/lib/feature/netsim/NetsimFeature.dart +186 -0
  104. package/.sdk/tm/dart/lib/feature/paging/PagingFeature.dart +240 -0
  105. package/.sdk/tm/dart/lib/feature/proxy/ProxyFeature.dart +118 -0
  106. package/.sdk/tm/dart/lib/feature/ratelimit/RatelimitFeature.dart +103 -0
  107. package/.sdk/tm/dart/lib/feature/rbac/RbacFeature.dart +121 -0
  108. package/.sdk/tm/dart/lib/feature/retry/RetryFeature.dart +155 -0
  109. package/.sdk/tm/dart/lib/feature/secrets/SecretsFeature.dart +649 -0
  110. package/.sdk/tm/dart/lib/feature/secrets/plugin/capability.dart +105 -0
  111. package/.sdk/tm/dart/lib/feature/secrets/plugin/catalog.dart +46 -0
  112. package/.sdk/tm/dart/lib/feature/secrets/plugin/config.dart +297 -0
  113. package/.sdk/tm/dart/lib/feature/secrets/plugin/depend.dart +198 -0
  114. package/.sdk/tm/dart/lib/feature/secrets/plugin/env.dart +144 -0
  115. package/.sdk/tm/dart/lib/feature/secrets/plugin/export.dart +58 -0
  116. package/.sdk/tm/dart/lib/feature/secrets/plugin/graph.dart +160 -0
  117. package/.sdk/tm/dart/lib/feature/secrets/plugin/host.dart +1067 -0
  118. package/.sdk/tm/dart/lib/feature/secrets/plugin/order.dart +172 -0
  119. package/.sdk/tm/dart/lib/feature/secrets/plugin/plugin.dart +23 -0
  120. package/.sdk/tm/dart/lib/feature/secrets/plugin/point.dart +117 -0
  121. package/.sdk/tm/dart/lib/feature/secrets/plugin/ref.dart +105 -0
  122. package/.sdk/tm/dart/lib/feature/secrets/plugin/resolve.dart +58 -0
  123. package/.sdk/tm/dart/lib/feature/secrets/plugin/types.dart +201 -0
  124. package/.sdk/tm/dart/lib/feature/secrets/plugin/version.dart +116 -0
  125. package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/aws.dart +285 -0
  126. package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/azuresecrets.dart +178 -0
  127. package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/boru.dart +145 -0
  128. package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/crypto.dart +194 -0
  129. package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/doppler.dart +101 -0
  130. package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/gcpsecrets.dart +143 -0
  131. package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/hashicorp.dart +190 -0
  132. package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/httpjson.dart +363 -0
  133. package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/infisical.dart +149 -0
  134. package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/onepassword.dart +146 -0
  135. package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/secretspec.dart +116 -0
  136. package/.sdk/tm/dart/lib/feature/secrets/sekreto/plugins/sigv4.dart +237 -0
  137. package/.sdk/tm/dart/lib/feature/secrets/sekreto/src/addr.dart +138 -0
  138. package/.sdk/tm/dart/lib/feature/secrets/sekreto/src/json.dart +276 -0
  139. package/.sdk/tm/dart/lib/feature/secrets/sekreto/src/provider.dart +31 -0
  140. package/.sdk/tm/dart/lib/feature/secrets/sekreto/src/providers.dart +243 -0
  141. package/.sdk/tm/dart/lib/feature/secrets/sekreto/src/sekreto.dart +730 -0
  142. package/.sdk/tm/dart/lib/feature/secrets/sekreto/src/spec.dart +200 -0
  143. package/.sdk/tm/dart/lib/feature/secrets/sekreto/src/support.dart +217 -0
  144. package/.sdk/tm/dart/lib/feature/streaming/StreamingFeature.dart +97 -0
  145. package/.sdk/tm/dart/lib/feature/telemetry/TelemetryFeature.dart +136 -0
  146. package/.sdk/tm/dart/lib/feature/test/TestFeature.dart +328 -0
  147. package/.sdk/tm/dart/lib/feature/timeout/TimeoutFeature.dart +104 -0
  148. package/.sdk/tm/dart/lib/utility/CleanUtility.dart +12 -0
  149. package/.sdk/tm/dart/lib/utility/DoneUtility.dart +18 -0
  150. package/.sdk/tm/dart/lib/utility/ErrUtility.dart +46 -0
  151. package/.sdk/tm/dart/lib/utility/FeatureAddUtility.dart +35 -0
  152. package/.sdk/tm/dart/lib/utility/FeatureHookUtility.dart +20 -0
  153. package/.sdk/tm/dart/lib/utility/FeatureInitUtility.dart +9 -0
  154. package/.sdk/tm/dart/lib/utility/FetcherUtility.dart +104 -0
  155. package/.sdk/tm/dart/lib/utility/GraphqlUtility.dart +162 -0
  156. package/.sdk/tm/dart/lib/utility/MakeContextUtility.dart +6 -0
  157. package/.sdk/tm/dart/lib/utility/MakeErrorUtility.dart +71 -0
  158. package/.sdk/tm/dart/lib/utility/MakeFetchDefUtility.dart +42 -0
  159. package/.sdk/tm/dart/lib/utility/MakeOptionsUtility.dart +233 -0
  160. package/.sdk/tm/dart/lib/utility/MakePointUtility.dart +130 -0
  161. package/.sdk/tm/dart/lib/utility/MakeRequestUtility.dart +66 -0
  162. package/.sdk/tm/dart/lib/utility/MakeResponseUtility.dart +59 -0
  163. package/.sdk/tm/dart/lib/utility/MakeResultUtility.dart +49 -0
  164. package/.sdk/tm/dart/lib/utility/MakeSpecUtility.dart +77 -0
  165. package/.sdk/tm/dart/lib/utility/MakeUrlUtility.dart +51 -0
  166. package/.sdk/tm/dart/lib/utility/ParamUtility.dart +56 -0
  167. package/.sdk/tm/dart/lib/utility/PrepareAuthUtility.dart +46 -0
  168. package/.sdk/tm/dart/lib/utility/PrepareBodyUtility.dart +19 -0
  169. package/.sdk/tm/dart/lib/utility/PrepareHeadersUtility.dart +11 -0
  170. package/.sdk/tm/dart/lib/utility/PrepareMethodUtility.dart +30 -0
  171. package/.sdk/tm/dart/lib/utility/PrepareParamsUtility.dart +23 -0
  172. package/.sdk/tm/dart/lib/utility/PreparePathUtility.dart +9 -0
  173. package/.sdk/tm/dart/lib/utility/PrepareQueryUtility.dart +18 -0
  174. package/.sdk/tm/dart/lib/utility/ResultBasicUtility.dart +29 -0
  175. package/.sdk/tm/dart/lib/utility/ResultBodyUtility.dart +15 -0
  176. package/.sdk/tm/dart/lib/utility/ResultHeadersUtility.dart +18 -0
  177. package/.sdk/tm/dart/lib/utility/StructUtility.dart +127 -0
  178. package/.sdk/tm/dart/lib/utility/TransformRequestUtility.dart +28 -0
  179. package/.sdk/tm/dart/lib/utility/TransformResponseUtility.dart +44 -0
  180. package/.sdk/tm/dart/lib/utility/Utility.dart +239 -0
  181. package/.sdk/tm/dart/lib/utility/voxgig_struct.dart +2462 -0
  182. package/.sdk/tm/dart/src/feature/README.md +3 -0
  183. package/.sdk/tm/dart/src/feature/audit/.gitkeep +0 -0
  184. package/.sdk/tm/dart/src/feature/base/.gitkeep +0 -0
  185. package/.sdk/tm/dart/src/feature/cache/.gitkeep +0 -0
  186. package/.sdk/tm/dart/src/feature/clienttrack/.gitkeep +0 -0
  187. package/.sdk/tm/dart/src/feature/cost/.gitkeep +0 -0
  188. package/.sdk/tm/dart/src/feature/debug/.gitkeep +0 -0
  189. package/.sdk/tm/dart/src/feature/idempotency/.gitkeep +0 -0
  190. package/.sdk/tm/dart/src/feature/log/.gitkeep +0 -0
  191. package/.sdk/tm/dart/src/feature/metrics/.gitkeep +0 -0
  192. package/.sdk/tm/dart/src/feature/netsim/.gitkeep +0 -0
  193. package/.sdk/tm/dart/src/feature/paging/.gitkeep +0 -0
  194. package/.sdk/tm/dart/src/feature/proxy/.gitkeep +0 -0
  195. package/.sdk/tm/dart/src/feature/ratelimit/.gitkeep +0 -0
  196. package/.sdk/tm/dart/src/feature/rbac/.gitkeep +0 -0
  197. package/.sdk/tm/dart/src/feature/retry/.gitkeep +0 -0
  198. package/.sdk/tm/dart/src/feature/secrets/.gitkeep +0 -0
  199. package/.sdk/tm/dart/src/feature/streaming/.gitkeep +0 -0
  200. package/.sdk/tm/dart/src/feature/telemetry/.gitkeep +0 -0
  201. package/.sdk/tm/dart/src/feature/test/.gitkeep +0 -0
  202. package/.sdk/tm/dart/src/feature/timeout/.gitkeep +0 -0
  203. package/.sdk/tm/dart/test/custom_test.dart +65 -0
  204. package/.sdk/tm/dart/test/exists_test.dart +12 -0
  205. package/.sdk/tm/dart/test/feature/harness.dart +347 -0
  206. package/.sdk/tm/dart/test/feature/secrets/secrets_test.dart +1107 -0
  207. package/.sdk/tm/dart/test/feature_test.dart +1193 -0
  208. package/.sdk/tm/dart/test/harness.dart +153 -0
  209. package/.sdk/tm/dart/test/netsim_test.dart +48 -0
  210. package/.sdk/tm/dart/test/omni.dart +520 -0
  211. package/.sdk/tm/dart/test/omni_smoke_test.dart +143 -0
  212. package/.sdk/tm/dart/test/pipeline_test.dart +608 -0
  213. package/.sdk/tm/dart/test/primary_test.dart +476 -0
  214. package/.sdk/tm/dart/test/sdk-test-control.json +19 -0
  215. package/.sdk/tm/dart/test/struct_test.dart +468 -0
  216. package/.sdk/tm/dart/test/utility.dart +198 -0
  217. package/.sdk/tm/dart/test/vendor/omni/omni.dart +7 -0
  218. package/.sdk/tm/dart/test/vendor/omni/runner.dart +653 -0
  219. package/.sdk/tm/dart/test/vendor/omni/util.dart +232 -0
  220. package/.sdk/tm/haskell/LICENSE +21 -0
  221. package/.sdk/tm/haskell/Makefile +22 -0
  222. package/.sdk/tm/haskell/VERSION +1 -0
  223. package/.sdk/tm/haskell/src/SdkFeatures.hs +1440 -0
  224. package/.sdk/tm/haskell/src/SdkHelpers.hs +337 -0
  225. package/.sdk/tm/haskell/src/SdkJson.hs +111 -0
  226. package/.sdk/tm/haskell/src/SdkRuntime.hs +1279 -0
  227. package/.sdk/tm/haskell/src/SdkTypes.hs +195 -0
  228. package/.sdk/tm/haskell/src/VoxgigStruct.hs +2299 -0
  229. package/.sdk/tm/haskell/src/Vregex.hs +237 -0
  230. package/.sdk/tm/haskell/src/feature/README.md +5 -0
  231. package/.sdk/tm/haskell/src/feature/audit/.gitkeep +0 -0
  232. package/.sdk/tm/haskell/src/feature/base/.gitkeep +0 -0
  233. package/.sdk/tm/haskell/src/feature/cache/.gitkeep +0 -0
  234. package/.sdk/tm/haskell/src/feature/clienttrack/.gitkeep +0 -0
  235. package/.sdk/tm/haskell/src/feature/debug/.gitkeep +0 -0
  236. package/.sdk/tm/haskell/src/feature/idempotency/.gitkeep +0 -0
  237. package/.sdk/tm/haskell/src/feature/log/.gitkeep +0 -0
  238. package/.sdk/tm/haskell/src/feature/metrics/.gitkeep +0 -0
  239. package/.sdk/tm/haskell/src/feature/netsim/.gitkeep +0 -0
  240. package/.sdk/tm/haskell/src/feature/paging/.gitkeep +0 -0
  241. package/.sdk/tm/haskell/src/feature/proxy/.gitkeep +0 -0
  242. package/.sdk/tm/haskell/src/feature/ratelimit/.gitkeep +0 -0
  243. package/.sdk/tm/haskell/src/feature/rbac/.gitkeep +0 -0
  244. package/.sdk/tm/haskell/src/feature/retry/.gitkeep +0 -0
  245. package/.sdk/tm/haskell/src/feature/streaming/.gitkeep +0 -0
  246. package/.sdk/tm/haskell/src/feature/telemetry/.gitkeep +0 -0
  247. package/.sdk/tm/haskell/src/feature/test/.gitkeep +0 -0
  248. package/.sdk/tm/haskell/src/feature/timeout/.gitkeep +0 -0
  249. package/.sdk/tm/haskell/test/Harness.hs +281 -0
  250. package/.sdk/tm/haskell/test/OmniResolver.hs +252 -0
  251. package/.sdk/tm/haskell/test/Runner.hs +49 -0
  252. package/.sdk/tm/haskell/test/StructCorpus.hs +449 -0
  253. package/.sdk/tm/haskell/test/TCustomUtility.hs +38 -0
  254. package/.sdk/tm/haskell/test/TFeature.hs +794 -0
  255. package/.sdk/tm/haskell/test/TNetsim.hs +50 -0
  256. package/.sdk/tm/haskell/test/TPipeline.hs +334 -0
  257. package/.sdk/tm/haskell/test/TPrimaryCorpus.hs +263 -0
  258. package/.sdk/tm/haskell/test/TPrimaryUtility.hs +386 -0
  259. package/.sdk/tm/haskell/test/Testutil.hs +59 -0
  260. package/.sdk/tm/haskell/test/vendor/omni/Omni.hs +1147 -0
  261. package/.sdk/tm/lean/LICENSE +21 -0
  262. package/.sdk/tm/lean/Makefile +32 -0
  263. package/.sdk/tm/lean/VERSION +1 -0
  264. package/.sdk/tm/lean/src/SdkFeature.lean +171 -0
  265. package/.sdk/tm/lean/src/SdkFeatures.lean +787 -0
  266. package/.sdk/tm/lean/src/SdkJson.lean +134 -0
  267. package/.sdk/tm/lean/src/SdkRuntime.lean +374 -0
  268. package/.sdk/tm/lean/src/SdkUtility.lean +809 -0
  269. package/.sdk/tm/lean/src/VoxgigStruct.lean +2880 -0
  270. package/.sdk/tm/lean/src/Vregex.lean +412 -0
  271. package/.sdk/tm/lean/src/feature/README.md +5 -0
  272. package/.sdk/tm/lean/src/feature/audit/.gitkeep +0 -0
  273. package/.sdk/tm/lean/src/feature/base/.gitkeep +0 -0
  274. package/.sdk/tm/lean/src/feature/cache/.gitkeep +0 -0
  275. package/.sdk/tm/lean/src/feature/clienttrack/.gitkeep +0 -0
  276. package/.sdk/tm/lean/src/feature/cost/.gitkeep +0 -0
  277. package/.sdk/tm/lean/src/feature/debug/.gitkeep +0 -0
  278. package/.sdk/tm/lean/src/feature/idempotency/.gitkeep +0 -0
  279. package/.sdk/tm/lean/src/feature/log/.gitkeep +0 -0
  280. package/.sdk/tm/lean/src/feature/metrics/.gitkeep +0 -0
  281. package/.sdk/tm/lean/src/feature/netsim/.gitkeep +0 -0
  282. package/.sdk/tm/lean/src/feature/paging/.gitkeep +0 -0
  283. package/.sdk/tm/lean/src/feature/proxy/.gitkeep +0 -0
  284. package/.sdk/tm/lean/src/feature/ratelimit/.gitkeep +0 -0
  285. package/.sdk/tm/lean/src/feature/rbac/.gitkeep +0 -0
  286. package/.sdk/tm/lean/src/feature/retry/.gitkeep +0 -0
  287. package/.sdk/tm/lean/src/feature/streaming/.gitkeep +0 -0
  288. package/.sdk/tm/lean/src/feature/telemetry/.gitkeep +0 -0
  289. package/.sdk/tm/lean/src/feature/test/.gitkeep +0 -0
  290. package/.sdk/tm/lean/src/feature/timeout/.gitkeep +0 -0
  291. package/.sdk/tm/lean/test/OmniResolver.lean +358 -0
  292. package/.sdk/tm/lean/test/OmniSmoke.lean +174 -0
  293. package/.sdk/tm/lean/test/StructCorpus.lean +368 -0
  294. package/.sdk/tm/lean/test/TFeature.lean +281 -0
  295. package/.sdk/tm/lean/test/TPrimaryUtility.lean +227 -0
  296. package/.sdk/tm/lean/test/vendor/omni/Omni.lean +997 -0
  297. package/LICENSE +21 -0
  298. package/README.md +104 -0
  299. package/package.json +78 -0
  300. package/sdkgen-package.json +22 -0
@@ -0,0 +1,146 @@
1
+ // VENDORED: @voxgig/sekreto sdk-20260908-1556-0 (dart/plugins/onepassword.dart)
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
+ // 1Password Connect, as a voxgig/plugin definition.
5
+ //
6
+ // A PLUGIN, not a built-in: it opens a socket. A `Sekreto` can build the
7
+ // `onepassword` kind only if the calling project imported this file and
8
+ // passed `onepassword` in the `plugins` option
9
+ // (docs/design/plugin-providers.md).
10
+ //
11
+ // A port of typescript/plugins/onepassword.ts, which is canonical.
12
+
13
+ import 'dart:async';
14
+
15
+ import '../src/addr.dart';
16
+ import '../src/json.dart';
17
+ import '../src/provider.dart';
18
+ import '../src/sekreto.dart';
19
+ import '../src/support.dart';
20
+
21
+ import 'httpjson.dart';
22
+
23
+ /// 1Password, through a Connect server.
24
+ ///
25
+ /// The item titled `api.token` (titles keep their dots), in the named vault.
26
+ /// The value is the field with purpose PASSWORD, or the field labelled
27
+ /// `value`. A vault that cannot be found is an error - config names it, so
28
+ /// its absence is a broken store, not a missing secret.
29
+ class Onepassword extends Provider {
30
+ final String? addr;
31
+ final String? token;
32
+ final String? vault;
33
+
34
+ String? _vaultid;
35
+
36
+ Onepassword({this.addr, this.token, this.vault});
37
+
38
+ Map<String, String> _auth() => {'authorization': 'Bearer ${token ?? ''}'};
39
+
40
+ Future<String> _resolvevault(String useaddr) async {
41
+ final want = vault ?? '';
42
+ if (want.isEmpty) {
43
+ throw SekretoError('sekreto: onepassword: no vault');
44
+ }
45
+
46
+ final res = await fetchjson('GET', '$useaddr/v1/vaults', headers: _auth());
47
+
48
+ final list = res.body.asarr;
49
+ if (200 != res.status || null == list) {
50
+ throw SekretoError(
51
+ 'sekreto: onepassword error: ${res.status}: listing vaults',
52
+ );
53
+ }
54
+
55
+ for (final entry in list) {
56
+ if (want == entry.dig('id').text || want == entry.dig('name').text) {
57
+ return entry.dig('id').text ?? '';
58
+ }
59
+ }
60
+
61
+ throw SekretoError('sekreto: onepassword: no vault named $want');
62
+ }
63
+
64
+ @override
65
+ FutureOr<String?> lookup(String name) {
66
+ checkname(name);
67
+
68
+ final useaddr = trimslash(addr ?? '');
69
+ if (useaddr.isEmpty) {
70
+ throw SekretoError('sekreto: onepassword: no addr');
71
+ }
72
+ checkaddr(useaddr);
73
+
74
+ return _read(useaddr, name);
75
+ }
76
+
77
+ Future<String?> _read(String useaddr, String name) async {
78
+ var id = _vaultid;
79
+ if (null == id) {
80
+ id = await _resolvevault(useaddr);
81
+ _vaultid = id;
82
+ }
83
+
84
+ final filter = uriescape('title eq "$name"');
85
+ final found = await fetchjson(
86
+ 'GET',
87
+ '$useaddr/v1/vaults/$id/items?filter=$filter',
88
+ headers: _auth(),
89
+ );
90
+
91
+ final items = found.body.asarr;
92
+ if (200 != found.status || null == items) {
93
+ throw SekretoError(
94
+ 'sekreto: onepassword error: ${found.status}: finding $name',
95
+ );
96
+ }
97
+
98
+ // An empty list is a miss: the vault is fine, the item is not there.
99
+ if (items.isEmpty) {
100
+ return null;
101
+ }
102
+
103
+ final itemid = items.first.dig('id').text ?? '';
104
+ final item = await fetchjson(
105
+ 'GET',
106
+ '$useaddr/v1/vaults/$id/items/$itemid',
107
+ headers: _auth(),
108
+ );
109
+
110
+ if (200 != item.status) {
111
+ throw SekretoError(
112
+ 'sekreto: onepassword error: ${item.status}: reading $name',
113
+ );
114
+ }
115
+
116
+ final fields = item.body.dig('fields').asarr ?? const <Json>[];
117
+
118
+ for (final field in fields) {
119
+ if ('PASSWORD' == field.dig('purpose').asstr) {
120
+ return field.dig('value').text;
121
+ }
122
+ }
123
+
124
+ for (final field in fields) {
125
+ if ('value' == field.dig('label').asstr) {
126
+ return field.dig('value').text;
127
+ }
128
+ }
129
+
130
+ return null;
131
+ }
132
+
133
+ @override
134
+ String describe() => 'onepassword:${vault ?? ''}';
135
+ }
136
+
137
+ /// The `onepassword` provider kind. Pass it in `plugins` to name it in a
138
+ /// chain.
139
+ final Definition onepassword = providerplugin(
140
+ 'onepassword',
141
+ (spec) => Onepassword(
142
+ addr: spec.addr,
143
+ token: spec.token,
144
+ vault: spec.vault,
145
+ ),
146
+ );
@@ -0,0 +1,116 @@
1
+ // VENDORED: @voxgig/sekreto sdk-20260908-1556-0 (dart/plugins/secretspec.dart)
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
+ // SecretSpec, as a voxgig/plugin definition.
5
+ //
6
+ // A PLUGIN, not a built-in: it spawns a child process. A `Sekreto` can
7
+ // build the `secretspec` kind only if the calling project imported this
8
+ // file and passed `secretspec` in the `plugins` option
9
+ // (docs/design/plugin-providers.md).
10
+ //
11
+ // A port of typescript/plugins/secretspec.ts, which is canonical.
12
+
13
+ import '../src/provider.dart';
14
+ import '../src/sekreto.dart';
15
+ import '../src/support.dart';
16
+
17
+ import 'httpjson.dart';
18
+
19
+ /// Does this SecretSpec failure mean "no such secret" rather than "I could
20
+ /// not answer"?
21
+ ///
22
+ /// SecretSpec says `Secret 'API_TOKEN' not found` for both a name it does
23
+ /// not declare and one declared with no value, and both are misses: this
24
+ /// store does not hold it, so the chain carries on.
25
+ ///
26
+ /// MATCHED ON THE WHOLE PHRASE, NOT ON "not found". SecretSpec also says
27
+ /// `Provider backend 'keyring' not found`, which is a store that could not
28
+ /// answer at all - and reading that as a miss is the worst failure this
29
+ /// library has, because the chain then falls through to a weaker store
30
+ /// without saying so. The key is required to appear, so the two cannot be
31
+ /// confused.
32
+ bool secretspecmiss(String reason, String key) =>
33
+ reason.contains("Secret '$key' not found");
34
+
35
+ /// SecretSpec (https://secretspec.dev).
36
+ ///
37
+ /// SecretSpec is a declaration - a `secretspec.toml` naming the secrets a
38
+ /// project needs - plus a chain of its own backends to satisfy them from.
39
+ /// That makes it the same shape as sekreto one level down, and the reason to
40
+ /// support it is the same reason sekreto exists: a project that has already
41
+ /// declared its secrets there should not have to declare them again here.
42
+ ///
43
+ /// A reason is required, not optional: SecretSpec records every read in an
44
+ /// audit log and refuses to read at all without one. sekreto sends `sekreto`
45
+ /// unless told otherwise, so the audit trail says which tool asked.
46
+ class Secretspec extends Provider {
47
+ final String command;
48
+ final String? file;
49
+ final String? profile;
50
+ final String? backend;
51
+ final String? reason;
52
+ final String? prefix;
53
+
54
+ Secretspec({
55
+ String? command,
56
+ this.file,
57
+ this.profile,
58
+ this.backend,
59
+ this.reason,
60
+ this.prefix,
61
+ }) : command = (null == command || command.isEmpty) ? 'secretspec' : command;
62
+
63
+ @override
64
+ String? lookup(String name) {
65
+ final key = envkey(name, prefix);
66
+
67
+ // The order is SecretSpec's: --file belongs to the program, before the
68
+ // subcommand; everything else belongs to `get`.
69
+ final argv = <String>[command];
70
+ if (null != file && file!.isNotEmpty) {
71
+ argv.addAll(['--file', file!]);
72
+ }
73
+ argv.addAll(['get', key]);
74
+ if (null != backend && backend!.isNotEmpty) {
75
+ argv.addAll(['--provider', backend!]);
76
+ }
77
+ if (null != profile && profile!.isNotEmpty) {
78
+ argv.addAll(['--profile', profile!]);
79
+ }
80
+ argv.addAll(['--reason', first([reason, 'sekreto'])]);
81
+
82
+ final ran = runcmd(argv, command);
83
+
84
+ if (0 == ran.status) {
85
+ // The value and one newline, and nothing else.
86
+ return dropsuffix(ran.out, '\n');
87
+ }
88
+
89
+ if (secretspecmiss(ran.why, key)) {
90
+ return null;
91
+ }
92
+
93
+ throw SekretoError(
94
+ 'sekreto: secretspec error: '
95
+ '${ran.why.isEmpty ? 'exit ${ran.status}' : ran.why}',
96
+ );
97
+ }
98
+
99
+ @override
100
+ String describe() =>
101
+ 'secretspec${(null != backend && backend!.isNotEmpty) ? ':$backend' : ''}';
102
+ }
103
+
104
+ /// The `secretspec` provider kind. Pass it in `plugins` to name it in a
105
+ /// chain.
106
+ final Definition secretspec = providerplugin(
107
+ 'secretspec',
108
+ (spec) => Secretspec(
109
+ command: spec.command,
110
+ file: spec.file,
111
+ profile: spec.profile,
112
+ backend: spec.backend,
113
+ reason: spec.reason,
114
+ prefix: spec.prefix,
115
+ ),
116
+ );
@@ -0,0 +1,237 @@
1
+ // VENDORED: @voxgig/sekreto sdk-20260908-1556-0 (dart/plugins/sigv4.dart)
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
+ // AWS Signature Version 4, hand-rolled.
5
+ //
6
+ // A PLUGIN FILE, with `crypto.dart` beside it: the core of no port imports
7
+ // a hash function, and this is where sekreto's one use of one lives. Only
8
+ // the aws plugin reaches it, and only a consumer that passed the aws plugin
9
+ // reaches that.
10
+ //
11
+ // The AWS providers need exactly one thing from the AWS SDK - request
12
+ // signing - and taking the SDK for it would break the no-dependency rule
13
+ // that keeps the ports honest. SigV4 is a stable, published algorithm built
14
+ // from HMAC-SHA256, which `crypto.dart` supplies.
15
+ //
16
+ // `sigv4` is pure: the caller passes the timestamp, so the same input
17
+ // yields the same signature everywhere. That is what lets the shared spec
18
+ // carry known-answer cases that all ports must reproduce bit-for-bit, and
19
+ // lets the integration mock recompute the signature server-side.
20
+ //
21
+ // A port of typescript/plugins/sigv4.ts, which is canonical.
22
+
23
+ import 'dart:convert';
24
+
25
+ import '../src/addr.dart';
26
+
27
+ import 'crypto.dart';
28
+ // `uriescape` and `uridecode` live with the transport rather than here, so
29
+ // that a plugin which only has to escape a query parameter does not compile
30
+ // a hash function to get one. Canonical keeps them in this file because
31
+ // JavaScript's own `encodeURIComponent` covers the other plugins' needs and
32
+ // dart's `Uri.encodeComponent` does not: it leaves `!*'()` unescaped, which
33
+ // is not RFC 3986 and not what AWS signs.
34
+ import 'httpjson.dart';
35
+
36
+ /// One request to sign - the same declarative shape the shared spec uses.
37
+ /// `datetime` is `YYYYMMDDTHHMMSSZ`, and it is the caller's, so that signing
38
+ /// is a pure function of its input.
39
+ class Signing {
40
+ final String method;
41
+ final String url;
42
+ final String service;
43
+ final String region;
44
+ final String keyid;
45
+ final String secret;
46
+ final String datetime;
47
+ final Map<String, String> headers;
48
+ final String body;
49
+ final String? session;
50
+
51
+ const Signing({
52
+ required this.method,
53
+ required this.url,
54
+ required this.service,
55
+ required this.region,
56
+ required this.keyid,
57
+ required this.secret,
58
+ required this.datetime,
59
+ this.headers = const {},
60
+ this.body = '',
61
+ this.session,
62
+ });
63
+ }
64
+
65
+ /// The three pieces of a URL that signing needs, split by hand.
66
+ ///
67
+ /// Not `Uri.parse`: the `host` header AWS signs is the WHATWG one - the
68
+ /// hostname lowercased, userinfo stripped, and the port present only when
69
+ /// it is not the scheme's default - and no platform URL type answers
70
+ /// exactly that. A signature over a host the service computes differently
71
+ /// is refused with no useful diagnostic.
72
+ class _Parts {
73
+ final String host;
74
+ final String path;
75
+ final String query;
76
+ const _Parts(this.host, this.path, this.query);
77
+ }
78
+
79
+ _Parts _split(String url) {
80
+ final mark = url.indexOf('://');
81
+ final scheme = -1 == mark ? '' : url.substring(0, mark).toLowerCase();
82
+ final rest = -1 == mark ? url : url.substring(mark + 3);
83
+
84
+ final stop = stopat(rest, '/?#');
85
+ var authority = -1 == stop ? rest : rest.substring(0, stop);
86
+ var tail = -1 == stop ? '' : rest.substring(stop);
87
+
88
+ // Userinfo is not part of the signed host.
89
+ final at = authority.lastIndexOf('@');
90
+ if (-1 != at) {
91
+ authority = authority.substring(at + 1);
92
+ }
93
+
94
+ String host;
95
+ var port = '';
96
+
97
+ if (authority.startsWith('[')) {
98
+ // An IPv6 literal keeps its brackets and carries colons of its own.
99
+ final close = authority.indexOf(']');
100
+ if (-1 == close) {
101
+ host = authority;
102
+ } else {
103
+ host = authority.substring(0, close + 1);
104
+ final after = authority.substring(close + 1);
105
+ if (after.startsWith(':')) {
106
+ port = after.substring(1);
107
+ }
108
+ }
109
+ } else {
110
+ final colon = authority.lastIndexOf(':');
111
+ if (-1 == colon) {
112
+ host = authority;
113
+ } else {
114
+ host = authority.substring(0, colon);
115
+ port = authority.substring(colon + 1);
116
+ }
117
+ }
118
+
119
+ host = host.toLowerCase();
120
+
121
+ // A default port is implicit, and signing it would not match what the
122
+ // service reconstructs from the request line.
123
+ if (port.isNotEmpty &&
124
+ !('https' == scheme && '443' == port) &&
125
+ !('http' == scheme && '80' == port)) {
126
+ host = '$host:$port';
127
+ }
128
+
129
+ final hash = tail.indexOf('#');
130
+ if (-1 != hash) {
131
+ tail = tail.substring(0, hash);
132
+ }
133
+
134
+ final mark2 = tail.indexOf('?');
135
+ final path = -1 == mark2 ? tail : tail.substring(0, mark2);
136
+ final query = -1 == mark2 ? '' : tail.substring(mark2 + 1);
137
+
138
+ return _Parts(host, path.isEmpty ? '/' : path, query);
139
+ }
140
+
141
+ /// The canonical query string: each pair RFC 3986-escaped, sorted by escaped
142
+ /// key then escaped value.
143
+ String canonicalquery(String query) {
144
+ if (query.isEmpty) {
145
+ return '';
146
+ }
147
+
148
+ final pairs = <List<String>>[];
149
+
150
+ for (final pair in query.split('&')) {
151
+ final eq = pair.indexOf('=');
152
+ final key = -1 == eq ? pair : pair.substring(0, eq);
153
+ final value = -1 == eq ? '' : pair.substring(eq + 1);
154
+ pairs.add([uriescape(uridecode(key)), uriescape(uridecode(value))]);
155
+ }
156
+
157
+ pairs.sort((left, right) {
158
+ final bykey = left[0].compareTo(right[0]);
159
+ return 0 != bykey ? bykey : left[1].compareTo(right[1]);
160
+ });
161
+
162
+ return pairs.map((pair) => '${pair[0]}=${pair[1]}').join('&');
163
+ }
164
+
165
+ /// Sign one request. Returns the headers to attach: authorization,
166
+ /// x-amz-date, and x-amz-security-token when a session token was given, in
167
+ /// that order - the spec compares the result as a JSON object, and callers
168
+ /// print it field by field.
169
+ Map<String, String> sigv4(Signing input) {
170
+ final parts = _split(input.url);
171
+ final date = input.datetime.substring(0, 8);
172
+ final session =
173
+ (null == input.session || input.session!.isEmpty) ? null : input.session;
174
+
175
+ // Every header that will be signed: the caller's extras, plus host and
176
+ // x-amz-date (and the session token when present), lower-cased and
177
+ // trimmed the way the canonical form requires.
178
+ //
179
+ // Canonical header values are trimmed AND internally collapsed - AWS
180
+ // folds every run of whitespace, tabs included, to one space before
181
+ // signing, so a header like "a b" must sign as "a b" or the service
182
+ // refuses it.
183
+ final headers = <String, String>{};
184
+
185
+ input.headers.forEach((key, value) {
186
+ headers[key.toLowerCase()] = value.trim().replaceAll(RegExp(r'\s+'), ' ');
187
+ });
188
+
189
+ // Inserted after the caller's, so they win.
190
+ headers['host'] = parts.host;
191
+ headers['x-amz-date'] = input.datetime;
192
+ if (null != session) {
193
+ headers['x-amz-security-token'] = session;
194
+ }
195
+
196
+ final names = headers.keys.toList()..sort();
197
+ final canonicalheaders =
198
+ names.map((name) => '$name:${headers[name]}\n').join();
199
+ final signedheaders = names.join(';');
200
+
201
+ final canonicalrequest = [
202
+ input.method.toUpperCase(),
203
+ parts.path,
204
+ canonicalquery(parts.query),
205
+ canonicalheaders,
206
+ signedheaders,
207
+ sha256hex(input.body),
208
+ ].join('\n');
209
+
210
+ final scope = '$date/${input.region}/${input.service}/aws4_request';
211
+
212
+ final stringtosign = [
213
+ 'AWS4-HMAC-SHA256',
214
+ input.datetime,
215
+ scope,
216
+ sha256hex(canonicalrequest),
217
+ ].join('\n');
218
+
219
+ final kdate = hmacsha256(utf8.encode('AWS4${input.secret}'), utf8.encode(date));
220
+ final kregion = hmacsha256(kdate, utf8.encode(input.region));
221
+ final kservice = hmacsha256(kregion, utf8.encode(input.service));
222
+ final ksigning = hmacsha256(kservice, utf8.encode('aws4_request'));
223
+ final signature = hex(hmacsha256(ksigning, utf8.encode(stringtosign)));
224
+
225
+ final out = <String, String>{};
226
+
227
+ out['authorization'] = 'AWS4-HMAC-SHA256 Credential=${input.keyid}/$scope'
228
+ ', SignedHeaders=$signedheaders'
229
+ ', Signature=$signature';
230
+ out['x-amz-date'] = input.datetime;
231
+
232
+ if (null != session) {
233
+ out['x-amz-security-token'] = session;
234
+ }
235
+
236
+ return out;
237
+ }
@@ -0,0 +1,138 @@
1
+ // VENDORED: @voxgig/sekreto sdk-20260908-1556-0 (dart/src/addr.dart)
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 sekreto will and will not dial.
5
+ //
6
+ // IN THE CORE, though no built-in kind opens a socket. `checkaddr` is the
7
+ // rule that decides whether a token may be sent to an address at all, and a
8
+ // rule the plugins each carried a copy of would be ten rules. It is pure
9
+ // string work - nothing here connects to anything - so the core keeps it
10
+ // and every plugin that speaks HTTP imports it.
11
+ //
12
+ // A port of typescript/src/provider/addr.ts, which is canonical.
13
+
14
+ import 'sekreto.dart';
15
+
16
+ /// The index of the first character of [chars], or -1.
17
+ int stopat(String text, String chars) {
18
+ for (var at = 0; at < text.length; at++) {
19
+ if (chars.contains(text[at])) {
20
+ return at;
21
+ }
22
+ }
23
+ return -1;
24
+ }
25
+
26
+ /// An address with any userinfo replaced by `[redacted]`, for messages.
27
+ ///
28
+ /// Every refusal below names the address it refused, and one of them fires
29
+ /// precisely because the address carries a credential - so printing it
30
+ /// verbatim would write the password to stderr and into the logs. It cannot
31
+ /// be cleaned up afterwards either: that password was never resolved as a
32
+ /// secret, so redact() has never seen it and never will. The host is what a
33
+ /// reader needs to identify which chain entry is at fault; the userinfo is
34
+ /// not.
35
+ String safeaddr(String addr) {
36
+ final mark = addr.indexOf('://');
37
+ if (-1 == mark) {
38
+ return addr;
39
+ }
40
+
41
+ final rest = addr.substring(mark + 3);
42
+ final stop = stopat(rest, '/?#');
43
+ final authority = -1 == stop ? rest : rest.substring(0, stop);
44
+
45
+ final at = authority.lastIndexOf('@');
46
+ if (-1 == at) {
47
+ return addr;
48
+ }
49
+
50
+ return '${addr.substring(0, mark + 3)}[redacted]${addr.substring(mark + 3 + at)}';
51
+ }
52
+
53
+ /// Refuse to send a secret-bearing credential in the clear.
54
+ ///
55
+ /// A vault API is HTTPS in any real deployment; plaintext is a dev-mode
56
+ /// convenience. Sending a token over http to anything but the local machine
57
+ /// puts both the token and the secret it fetches on the wire for anyone on
58
+ /// the path, so sekreto will not do it. Loopback stays allowed: that is
59
+ /// `vault server -dev`, `boru vault serve`, and this repo's own test
60
+ /// harness.
61
+ ///
62
+ /// The address is read by hand, in the same handful of steps in every port,
63
+ /// rather than by `Uri.parse`. That is deliberate. A dozen parsers disagree
64
+ /// about malformed input - where userinfo ends, whether `0177.0.0.1` is
65
+ /// loopback, what an unclosed bracket means - and a check that answers
66
+ /// differently in different ports is not a check.
67
+ ///
68
+ /// The rule this parse obeys, and the reason it can be trusted: it is never
69
+ /// more permissive than the HTTP client that will dial the address. It ends
70
+ /// the authority at `/`, `?` or `#` only, so a client that also breaks on
71
+ /// `\` (WHATWG does) can only ever see a SHORTER host than this does. It
72
+ /// refuses userinfo outright rather than locating its end. It compares the
73
+ /// host literally, so a numeric form no parser here agrees on is refused
74
+ /// rather than guessed at.
75
+ void checkaddr(String addr) {
76
+ final String scheme;
77
+
78
+ if (addr.startsWith('https://')) {
79
+ scheme = 'https://';
80
+ } else if (addr.startsWith('http://')) {
81
+ scheme = 'http://';
82
+ } else {
83
+ throw SekretoError('sekreto: not an http(s) address: ${safeaddr(addr)}');
84
+ }
85
+
86
+ final rest = addr.substring(scheme.length);
87
+ final end = stopat(rest, '/?#');
88
+ final authority = -1 == end ? rest : rest.substring(0, end);
89
+
90
+ // Userinfo is refused outright rather than parsed around, and on https as
91
+ // well as http. No store this library speaks authenticates by userinfo -
92
+ // they take a token or a signature - so an address carrying one is a
93
+ // mistake at best. At worst it is the attack this whole function exists to
94
+ // stop: `http://localhost:8200@evil.example.com/` is a request to
95
+ // evil.example.com that reads, to anything that splits the authority on
96
+ // ':', as loopback.
97
+ if (authority.contains('@')) {
98
+ throw SekretoError(
99
+ 'sekreto: refusing an address with embedded credentials: ${safeaddr(addr)}',
100
+ );
101
+ }
102
+
103
+ // An opening bracket with no closing one is not an address at all.
104
+ if (authority.startsWith('[') && !authority.contains(']')) {
105
+ throw SekretoError(
106
+ 'sekreto: not a valid http(s) address: ${safeaddr(addr)}',
107
+ );
108
+ }
109
+
110
+ if ('https://' == scheme) {
111
+ return;
112
+ }
113
+
114
+ // A bracketed IPv6 literal keeps its brackets. Splitting the authority on
115
+ // the first colon yields '[', so `http://[::1]:8200` could never match -
116
+ // which would make the '[::1]' entry below unreachable, and refuse a
117
+ // legitimate local vault.
118
+ final String host;
119
+ if (authority.startsWith('[')) {
120
+ host = authority.substring(0, authority.indexOf(']') + 1).toLowerCase();
121
+ } else {
122
+ final colon = authority.indexOf(':');
123
+ host = (-1 == colon ? authority : authority.substring(0, colon))
124
+ .toLowerCase();
125
+ }
126
+
127
+ // Literal, and exactly four. Nothing is normalised: `0177.0.0.1`,
128
+ // `2130706433` and `[::ffff:127.0.0.1]` are loopback to some resolvers and
129
+ // not to others, and a check that has to guess is not a check.
130
+ if ('localhost' != host &&
131
+ '127.0.0.1' != host &&
132
+ '::1' != host &&
133
+ '[::1]' != host) {
134
+ throw SekretoError(
135
+ 'sekreto: refusing to send a token in plaintext to ${safeaddr(addr)} (use https)',
136
+ );
137
+ }
138
+ }