@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.
- package/bin/voxgig-sdkgen +1 -1
- package/package.json +1 -1
- package/project/.sdk/model/feature/secrets.aon +330 -0
- package/project/.sdk/model/target/c.aon +15 -2
- package/project/.sdk/model/target/cpp.aon +18 -0
- package/project/.sdk/model/target/lua.aon +17 -0
- package/project/.sdk/model/target/ocaml.aon +48 -5
- package/project/.sdk/model/target/zig.aon +30 -4
- package/project/.sdk/src/cmp/c/Config_c.ts +338 -1
- package/project/.sdk/src/cmp/c/Main_c.ts +57 -2
- package/project/.sdk/src/cmp/c/Package_c.ts +12 -2
- package/project/.sdk/src/cmp/cpp/Config_cpp.ts +324 -2
- package/project/.sdk/src/cmp/cpp/Gitignore_cpp.ts +2 -0
- package/project/.sdk/src/cmp/cpp/Main_cpp.ts +62 -4
- package/project/.sdk/src/cmp/cpp/Package_cpp.ts +10 -0
- package/project/.sdk/src/cmp/lua/Config_lua.ts +88 -0
- package/project/.sdk/src/cmp/lua/Gitignore_lua.ts +4 -0
- package/project/.sdk/src/cmp/lua/Main_lua.ts +93 -3
- package/project/.sdk/src/cmp/lua/Package_lua.ts +60 -0
- package/project/.sdk/src/cmp/lua/fragment/Main.fragment.lua +10 -0
- package/project/.sdk/src/cmp/ocaml/Config_ocaml.ts +183 -5
- package/project/.sdk/src/cmp/ocaml/Main_ocaml.ts +160 -3
- package/project/.sdk/src/cmp/ocaml/Package_ocaml.ts +25 -1
- package/project/.sdk/src/cmp/zig/Config_zig.ts +130 -9
- package/project/.sdk/src/cmp/zig/Main_zig.ts +208 -4
- package/project/.sdk/{tm/zig/build.zig → src/cmp/zig/fragment/Build.fragment.zig} +7 -0
- package/project/.sdk/src/cmp/zig/fragment/Main.fragment.zig +25 -0
- package/project/.sdk/{tm/zig/root.zig → src/cmp/zig/fragment/Root.fragment.zig} +9 -0
- package/project/.sdk/tm/c/Makefile +58 -9
- package/project/.sdk/tm/c/core/sdk.h +10 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/capability.c +133 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/capability.h +39 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/catalog.c +83 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/catalog.h +48 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/config.c +413 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/config.h +24 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/depend.c +264 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/depend.h +29 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/env.c +220 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/env.h +19 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/export.c +97 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/export.h +19 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/graph.c +237 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/graph.h +17 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/host.c +1494 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/host.h +135 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/order.c +288 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/order.h +18 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/point.c +141 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/point.h +80 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/ref.c +170 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/ref.h +52 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/resolve.c +98 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/resolve.h +18 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/types.c +150 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/types.h +104 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/value.c +649 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/value.h +135 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/version.c +151 -0
- package/project/.sdk/tm/c/feature/secrets/plugin/version.h +34 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/aws.c +281 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/azuresecrets.c +207 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/boru.c +164 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/clock.c +75 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/doppler.c +141 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/encode.c +144 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/gcpsecrets.c +177 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/hashicorp.c +239 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/httpjson.c +599 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/infisical.c +165 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/onepassword.c +194 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/proc.c +233 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/secretspec.c +125 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/sekretoplugins.h +125 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/sha256.c +270 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/sigv4.c +382 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/support.h +153 -0
- package/project/.sdk/tm/c/feature/secrets/plugins/tls.c +420 -0
- package/project/.sdk/tm/c/feature/secrets/sekreto/internal.h +86 -0
- package/project/.sdk/tm/c/feature/secrets/sekreto/json.c +721 -0
- package/project/.sdk/tm/c/feature/secrets/sekreto/providers.c +813 -0
- package/project/.sdk/tm/c/feature/secrets/sekreto/sekreto.c +944 -0
- package/project/.sdk/tm/c/feature/secrets/sekreto/sekreto.h +490 -0
- package/project/.sdk/tm/c/feature/secrets/sekreto/util.c +442 -0
- package/project/.sdk/tm/c/feature/secrets.c +797 -0
- package/project/.sdk/tm/c/feature/secrets.h +46 -0
- package/project/.sdk/tm/c/src/feature/secrets/.gitkeep +0 -0
- package/project/.sdk/tm/c/tests/feature/secrets/secrets_test.c +802 -0
- package/project/.sdk/tm/clojure/feature/secrets/sdk/feature/secrets.clj +38 -11
- package/project/.sdk/tm/clojure/test/sdk/test/feature/secrets.clj +40 -6
- package/project/.sdk/tm/cpp/Makefile +48 -4
- package/project/.sdk/tm/cpp/feature/secrets/plugin/capability.cpp +121 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/capability.hpp +41 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/catalog.cpp +60 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/catalog.hpp +66 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/config.cpp +376 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/config.hpp +29 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/depend.cpp +230 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/depend.hpp +31 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/env.cpp +205 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/env.hpp +25 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/export.cpp +84 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/export.hpp +24 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/graph.cpp +222 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/graph.hpp +21 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/host.cpp +1200 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/host.hpp +250 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/order.cpp +250 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/order.hpp +22 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/point.cpp +110 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/point.hpp +79 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/ref.cpp +136 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/ref.hpp +60 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/resolve.cpp +82 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/resolve.hpp +25 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/types.cpp +90 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/types.hpp +65 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/value.cpp +491 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/value.hpp +120 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/version.cpp +143 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugin/version.hpp +36 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Aws.cpp +248 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Aws.hpp +30 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Azuresecrets.cpp +149 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Azuresecrets.hpp +23 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Boru.cpp +117 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Boru.hpp +27 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Crypto.cpp +180 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Crypto.hpp +52 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Doppler.cpp +87 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Doppler.hpp +23 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Gcpsecrets.cpp +121 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Gcpsecrets.hpp +23 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Hashicorp.cpp +153 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Hashicorp.hpp +23 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Httpjson.cpp +666 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Httpjson.hpp +160 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Infisical.cpp +123 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Infisical.hpp +23 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Onepassword.cpp +125 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Onepassword.hpp +23 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Proc.cpp +223 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Proc.hpp +47 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Secretspec.cpp +104 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Secretspec.hpp +27 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Sigv4.cpp +242 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Sigv4.hpp +58 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Tls.cpp +260 -0
- package/project/.sdk/tm/cpp/feature/secrets/plugins/Tls.hpp +47 -0
- package/project/.sdk/tm/cpp/feature/secrets/sekreto/Json.cpp +476 -0
- package/project/.sdk/tm/cpp/feature/secrets/sekreto/Json.hpp +89 -0
- package/project/.sdk/tm/cpp/feature/secrets/sekreto/Provider.cpp +312 -0
- package/project/.sdk/tm/cpp/feature/secrets/sekreto/Provider.hpp +263 -0
- package/project/.sdk/tm/cpp/feature/secrets/sekreto/Providers.cpp +354 -0
- package/project/.sdk/tm/cpp/feature/secrets/sekreto/Providers.hpp +111 -0
- package/project/.sdk/tm/cpp/feature/secrets/sekreto/Sekreto.cpp +613 -0
- package/project/.sdk/tm/cpp/feature/secrets/sekreto/Sekreto.hpp +227 -0
- package/project/.sdk/tm/cpp/feature/secrets.hpp +745 -0
- package/project/.sdk/tm/cpp/src/feature/secrets/.gitkeep +0 -0
- package/project/.sdk/tm/cpp/test/feature/secrets/secrets_test.cpp +808 -0
- package/project/.sdk/tm/csharp/feature/SecretsFeature.cs +34 -8
- package/project/.sdk/tm/csharp/test/feature/secrets/SecretsFeatureTest.cs +85 -0
- package/project/.sdk/tm/elixir/lib/projectname/feature/secrets.ex +17 -2
- package/project/.sdk/tm/elixir/test/feature/secrets/secrets_test.exs +41 -0
- package/project/.sdk/tm/go/feature/secrets_feature.go +32 -10
- package/project/.sdk/tm/go/test/feature/secrets/secrets_feature_test.go +116 -0
- package/project/.sdk/tm/java/feature/SecretsFeature.java +33 -8
- package/project/.sdk/tm/java/test/feature/secrets/SecretsFeatureTest.java +64 -0
- package/project/.sdk/tm/js/src/feature/secrets/SecretsFeature.js +34 -11
- package/project/.sdk/tm/js/test/feature/secrets/Secrets.test.js +73 -0
- package/project/.sdk/tm/kotlin/feature/SecretsFeature.kt +32 -7
- package/project/.sdk/tm/kotlin/test/feature/secrets/SecretsTest.kt +69 -0
- package/project/.sdk/tm/lua/Makefile +15 -4
- package/project/.sdk/tm/lua/feature/secrets/native/sekretonet.c +806 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/capability.lua +135 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/catalog.lua +63 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/config.lua +361 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/depend.lua +232 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/env.lua +168 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/export.lua +66 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/graph.lua +194 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/host.lua +1190 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/json.lua +169 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/order.lua +207 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/point.lua +106 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/ref.lua +115 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/resolve.lua +78 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/types.lua +275 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin/version.lua +131 -0
- package/project/.sdk/tm/lua/feature/secrets/plugin.lua +76 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/addr.lua +124 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/err.lua +47 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/name.lua +315 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/aws.lua +228 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/azuresecrets.lua +137 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/boru.lua +124 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/crypto.lua +212 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/doppler.lua +89 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/gcpsecrets.lua +129 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/hashicorp.lua +154 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/httpjson.lua +248 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/infisical.lua +113 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/json.lua +449 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/net.lua +198 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/onepassword.lua +126 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/secretspec.lua +93 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/sigv4.lua +269 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/plugins/support.lua +146 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto/providers.lua +346 -0
- package/project/.sdk/tm/lua/feature/secrets/sekreto.lua +479 -0
- package/project/.sdk/tm/lua/feature/secrets_feature.lua +690 -0
- package/project/.sdk/tm/lua/src/feature/secrets/.gitkeep +0 -0
- package/project/.sdk/tm/lua/test/extend_test.lua +105 -0
- package/project/.sdk/tm/lua/test/feature/secrets/secrets_feature_test.lua +862 -0
- package/project/.sdk/tm/ocaml/Makefile +52 -8
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/capability.ml +106 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/catalog.ml +43 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/config.ml +349 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/defs.ml +143 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/depend.ml +217 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/env.ml +197 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/export.ml +89 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/graph.ml +227 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/host.ml +1112 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/order.ml +202 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/point.ml +138 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/ref.ml +126 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/resolve.ml +62 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/types.ml +97 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/value.ml +387 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugin/version.ml +139 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/aws.ml +171 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/azuresecrets.ml +116 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/boru.ml +95 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/crypto.ml +149 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/doppler.ml +61 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/gcpsecrets.ml +93 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/hashicorp.ml +120 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/http.ml +421 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/httpjson.ml +66 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/infisical.ml +85 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/onepassword.ml +112 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/runcmd.ml +97 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/secretspec.ml +68 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/sigv4.ml +259 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/tls.ml +44 -0
- package/project/.sdk/tm/ocaml/feature/secrets/plugins/tls_stubs.c +358 -0
- package/project/.sdk/tm/ocaml/feature/secrets/sekreto/json.ml +376 -0
- package/project/.sdk/tm/ocaml/feature/secrets/sekreto/provider.ml +647 -0
- package/project/.sdk/tm/ocaml/feature/secrets/sekreto/secret.ml +299 -0
- package/project/.sdk/tm/ocaml/feature/secrets/sekreto/sekreto.ml +347 -0
- package/project/.sdk/tm/ocaml/feature/secrets_feature.ml +453 -0
- package/project/.sdk/tm/ocaml/src/feature/secrets/.gitkeep +0 -0
- package/project/.sdk/tm/ocaml/test/feature/secrets/t_secrets.ml +670 -0
- package/project/.sdk/tm/perl/feature/secrets_feature.pm +33 -12
- package/project/.sdk/tm/perl/t/feature/secrets/secrets.t +47 -0
- package/project/.sdk/tm/php/feature/SecretsFeature.php +30 -6
- package/project/.sdk/tm/php/test/feature/secrets/SecretsTest.php +98 -0
- package/project/.sdk/tm/py/pkg/feature/secrets_feature.py +28 -6
- package/project/.sdk/tm/py/test/feature/secrets/test_secrets.py +114 -0
- package/project/.sdk/tm/rb/feature/secrets_feature.rb +28 -6
- package/project/.sdk/tm/rb/test/feature/secrets/secrets_feature_test.rb +93 -0
- package/project/.sdk/tm/rust/feature/secrets.rs +33 -10
- package/project/.sdk/tm/rust/tests/feature/secrets/main.rs +96 -0
- package/project/.sdk/tm/scala/feature/SecretsFeature.scala +29 -7
- package/project/.sdk/tm/scala/sdktest/feature/secrets/SecretsTestMain.scala +71 -0
- package/project/.sdk/tm/ts/src/feature/secrets/SecretsFeature.ts +35 -12
- package/project/.sdk/tm/ts/test/feature/secrets/Secrets.test.ts +73 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/capability.zig +137 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/catalog.zig +90 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/config.zig +346 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/depend.zig +244 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/env.zig +201 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/export.zig +83 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/graph.zig +212 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/host.zig +1224 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/inst.zig +126 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/order.zig +228 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/plugin.zig +34 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/point.zig +166 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/ref.zig +147 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/resolve.zig +74 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/types.zig +140 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/value.zig +662 -0
- package/project/.sdk/tm/zig/feature/secrets/plugin/version.zig +139 -0
- package/project/.sdk/tm/zig/feature/secrets/plugins/aws.zig +294 -0
- package/project/.sdk/tm/zig/feature/secrets/plugins/azuresecrets.zig +222 -0
- package/project/.sdk/tm/zig/feature/secrets/plugins/boru.zig +188 -0
- package/project/.sdk/tm/zig/feature/secrets/plugins/doppler.zig +135 -0
- package/project/.sdk/tm/zig/feature/secrets/plugins/gcpsecrets.zig +170 -0
- package/project/.sdk/tm/zig/feature/secrets/plugins/hashicorp.zig +242 -0
- package/project/.sdk/tm/zig/feature/secrets/plugins/httpjson.zig +535 -0
- package/project/.sdk/tm/zig/feature/secrets/plugins/infisical.zig +167 -0
- package/project/.sdk/tm/zig/feature/secrets/plugins/onepassword.zig +202 -0
- package/project/.sdk/tm/zig/feature/secrets/plugins/secretspec.zig +160 -0
- package/project/.sdk/tm/zig/feature/secrets/plugins/sigv4.zig +336 -0
- package/project/.sdk/tm/zig/feature/secrets/sekreto/addr.zig +148 -0
- package/project/.sdk/tm/zig/feature/secrets/sekreto/builtins.zig +259 -0
- package/project/.sdk/tm/zig/feature/secrets/sekreto/provider.zig +440 -0
- package/project/.sdk/tm/zig/feature/secrets/sekreto/sekreto.zig +944 -0
- package/project/.sdk/tm/zig/feature/secrets.zig +854 -0
- package/project/.sdk/tm/zig/src/feature/secrets/.gitkeep +0 -0
- package/project/.sdk/tm/zig/test/feature/secrets/secrets_test.zig +891 -0
- package/project/sdkgen-package.json +1 -1
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
// VENDORED: @voxgig/plugin sdk-20260908-1556-0 (zig/src/version.zig)
|
|
2
|
+
// Source: https://github.com/voxgig/plugin @ 48392f5e2b6d1434ee9b1a4a9a11f4480aaeb46a [tag: sdk-20260908-1556-0]
|
|
3
|
+
// License: MIT (c) voxgig - see repository LICENSE. Do not edit: resync from upstream.
|
|
4
|
+
//! Versions and ranges (§11.2).
|
|
5
|
+
//!
|
|
6
|
+
//! TWO FIELDS AND ONE PREDICATE. A capability declares `version`, a
|
|
7
|
+
//! concrete version. A requirement declares `range`. A requirement is
|
|
8
|
+
//! satisfied when the names match, the `match` passes, and the
|
|
9
|
+
//! provider's `version` falls inside the requirement's `range`. That is
|
|
10
|
+
//! the whole rule — there is no third field and no second comparison.
|
|
11
|
+
|
|
12
|
+
const std = @import("std");
|
|
13
|
+
const v = @import("value.zig");
|
|
14
|
+
const t = @import("types.zig");
|
|
15
|
+
|
|
16
|
+
/// A COMPONENT IS BOUNDED, like a ref is (§4's 1024).
|
|
17
|
+
///
|
|
18
|
+
/// The grammar admits an unbounded digit sequence, and every language
|
|
19
|
+
/// then disagrees about what happens past its integer range: JavaScript
|
|
20
|
+
/// silently loses precision, Go's Atoi errors (and a port ignoring that
|
|
21
|
+
/// gets 0), C overflows, Python is exact, Haskell's Integer is
|
|
22
|
+
/// unbounded. `satisfies("0", "9223372036854775808")` was false in the
|
|
23
|
+
/// canonical and true in go, from the same corpus.
|
|
24
|
+
///
|
|
25
|
+
/// 2^31-1 because every port has a signed 32-bit integer, and no real
|
|
26
|
+
/// version has ever needed more. Stated rather than left to arithmetic
|
|
27
|
+
/// nobody agrees on. Found by review of the go port.
|
|
28
|
+
const COMPONENT_MAX: i64 = 2147483647;
|
|
29
|
+
|
|
30
|
+
const Parsed = struct { parts: [3]i64, overflow: bool };
|
|
31
|
+
|
|
32
|
+
/// `^(\d+)(?:\.(\d+))?(?:\.(\d+))?$`, by hand: three components, digits
|
|
33
|
+
/// only, no leading sign, no empty component. Written out rather than
|
|
34
|
+
/// handed to a regex because the bound above has to be checked per
|
|
35
|
+
/// component anyway.
|
|
36
|
+
fn parse3(s: []const u8) ?Parsed {
|
|
37
|
+
if (s.len == 0) return null;
|
|
38
|
+
var out = Parsed{ .parts = .{ 0, 0, 0 }, .overflow = false };
|
|
39
|
+
var i: usize = 0;
|
|
40
|
+
var part: usize = 0;
|
|
41
|
+
while (part < 3) : (part += 1) {
|
|
42
|
+
if (i >= s.len) return if (part > 0) out else null; // fewer than three is fine
|
|
43
|
+
if (part > 0) {
|
|
44
|
+
if (s[i] != '.') return null;
|
|
45
|
+
i += 1;
|
|
46
|
+
}
|
|
47
|
+
const start = i;
|
|
48
|
+
var acc: i64 = 0;
|
|
49
|
+
while (i < s.len and s[i] >= '0' and s[i] <= '9') : (i += 1) {
|
|
50
|
+
if (!out.overflow) {
|
|
51
|
+
acc = acc * 10 + @as(i64, s[i] - '0');
|
|
52
|
+
if (acc > COMPONENT_MAX) out.overflow = true;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (start == i) return null; // an empty component is not a number
|
|
56
|
+
out.parts[part] = acc;
|
|
57
|
+
}
|
|
58
|
+
return if (i == s.len) out else null;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
fn triple(n: [3]i64) *v.Value {
|
|
62
|
+
const out = v.vlist();
|
|
63
|
+
for (n) |x| v.push(out, v.vnum(@floatFromInt(x)));
|
|
64
|
+
return out;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
pub fn parserange(range: ?*v.Value) t.Err!*v.Value {
|
|
68
|
+
if (!v.isStr(range) or v.asStr(range).len == 0) {
|
|
69
|
+
const shown = if (v.isStr(range)) v.asStr(range) else "";
|
|
70
|
+
return t.fail("plugin_bad_range", v.print("invalid range: {s}", .{shown}), t.details1("range", if (v.isNull(range)) v.vnull() else range));
|
|
71
|
+
}
|
|
72
|
+
const s = v.asStr(range);
|
|
73
|
+
// Two forms and no more (§11.2):
|
|
74
|
+
// '2.1' >= 2.1.0 and < 3.0.0
|
|
75
|
+
// '~2.1' >= 2.1.0 and < 2.2.0
|
|
76
|
+
const tilde = s[0] == '~';
|
|
77
|
+
const body = if (tilde) s[1..] else s;
|
|
78
|
+
|
|
79
|
+
const p = parse3(body) orelse
|
|
80
|
+
return t.fail("plugin_bad_range", v.print("invalid range: {s}", .{s}), t.details1("range", range));
|
|
81
|
+
if (p.overflow) {
|
|
82
|
+
return t.fail("plugin_bad_range", v.print("version component out of range in {s}", .{s}), t.details1("range", range));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const lo = p.parts;
|
|
86
|
+
const hi: [3]i64 = if (tilde)
|
|
87
|
+
.{ p.parts[0], p.parts[1] + 1, 0 }
|
|
88
|
+
else
|
|
89
|
+
.{ p.parts[0] + 1, 0, 0 };
|
|
90
|
+
|
|
91
|
+
const out = v.vmap();
|
|
92
|
+
v.set(out, "lo", triple(lo));
|
|
93
|
+
v.set(out, "hi", triple(hi));
|
|
94
|
+
return out;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
pub fn parseversion(version: ?*v.Value) t.Err!*v.Value {
|
|
98
|
+
if (!v.isStr(version)) {
|
|
99
|
+
return t.fail("plugin_bad_range", "invalid version", t.details1("version", if (v.isNull(version)) v.vnull() else version));
|
|
100
|
+
}
|
|
101
|
+
const s = v.asStr(version);
|
|
102
|
+
// `plugin_bad_range` either way — the same code the rest of the
|
|
103
|
+
// grammar's failures use, because "this is not a version I can
|
|
104
|
+
// compare" is one fact however it went wrong.
|
|
105
|
+
const p = parse3(s) orelse
|
|
106
|
+
return t.fail("plugin_bad_range", v.print("invalid version: {s}", .{s}), t.details1("version", version));
|
|
107
|
+
if (p.overflow) {
|
|
108
|
+
return t.fail("plugin_bad_range", v.print("version component out of range in {s}", .{s}), t.details1("version", version));
|
|
109
|
+
}
|
|
110
|
+
return triple(p.parts);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
pub fn vercmp(a: ?*v.Value, b: ?*v.Value) i32 {
|
|
114
|
+
var i: usize = 0;
|
|
115
|
+
while (i < 3) : (i += 1) {
|
|
116
|
+
const x = v.asNum(v.at(a, i));
|
|
117
|
+
const y = v.asNum(v.at(b, i));
|
|
118
|
+
if (x != y) return if (x < y) -1 else 1;
|
|
119
|
+
}
|
|
120
|
+
return 0;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
pub fn satisfies(version: ?*v.Value, range: ?*v.Value) t.Err!bool {
|
|
124
|
+
const ver = try parseversion(version);
|
|
125
|
+
const r = try parserange(range);
|
|
126
|
+
return vercmp(ver, v.get(r, "lo")) >= 0 and vercmp(ver, v.get(r, "hi")) < 0;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/// `satisfies` for the internal callers that treat an unparseable
|
|
130
|
+
/// version or range as "does not satisfy" — Capability and Graph, both
|
|
131
|
+
/// of which run over data the corpus has already admitted.
|
|
132
|
+
pub fn satisfiesq(version: ?*v.Value, range: ?*v.Value) bool {
|
|
133
|
+
return satisfies(version, range) catch {
|
|
134
|
+
// TAKE FIRST: the parked diagnostic is discarded deliberately
|
|
135
|
+
// here, and leaving it parked would hand it to the next handler.
|
|
136
|
+
_ = t.take();
|
|
137
|
+
return false;
|
|
138
|
+
};
|
|
139
|
+
}
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
// VENDORED: @voxgig/sekreto sdk-20260908-1556-0 (zig/plugins/aws.zig)
|
|
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 Secrets Manager and SSM Parameter Store - one sekreto plugin,
|
|
5
|
+
//! two kinds: `awssecrets` and `awsparams`.
|
|
6
|
+
//!
|
|
7
|
+
//! Requests are SigV4-signed in-tree (sigv4.zig, beside this file): the
|
|
8
|
+
//! HMAC-SHA256 that needs lives here and not in the core, so a chain
|
|
9
|
+
//! that never names AWS never links a hash function.
|
|
10
|
+
|
|
11
|
+
const std = @import("std");
|
|
12
|
+
|
|
13
|
+
const sekreto = @import("sekreto");
|
|
14
|
+
const httpjson = @import("httpjson.zig");
|
|
15
|
+
const sigv4 = @import("sigv4.zig");
|
|
16
|
+
|
|
17
|
+
const Allocator = std.mem.Allocator;
|
|
18
|
+
const Answer = sekreto.Answer;
|
|
19
|
+
const Found = sekreto.Found;
|
|
20
|
+
const Provider = sekreto.Provider;
|
|
21
|
+
const ProviderSpec = sekreto.ProviderSpec;
|
|
22
|
+
|
|
23
|
+
/// Region and credentials, from config first and the standard AWS_*
|
|
24
|
+
/// environment variables second. Missing either is an error: an AWS store
|
|
25
|
+
/// with no credentials could not answer.
|
|
26
|
+
const AwsAuth = struct {
|
|
27
|
+
region: []const u8,
|
|
28
|
+
keyid: []const u8,
|
|
29
|
+
secret: []const u8,
|
|
30
|
+
session: []const u8,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/// The common half of both AWS providers.
|
|
34
|
+
const Aws = struct {
|
|
35
|
+
config: sekreto.Config,
|
|
36
|
+
region: []const u8,
|
|
37
|
+
keyid: []const u8,
|
|
38
|
+
secret: []const u8,
|
|
39
|
+
session: []const u8,
|
|
40
|
+
addr: []const u8,
|
|
41
|
+
prefix: []const u8,
|
|
42
|
+
|
|
43
|
+
fn auth(self: Aws, alloc: Allocator) Allocator.Error!Answer(AwsAuth) {
|
|
44
|
+
const region = httpjson.firstof(self.config, self.region, &.{ "AWS_REGION", "AWS_DEFAULT_REGION" });
|
|
45
|
+
const keyid = httpjson.firstof(self.config, self.keyid, &.{"AWS_ACCESS_KEY_ID"});
|
|
46
|
+
const secret = httpjson.firstof(self.config, self.secret, &.{"AWS_SECRET_ACCESS_KEY"});
|
|
47
|
+
const session = httpjson.firstof(self.config, self.session, &.{"AWS_SESSION_TOKEN"});
|
|
48
|
+
|
|
49
|
+
if (0 == region.len) {
|
|
50
|
+
return .{ .err = try sekreto.fail(
|
|
51
|
+
alloc,
|
|
52
|
+
"sekreto: aws: no region (set region or AWS_REGION)",
|
|
53
|
+
.{},
|
|
54
|
+
) };
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (0 == keyid.len or 0 == secret.len) {
|
|
58
|
+
return .{ .err = try sekreto.fail(
|
|
59
|
+
alloc,
|
|
60
|
+
"sekreto: aws: no credentials (set keyid/secret or AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY)",
|
|
61
|
+
.{},
|
|
62
|
+
) };
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return .{ .ok = .{ .region = region, .keyid = keyid, .secret = secret, .session = session } };
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/// One signed call to an AWS JSON-1.1 API.
|
|
69
|
+
fn call(
|
|
70
|
+
self: Aws,
|
|
71
|
+
alloc: Allocator,
|
|
72
|
+
service: []const u8,
|
|
73
|
+
target: []const u8,
|
|
74
|
+
payload: []const u8,
|
|
75
|
+
) Allocator.Error!httpjson.Result {
|
|
76
|
+
const credentials = switch (try self.auth(alloc)) {
|
|
77
|
+
.err => |message| return .{ .err = message },
|
|
78
|
+
.ok => |got| got,
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
// The China partition lives under its own suffix; every other
|
|
82
|
+
// commercial region is plain amazonaws.com.
|
|
83
|
+
const suffix: []const u8 = if (std.mem.startsWith(u8, credentials.region, "cn-"))
|
|
84
|
+
".amazonaws.com.cn"
|
|
85
|
+
else
|
|
86
|
+
".amazonaws.com";
|
|
87
|
+
|
|
88
|
+
const addr = if (0 != self.addr.len)
|
|
89
|
+
self.addr
|
|
90
|
+
else
|
|
91
|
+
try std.fmt.allocPrint(alloc, "https://{s}.{s}{s}", .{ service, credentials.region, suffix });
|
|
92
|
+
|
|
93
|
+
switch (try sekreto.checkaddr(alloc, addr)) {
|
|
94
|
+
.err => |message| return .{ .err = message },
|
|
95
|
+
.ok => {},
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const url = try std.fmt.allocPrint(alloc, "{s}/", .{httpjson.trimslash(addr)});
|
|
99
|
+
|
|
100
|
+
const unsigned = [_]sigv4.Pair{
|
|
101
|
+
.{ .name = "content-type", .value = "application/x-amz-json-1.1" },
|
|
102
|
+
.{ .name = "x-amz-target", .value = target },
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const signed = try sigv4.sign(alloc, .{
|
|
106
|
+
.method = "POST",
|
|
107
|
+
.url = url,
|
|
108
|
+
.headers = &unsigned,
|
|
109
|
+
.body = payload,
|
|
110
|
+
.service = service,
|
|
111
|
+
.region = credentials.region,
|
|
112
|
+
.keyid = credentials.keyid,
|
|
113
|
+
.secret = credentials.secret,
|
|
114
|
+
.session = credentials.session,
|
|
115
|
+
.datetime = try awsnow(alloc, self.config.io),
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
var headers: std.ArrayList(httpjson.Header) = .empty;
|
|
119
|
+
for (unsigned) |header| {
|
|
120
|
+
try headers.append(alloc, .{ .name = header.name, .value = header.value });
|
|
121
|
+
}
|
|
122
|
+
for (signed) |header| {
|
|
123
|
+
try headers.append(alloc, .{ .name = header.name, .value = header.value });
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return httpjson.fetchjson(alloc, self.config.io, .POST, url, headers.items, payload);
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
/// The `YYYYMMDDTHHMMSSZ` timestamp SigV4 wants, for now.
|
|
131
|
+
fn awsnow(alloc: Allocator, io: std.Io) Allocator.Error![]const u8 {
|
|
132
|
+
const seconds: u64 = @intCast(@divTrunc(httpjson.nowms(io), 1000));
|
|
133
|
+
|
|
134
|
+
const day = std.time.epoch.EpochSeconds{ .secs = seconds };
|
|
135
|
+
const yearday = day.getEpochDay().calculateYearDay();
|
|
136
|
+
const monthday = yearday.calculateMonthDay();
|
|
137
|
+
const clock = day.getDaySeconds();
|
|
138
|
+
|
|
139
|
+
return std.fmt.allocPrint(alloc, "{d:0>4}{d:0>2}{d:0>2}T{d:0>2}{d:0>2}{d:0>2}Z", .{
|
|
140
|
+
yearday.year,
|
|
141
|
+
monthday.month.numeric(),
|
|
142
|
+
monthday.day_index + 1,
|
|
143
|
+
clock.getHoursIntoDay(),
|
|
144
|
+
clock.getMinutesIntoHour(),
|
|
145
|
+
clock.getSecondsIntoMinute(),
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/// Does this AWS error body name one of the not-found types? Those are a
|
|
150
|
+
/// miss; every other failure is a store that could not answer.
|
|
151
|
+
fn awsmiss(body: ?std.json.Value, want: []const u8) bool {
|
|
152
|
+
const errtype = httpjson.jstr(httpjson.jget(body, "__type")) orelse return false;
|
|
153
|
+
return null != std.mem.indexOf(u8, errtype, want);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/// AWS Secrets Manager.
|
|
157
|
+
///
|
|
158
|
+
/// `api.token` reads the secret named `api` (the vaultref path, so
|
|
159
|
+
/// `db.pass.main` reads `db/pass`) and takes the `token` field of its JSON
|
|
160
|
+
/// SecretString - the AWS idiom of one JSON map per secret. A SecretString
|
|
161
|
+
/// that is not JSON is the value itself, under the conventional field
|
|
162
|
+
/// `value`. Requests are SigV4-signed in-tree; see sigv4.zig.
|
|
163
|
+
pub const AwsSecretsProvider = struct {
|
|
164
|
+
aws: Aws,
|
|
165
|
+
|
|
166
|
+
pub fn lookup(self: *AwsSecretsProvider, alloc: Allocator, name: []const u8) Allocator.Error!Found {
|
|
167
|
+
const ref = switch (try sekreto.vaultref(alloc, name)) {
|
|
168
|
+
.err => |message| return .{ .err = message },
|
|
169
|
+
.ok => |got| got,
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
const payload = try httpjson.jsonobject(alloc, &.{.{ .key = "SecretId", .value = ref.path }});
|
|
173
|
+
|
|
174
|
+
const res = switch (try self.aws.call(alloc, "secretsmanager", "secretsmanager.GetSecretValue", payload)) {
|
|
175
|
+
.err => |message| return .{ .err = message },
|
|
176
|
+
.ok => |got| got,
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
if (400 == res.status and awsmiss(res.body, "ResourceNotFoundException")) {
|
|
180
|
+
return .{ .ok = null };
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (200 != res.status) {
|
|
184
|
+
return .{ .err = try sekreto.fail(
|
|
185
|
+
alloc,
|
|
186
|
+
"sekreto: aws secretsmanager error: {d}",
|
|
187
|
+
.{res.status},
|
|
188
|
+
) };
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
const text = httpjson.jstr(httpjson.jget(res.body, "SecretString")) orelse {
|
|
192
|
+
// A binary secret has no fields to address; only the
|
|
193
|
+
// conventional `value` field can mean "the bytes themselves".
|
|
194
|
+
const binary = httpjson.jstr(httpjson.jget(res.body, "SecretBinary")) orelse return .{ .ok = null };
|
|
195
|
+
if (!std.mem.eql(u8, "value", ref.field)) {
|
|
196
|
+
return .{ .ok = null };
|
|
197
|
+
}
|
|
198
|
+
// A payload that will not decode was reported as null - a
|
|
199
|
+
// MISS - so the chain carried on to a weaker store. A store
|
|
200
|
+
// that answered incoherently could not answer.
|
|
201
|
+
return .{ .ok = try sekreto.unbase64(alloc, binary) orelse
|
|
202
|
+
return .{ .err = try sekreto.fail(alloc, "sekreto: aws secretsmanager: undecodable secret", .{}) } };
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
const parsed = std.json.parseFromSlice(std.json.Value, alloc, text, .{}) catch {
|
|
206
|
+
// A plain-string secret is the whole value; it has no named
|
|
207
|
+
// fields.
|
|
208
|
+
return .{ .ok = if (std.mem.eql(u8, "value", ref.field)) text else null };
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
if (.object == parsed.value) {
|
|
212
|
+
return .{ .ok = httpjson.jstr(httpjson.jget(parsed.value, ref.field)) };
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
return .{ .ok = if (std.mem.eql(u8, "value", ref.field)) text else null };
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
pub fn describe(self: *AwsSecretsProvider, alloc: Allocator) Allocator.Error![]const u8 {
|
|
219
|
+
// sekreto.Config only, never the environment: describe() feeds the spec's
|
|
220
|
+
// sources group, which must answer the same everywhere.
|
|
221
|
+
return std.fmt.allocPrint(alloc, "awssecrets:{s}", .{self.aws.region});
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
pub fn deinit(_: *AwsSecretsProvider, _: Allocator) void {}
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
/// AWS SSM Parameter Store.
|
|
228
|
+
///
|
|
229
|
+
/// `db.pass.main` reads the parameter `/db/pass/main` (under an optional
|
|
230
|
+
/// prefix path), decrypted. Parameter Store carries flat strings, so there
|
|
231
|
+
/// is no field indirection.
|
|
232
|
+
pub const AwsParamsProvider = struct {
|
|
233
|
+
aws: Aws,
|
|
234
|
+
|
|
235
|
+
pub fn lookup(self: *AwsParamsProvider, alloc: Allocator, name: []const u8) Allocator.Error!Found {
|
|
236
|
+
const param = switch (try sekreto.awsparam(alloc, name, self.aws.prefix)) {
|
|
237
|
+
.err => |message| return .{ .err = message },
|
|
238
|
+
.ok => |got| got,
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
const payload = try std.fmt.allocPrint(
|
|
242
|
+
alloc,
|
|
243
|
+
"{{\"Name\":{s},\"WithDecryption\":true}}",
|
|
244
|
+
.{try httpjson.jsonstring(alloc, param)},
|
|
245
|
+
);
|
|
246
|
+
|
|
247
|
+
const res = switch (try self.aws.call(alloc, "ssm", "AmazonSSM.GetParameter", payload)) {
|
|
248
|
+
.err => |message| return .{ .err = message },
|
|
249
|
+
.ok => |got| got,
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
if (400 == res.status and awsmiss(res.body, "ParameterNotFound")) {
|
|
253
|
+
return .{ .ok = null };
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
if (200 != res.status) {
|
|
257
|
+
return .{ .err = try sekreto.fail(alloc, "sekreto: aws ssm error: {d}", .{res.status}) };
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
return .{ .ok = httpjson.jstr(httpjson.jget(httpjson.jget(res.body, "Parameter"), "Value")) };
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
pub fn describe(self: *AwsParamsProvider, alloc: Allocator) Allocator.Error![]const u8 {
|
|
264
|
+
return std.fmt.allocPrint(alloc, "awsparams:{s}{s}", .{ self.aws.region, self.aws.prefix });
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
pub fn deinit(_: *AwsParamsProvider, _: Allocator) void {}
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
fn awsof(config: sekreto.Config, spec: ProviderSpec) Aws {
|
|
271
|
+
return .{
|
|
272
|
+
.config = config,
|
|
273
|
+
.region = spec.region,
|
|
274
|
+
.keyid = spec.keyid,
|
|
275
|
+
.secret = spec.secret,
|
|
276
|
+
.session = spec.session,
|
|
277
|
+
.addr = spec.addr,
|
|
278
|
+
.prefix = spec.prefix,
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
fn makesecrets(alloc: Allocator, config: sekreto.Config, spec: ProviderSpec) Allocator.Error!Answer(Provider) {
|
|
283
|
+
return .{ .ok = try sekreto.provide(alloc, AwsSecretsProvider, .{ .aws = awsof(config, spec) }) };
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
fn makeparams(alloc: Allocator, config: sekreto.Config, spec: ProviderSpec) Allocator.Error!Answer(Provider) {
|
|
287
|
+
return .{ .ok = try sekreto.provide(alloc, AwsParamsProvider, .{ .aws = awsof(config, spec) }) };
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/// The `awssecrets` kind.
|
|
291
|
+
pub const awssecrets: sekreto.Definition = sekreto.providerplugin("awssecrets", makesecrets);
|
|
292
|
+
|
|
293
|
+
/// The `awsparams` kind.
|
|
294
|
+
pub const awsparams: sekreto.Definition = sekreto.providerplugin("awsparams", makeparams);
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
// VENDORED: @voxgig/sekreto sdk-20260908-1556-0 (zig/plugins/azuresecrets.zig)
|
|
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
|
+
//! Azure Key Vault - a sekreto plugin. Needs HTTPS.
|
|
5
|
+
|
|
6
|
+
const std = @import("std");
|
|
7
|
+
|
|
8
|
+
const sekreto = @import("sekreto");
|
|
9
|
+
const httpjson = @import("httpjson.zig");
|
|
10
|
+
|
|
11
|
+
const Allocator = std.mem.Allocator;
|
|
12
|
+
const Answer = sekreto.Answer;
|
|
13
|
+
const Found = sekreto.Found;
|
|
14
|
+
const Provider = sekreto.Provider;
|
|
15
|
+
const ProviderSpec = sekreto.ProviderSpec;
|
|
16
|
+
|
|
17
|
+
/// Azure Key Vault.
|
|
18
|
+
///
|
|
19
|
+
/// `api.token` reads secret `api-token` (dots flattened to `-`; Key Vault
|
|
20
|
+
/// names allow nothing else), current version. The token comes from config,
|
|
21
|
+
/// then a client-credentials login when tenant/clientid/clientsecret are
|
|
22
|
+
/// given, then the IMDS managed-identity endpoint - so on Azure's own
|
|
23
|
+
/// platform no credential configuration is needed.
|
|
24
|
+
///
|
|
25
|
+
/// As with GCP, the IMDS call is plain http to a link-local host by platform
|
|
26
|
+
/// design and carries no credential; the login and vault addresses are
|
|
27
|
+
/// `checkaddr`-guarded.
|
|
28
|
+
pub const AzureSecretsProvider = struct {
|
|
29
|
+
alloc: Allocator,
|
|
30
|
+
config: sekreto.Config,
|
|
31
|
+
vault: []const u8,
|
|
32
|
+
token: []const u8,
|
|
33
|
+
tenant: []const u8,
|
|
34
|
+
clientid: []const u8,
|
|
35
|
+
clientsecret: []const u8,
|
|
36
|
+
loginaddr: []const u8,
|
|
37
|
+
imdsaddr: []const u8,
|
|
38
|
+
apiversion: []const u8,
|
|
39
|
+
livetoken: ?[]const u8,
|
|
40
|
+
renewat: i64,
|
|
41
|
+
|
|
42
|
+
const RESOURCE = "https://vault.azure.net";
|
|
43
|
+
|
|
44
|
+
fn login(self: *AzureSecretsProvider, alloc: Allocator) Allocator.Error!Answer([]const u8) {
|
|
45
|
+
if (0 != self.token.len) {
|
|
46
|
+
return .{ .ok = self.token };
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (0 != self.tenant.len and 0 != self.clientid.len and 0 != self.clientsecret.len) {
|
|
50
|
+
const loginaddr = if (0 != self.loginaddr.len)
|
|
51
|
+
self.loginaddr
|
|
52
|
+
else
|
|
53
|
+
"https://login.microsoftonline.com";
|
|
54
|
+
|
|
55
|
+
switch (try sekreto.checkaddr(alloc, loginaddr)) {
|
|
56
|
+
.err => |message| return .{ .err = message },
|
|
57
|
+
.ok => {},
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const url = try std.fmt.allocPrint(
|
|
61
|
+
alloc,
|
|
62
|
+
"{s}/{s}/oauth2/v2.0/token",
|
|
63
|
+
.{ httpjson.trimslash(loginaddr), self.tenant },
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
const form = try std.fmt.allocPrint(
|
|
67
|
+
alloc,
|
|
68
|
+
"grant_type=client_credentials&client_id={s}&client_secret={s}&scope={s}",
|
|
69
|
+
.{
|
|
70
|
+
try httpjson.escape(alloc, self.clientid),
|
|
71
|
+
try httpjson.escape(alloc, self.clientsecret),
|
|
72
|
+
try httpjson.escape(alloc, RESOURCE ++ "/.default"),
|
|
73
|
+
},
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
const headers = [_]httpjson.Header{
|
|
77
|
+
.{ .name = "content-type", .value = "application/x-www-form-urlencoded" },
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const res = switch (try httpjson.fetchjson(alloc, self.config.io, .POST, url, &headers, form)) {
|
|
81
|
+
.err => |message| return .{ .err = message },
|
|
82
|
+
.ok => |got| got,
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const access = httpjson.jstr(httpjson.jget(res.body, "access_token"));
|
|
86
|
+
|
|
87
|
+
if (200 != res.status or null == access) {
|
|
88
|
+
return .{ .err = try sekreto.fail(
|
|
89
|
+
alloc,
|
|
90
|
+
"sekreto: azure login failed: {d}",
|
|
91
|
+
.{res.status},
|
|
92
|
+
) };
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
self.renewat = httpjson.renewafter(self.config.io, httpjson.jnum(httpjson.jget(res.body, "expires_in")));
|
|
96
|
+
return .{ .ok = access.? };
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const imds = if (0 != self.imdsaddr.len) self.imdsaddr else "http://169.254.169.254";
|
|
100
|
+
|
|
101
|
+
const url = try std.fmt.allocPrint(
|
|
102
|
+
alloc,
|
|
103
|
+
"{s}/metadata/identity/oauth2/token?api-version=2018-02-01&resource={s}",
|
|
104
|
+
.{ httpjson.trimslash(imds), try httpjson.escape(alloc, RESOURCE) },
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
const headers = [_]httpjson.Header{.{ .name = "Metadata", .value = "true" }};
|
|
108
|
+
|
|
109
|
+
const res = switch (try httpjson.fetchjson(alloc, self.config.io, .GET, url, &headers, null)) {
|
|
110
|
+
.err => |message| return .{ .err = message },
|
|
111
|
+
.ok => |got| got,
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const access = httpjson.jstr(httpjson.jget(res.body, "access_token"));
|
|
115
|
+
|
|
116
|
+
if (200 != res.status or null == access) {
|
|
117
|
+
return .{ .err = try sekreto.fail(
|
|
118
|
+
alloc,
|
|
119
|
+
"sekreto: azure: no token, no client credentials, and IMDS did not answer",
|
|
120
|
+
.{},
|
|
121
|
+
) };
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
self.renewat = httpjson.renewafter(self.config.io, httpjson.jnum(httpjson.jget(res.body, "expires_in")));
|
|
125
|
+
return .{ .ok = access.? };
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
pub fn lookup(self: *AzureSecretsProvider, alloc: Allocator, name: []const u8) Allocator.Error!Found {
|
|
129
|
+
if (0 == self.vault.len) {
|
|
130
|
+
return .{ .err = try sekreto.fail(alloc, "sekreto: azure: no vault", .{}) };
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Only an explicit scheme is a URL; a vault NAMED httpvault must
|
|
134
|
+
// still become https://httpvault.vault.azure.net.
|
|
135
|
+
const vaulturl = if (std.mem.startsWith(u8, self.vault, "http://") or
|
|
136
|
+
std.mem.startsWith(u8, self.vault, "https://"))
|
|
137
|
+
self.vault
|
|
138
|
+
else
|
|
139
|
+
try std.fmt.allocPrint(alloc, "https://{s}.vault.azure.net", .{self.vault});
|
|
140
|
+
|
|
141
|
+
switch (try sekreto.checkaddr(alloc, vaulturl)) {
|
|
142
|
+
.err => |message| return .{ .err = message },
|
|
143
|
+
.ok => {},
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (null == self.livetoken or httpjson.nowms(self.config.io) >= self.renewat) {
|
|
147
|
+
const fresh = switch (try self.login(alloc)) {
|
|
148
|
+
.err => |message| return .{ .err = message },
|
|
149
|
+
.ok => |got| got,
|
|
150
|
+
};
|
|
151
|
+
if (self.livetoken) |old| {
|
|
152
|
+
self.alloc.free(old);
|
|
153
|
+
}
|
|
154
|
+
self.livetoken = try self.alloc.dupe(u8, fresh);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
const flat = switch (try sekreto.flatname(alloc, name, "-")) {
|
|
158
|
+
.err => |message| return .{ .err = message },
|
|
159
|
+
.ok => |got| got,
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
const version = if (0 != self.apiversion.len) self.apiversion else "7.4";
|
|
163
|
+
|
|
164
|
+
const url = try std.fmt.allocPrint(
|
|
165
|
+
alloc,
|
|
166
|
+
"{s}/secrets/{s}?api-version={s}",
|
|
167
|
+
.{ httpjson.trimslash(vaulturl), flat, version },
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
const bearer = try std.fmt.allocPrint(alloc, "Bearer {s}", .{self.livetoken.?});
|
|
171
|
+
const headers = [_]httpjson.Header{.{ .name = "authorization", .value = bearer }};
|
|
172
|
+
|
|
173
|
+
const res = switch (try httpjson.fetchjson(alloc, self.config.io, .GET, url, &headers, null)) {
|
|
174
|
+
.err => |message| return .{ .err = message },
|
|
175
|
+
.ok => |got| got,
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
if (404 == res.status) {
|
|
179
|
+
return .{ .ok = null };
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (200 != res.status) {
|
|
183
|
+
return .{ .err = try sekreto.fail(
|
|
184
|
+
alloc,
|
|
185
|
+
"sekreto: azure error: {d}: {s}",
|
|
186
|
+
.{ res.status, httpjson.nakedurl(url) },
|
|
187
|
+
) };
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
return .{ .ok = httpjson.jstr(httpjson.jget(res.body, "value")) };
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
pub fn describe(self: *AzureSecretsProvider, alloc: Allocator) Allocator.Error![]const u8 {
|
|
194
|
+
return std.fmt.allocPrint(alloc, "azuresecrets:{s}", .{self.vault});
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
pub fn deinit(self: *AzureSecretsProvider, alloc: Allocator) void {
|
|
198
|
+
if (self.livetoken) |token| {
|
|
199
|
+
alloc.free(token);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
fn make(alloc: Allocator, config: sekreto.Config, spec: ProviderSpec) Allocator.Error!Answer(Provider) {
|
|
205
|
+
return .{ .ok = try sekreto.provide(alloc, AzureSecretsProvider, .{
|
|
206
|
+
.alloc = alloc,
|
|
207
|
+
.config = config,
|
|
208
|
+
.vault = spec.vault,
|
|
209
|
+
.token = spec.token,
|
|
210
|
+
.tenant = spec.tenant,
|
|
211
|
+
.clientid = spec.clientid,
|
|
212
|
+
.clientsecret = spec.clientsecret,
|
|
213
|
+
.loginaddr = spec.loginaddr,
|
|
214
|
+
.imdsaddr = spec.imdsaddr,
|
|
215
|
+
.apiversion = spec.apiversion,
|
|
216
|
+
.livetoken = null,
|
|
217
|
+
.renewat = httpjson.NEVER,
|
|
218
|
+
}) };
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/// The `azuresecrets` kind.
|
|
222
|
+
pub const azuresecrets: sekreto.Definition = sekreto.providerplugin("azuresecrets", make);
|