@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,613 @@
|
|
|
1
|
+
// VENDORED: @voxgig/sekreto sdk-20260908-1556-0 (cpp/src/Sekreto.cpp)
|
|
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
|
+
#include "Sekreto.hpp"
|
|
5
|
+
|
|
6
|
+
#include <algorithm>
|
|
7
|
+
|
|
8
|
+
#include "Providers.hpp"
|
|
9
|
+
#include "../plugin/ref.hpp"
|
|
10
|
+
#include "../plugin/types.hpp"
|
|
11
|
+
|
|
12
|
+
namespace sekreto {
|
|
13
|
+
|
|
14
|
+
std::string asciiupper(const std::string& text) {
|
|
15
|
+
std::string out = text;
|
|
16
|
+
for (char& ch : out) {
|
|
17
|
+
if ('a' <= ch && 'z' >= ch) ch = static_cast<char>(ch - 32);
|
|
18
|
+
}
|
|
19
|
+
return out;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
std::string asciilower(const std::string& text) {
|
|
23
|
+
std::string out = text;
|
|
24
|
+
for (char& ch : out) {
|
|
25
|
+
if ('A' <= ch && 'Z' >= ch) ch = static_cast<char>(ch + 32);
|
|
26
|
+
}
|
|
27
|
+
return out;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
std::vector<std::string> segments(const std::string& name) {
|
|
31
|
+
std::vector<std::string> out;
|
|
32
|
+
size_t start = 0;
|
|
33
|
+
|
|
34
|
+
while (true) {
|
|
35
|
+
size_t at = name.find('.', start);
|
|
36
|
+
if (std::string::npos == at) {
|
|
37
|
+
out.push_back(name.substr(start));
|
|
38
|
+
return out;
|
|
39
|
+
}
|
|
40
|
+
out.push_back(name.substr(start, at - start));
|
|
41
|
+
start = at + 1;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Scanned character by character rather than matched against
|
|
46
|
+
// `^[a-z0-9_]+$`: in most regex dialects `$` also matches before a final
|
|
47
|
+
// newline, so `api.token\n` would pass - and the spec pins that exact
|
|
48
|
+
// case, along with `api.token\r` and `api\n.token`.
|
|
49
|
+
bool validname(const std::string& name) {
|
|
50
|
+
if (name.empty()) return false;
|
|
51
|
+
|
|
52
|
+
for (const std::string& part : segments(name)) {
|
|
53
|
+
if (part.empty()) return false;
|
|
54
|
+
|
|
55
|
+
for (unsigned char ch : part) {
|
|
56
|
+
bool ok = ('a' <= ch && 'z' >= ch) || ('0' <= ch && '9' >= ch) || '_' == ch;
|
|
57
|
+
if (!ok) return false;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
bool validname(const Json& name) {
|
|
65
|
+
if (!name.isstr()) return false;
|
|
66
|
+
return validname(name.strval);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
Name checkname(const std::string& name) {
|
|
70
|
+
if (!validname(name)) {
|
|
71
|
+
throw SekretoError("sekreto: invalid name: " + name);
|
|
72
|
+
}
|
|
73
|
+
return name;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
Name checkname(const Json& name) {
|
|
77
|
+
if (!validname(name)) {
|
|
78
|
+
// Null and absent both render as the empty string, so the message ends
|
|
79
|
+
// with a trailing space.
|
|
80
|
+
std::string shown;
|
|
81
|
+
if (!name.text(shown)) shown = "";
|
|
82
|
+
throw SekretoError("sekreto: invalid name: " + shown);
|
|
83
|
+
}
|
|
84
|
+
return name.strval;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
std::string envkey(const std::string& name, const std::string& prefix) {
|
|
88
|
+
std::string checked = checkname(name);
|
|
89
|
+
std::string flat;
|
|
90
|
+
|
|
91
|
+
for (size_t index = 0; index < checked.size(); index++) {
|
|
92
|
+
flat.push_back('.' == checked[index] ? '_' : checked[index]);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return prefix + asciiupper(flat);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
VaultRef vaultref(const std::string& name) {
|
|
99
|
+
std::vector<std::string> parts = segments(checkname(name));
|
|
100
|
+
|
|
101
|
+
if (1 == parts.size()) {
|
|
102
|
+
return VaultRef{parts[0], "value"};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
std::string path;
|
|
106
|
+
for (size_t index = 0; index + 1 < parts.size(); index++) {
|
|
107
|
+
if (0 < index) path += "/";
|
|
108
|
+
path += parts[index];
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return VaultRef{path, parts[parts.size() - 1]};
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
std::string flatname(const std::string& name, const std::string& sep) {
|
|
115
|
+
std::vector<std::string> parts = segments(checkname(name));
|
|
116
|
+
|
|
117
|
+
std::string flat;
|
|
118
|
+
for (size_t index = 0; index < parts.size(); index++) {
|
|
119
|
+
if (0 < index) flat += sep;
|
|
120
|
+
flat += parts[index];
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if ("-" == sep) {
|
|
124
|
+
for (char& ch : flat) {
|
|
125
|
+
if ('_' == ch) ch = '-';
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return flat;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
std::string awsparam(const std::string& name, const std::string& prefix) {
|
|
133
|
+
std::string checked = checkname(name);
|
|
134
|
+
|
|
135
|
+
std::string base = prefix;
|
|
136
|
+
if (!base.empty() && '/' != base[0]) base = "/" + base;
|
|
137
|
+
if (!base.empty() && '/' == base[base.size() - 1]) base = base.substr(0, base.size() - 1);
|
|
138
|
+
|
|
139
|
+
std::string tail;
|
|
140
|
+
for (const std::string& part : segments(checked)) {
|
|
141
|
+
tail += "/" + part;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return base + tail;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
namespace {
|
|
148
|
+
|
|
149
|
+
/// The `.env` parser's own trim, which also takes `\f` and `\v` - a WIDER
|
|
150
|
+
/// set than Providers.hpp's `trimtext`, and the spec pins what it produces,
|
|
151
|
+
/// so the two stay separate rather than being merged into whichever is
|
|
152
|
+
/// nearer to hand.
|
|
153
|
+
std::string trimdotenv(const std::string& text) {
|
|
154
|
+
size_t start = 0;
|
|
155
|
+
size_t stop = text.size();
|
|
156
|
+
|
|
157
|
+
while (start < stop) {
|
|
158
|
+
char ch = text[start];
|
|
159
|
+
if (' ' == ch || '\t' == ch || '\n' == ch || '\r' == ch || '\f' == ch || '\v' == ch) {
|
|
160
|
+
start++;
|
|
161
|
+
} else {
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
while (stop > start) {
|
|
167
|
+
char ch = text[stop - 1];
|
|
168
|
+
if (' ' == ch || '\t' == ch || '\n' == ch || '\r' == ch || '\f' == ch || '\v' == ch) {
|
|
169
|
+
stop--;
|
|
170
|
+
} else {
|
|
171
|
+
break;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
return text.substr(start, stop - start);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/// Unescape a double-quoted `.env` value. An escape this does not know is
|
|
179
|
+
/// preserved whole - backslash and all - rather than swallowed, and a
|
|
180
|
+
/// trailing backslash is literal. A scan, not a chain of replacements,
|
|
181
|
+
/// because `\\n` is a literal backslash followed by an n.
|
|
182
|
+
std::string unescape(const std::string& text) {
|
|
183
|
+
std::string out;
|
|
184
|
+
size_t index = 0;
|
|
185
|
+
|
|
186
|
+
while (index < text.size()) {
|
|
187
|
+
if ('\\' == text[index] && index + 1 < text.size()) {
|
|
188
|
+
char next = text[index + 1];
|
|
189
|
+
index += 2;
|
|
190
|
+
switch (next) {
|
|
191
|
+
case 'n': out.push_back('\n'); break;
|
|
192
|
+
case 'r': out.push_back('\r'); break;
|
|
193
|
+
case 't': out.push_back('\t'); break;
|
|
194
|
+
case '\\': out.push_back('\\'); break;
|
|
195
|
+
case '"': out.push_back('"'); break;
|
|
196
|
+
default:
|
|
197
|
+
out.push_back('\\');
|
|
198
|
+
out.push_back(next);
|
|
199
|
+
}
|
|
200
|
+
} else {
|
|
201
|
+
out.push_back(text[index]);
|
|
202
|
+
index++;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
return out;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
} // namespace
|
|
210
|
+
|
|
211
|
+
Ordered parsedotenv(const std::string& text) {
|
|
212
|
+
Ordered out;
|
|
213
|
+
|
|
214
|
+
size_t start = 0;
|
|
215
|
+
|
|
216
|
+
while (start <= text.size()) {
|
|
217
|
+
size_t at = text.find('\n', start);
|
|
218
|
+
std::string rawline =
|
|
219
|
+
(std::string::npos == at) ? text.substr(start) : text.substr(start, at - start);
|
|
220
|
+
|
|
221
|
+
if (!rawline.empty() && '\r' == rawline[rawline.size() - 1]) {
|
|
222
|
+
rawline = rawline.substr(0, rawline.size() - 1);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
std::string line = trimdotenv(rawline);
|
|
226
|
+
|
|
227
|
+
// A `#` INSIDE a value is not a comment; only a line that opens with
|
|
228
|
+
// one is.
|
|
229
|
+
if (!line.empty() && '#' != line[0]) {
|
|
230
|
+
std::string body = line;
|
|
231
|
+
if (0 == body.compare(0, 7, "export ")) {
|
|
232
|
+
body = trimdotenv(body.substr(7));
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
size_t eq = body.find('=');
|
|
236
|
+
|
|
237
|
+
// Both "no =" and "empty key" are skipped, silently, without
|
|
238
|
+
// disturbing the lines around them.
|
|
239
|
+
if (std::string::npos != eq && 0 < eq) {
|
|
240
|
+
std::string key = trimdotenv(body.substr(0, eq));
|
|
241
|
+
std::string value = trimdotenv(body.substr(eq + 1));
|
|
242
|
+
|
|
243
|
+
if (2 <= value.size() && '"' == value[0] && '"' == value[value.size() - 1]) {
|
|
244
|
+
value = unescape(value.substr(1, value.size() - 2));
|
|
245
|
+
} else if (2 <= value.size() && '\'' == value[0] && '\'' == value[value.size() - 1]) {
|
|
246
|
+
value = value.substr(1, value.size() - 2);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
out.set(key, value);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
if (std::string::npos == at) break;
|
|
254
|
+
start = at + 1;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
return out;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
Ordered parsedotenv(const Json& text) {
|
|
261
|
+
if (!text.isstr()) return Ordered();
|
|
262
|
+
return parsedotenv(text.strval);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
std::string redact(const std::string& text, const std::vector<std::string>& values) {
|
|
266
|
+
std::string out = text;
|
|
267
|
+
|
|
268
|
+
// A COPY is sorted: `values` belongs to the caller (it is `seen` when
|
|
269
|
+
// called through Sekreto::redact), and sorting in place would reorder the
|
|
270
|
+
// live redaction history.
|
|
271
|
+
//
|
|
272
|
+
// Longest first, always: a shorter value that is a prefix of a longer one
|
|
273
|
+
// would otherwise redact half of it and leave the rest in the log.
|
|
274
|
+
// Stably, so two values of the same length are redacted in arrival order
|
|
275
|
+
// rather than in an order that varies between runs.
|
|
276
|
+
std::vector<std::string> usable;
|
|
277
|
+
for (const std::string& value : values) {
|
|
278
|
+
if (4 <= value.size()) usable.push_back(value);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
std::stable_sort(usable.begin(), usable.end(),
|
|
282
|
+
[](const std::string& left, const std::string& right) {
|
|
283
|
+
return left.size() > right.size();
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
for (const std::string& value : usable) {
|
|
287
|
+
// A literal replace-all, never a regex: a secret containing regex
|
|
288
|
+
// metacharacters must not be interpreted as a pattern.
|
|
289
|
+
std::string next;
|
|
290
|
+
size_t start = 0;
|
|
291
|
+
|
|
292
|
+
while (true) {
|
|
293
|
+
size_t at = out.find(value, start);
|
|
294
|
+
if (std::string::npos == at) {
|
|
295
|
+
next += out.substr(start);
|
|
296
|
+
break;
|
|
297
|
+
}
|
|
298
|
+
next += out.substr(start, at - start);
|
|
299
|
+
next += "[redacted]";
|
|
300
|
+
start = at + value.size();
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
out = next;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
return out;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
std::string storename(const Provider& provider) {
|
|
310
|
+
std::string text = provider.describe();
|
|
311
|
+
size_t at = text.find(':');
|
|
312
|
+
return (std::string::npos == at) ? text : text.substr(0, at);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
namespace {
|
|
316
|
+
|
|
317
|
+
/// The message for a kind the catalog does not hold.
|
|
318
|
+
///
|
|
319
|
+
/// A kind sekreto has never heard of is a typo; a kind that exists as a
|
|
320
|
+
/// plugin but was not passed in is the split working as designed and
|
|
321
|
+
/// telling you what to pass. Collapsing the two was the first thing that
|
|
322
|
+
/// made the split confusing to use.
|
|
323
|
+
std::string unknownkind(const std::string& kind, const plugin::Catalog& catalog) {
|
|
324
|
+
std::string available;
|
|
325
|
+
plugin::V names = catalog.names();
|
|
326
|
+
|
|
327
|
+
for (size_t index = 0; index < plugin::len(names); index++) {
|
|
328
|
+
if (0 < index) available += ", ";
|
|
329
|
+
available += plugin::asstr(plugin::at(names, index));
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
std::string out =
|
|
333
|
+
"sekreto: unknown provider kind: " + kind + " (available: " + available + ")";
|
|
334
|
+
|
|
335
|
+
for (const std::string& shipped : KINDS().plugin) {
|
|
336
|
+
if (shipped == kind) {
|
|
337
|
+
return out + " - " + kind +
|
|
338
|
+
" is a sekreto plugin, not built in: pass it in the plugins option";
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
return out;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
} // namespace
|
|
346
|
+
|
|
347
|
+
Sekreto::Sekreto(const SekretoOptions& options)
|
|
348
|
+
: catalog_(plugin::makecatalog()), docache_(options.cache) {
|
|
349
|
+
// Built-ins first, then the plugins, into one catalog: a plugin that
|
|
350
|
+
// names a built-in kind replaces it, which is how a host substitutes an
|
|
351
|
+
// implementation and never an accident, because the four names are
|
|
352
|
+
// documented.
|
|
353
|
+
for (const Definition& def : builtins()) catalog_->add(def);
|
|
354
|
+
for (const Definition& def : options.plugins) {
|
|
355
|
+
if (nullptr == def) {
|
|
356
|
+
// C++ has no module to pass by mistake, but a default-constructed
|
|
357
|
+
// Definition is the same shape of error and would otherwise reach the
|
|
358
|
+
// catalog as `plugin_definition_name`.
|
|
359
|
+
throw SekretoError("sekreto: not a plugin definition: nothing"
|
|
360
|
+
" - pass the definition providerplugin returned");
|
|
361
|
+
}
|
|
362
|
+
catalog_->add(def);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
plugin::HostOptions hostopts;
|
|
366
|
+
hostopts.catalog = catalog_;
|
|
367
|
+
host_ = plugin::makehost(hostopts);
|
|
368
|
+
|
|
369
|
+
for (const ProviderSpec& spec : options.providers) {
|
|
370
|
+
entries_.push_back(declare(spec));
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
Sekreto::Sekreto(std::vector<std::shared_ptr<Provider>> providers,
|
|
375
|
+
std::vector<std::string> names, bool docache)
|
|
376
|
+
: catalog_(plugin::makecatalog()), docache_(docache) {
|
|
377
|
+
for (const Definition& def : builtins()) catalog_->add(def);
|
|
378
|
+
|
|
379
|
+
plugin::HostOptions hostopts;
|
|
380
|
+
hostopts.catalog = catalog_;
|
|
381
|
+
host_ = plugin::makehost(hostopts);
|
|
382
|
+
|
|
383
|
+
for (size_t index = 0; index < providers.size(); index++) {
|
|
384
|
+
std::string store = index < names.size() ? names[index] : "";
|
|
385
|
+
// An empty name falls back to the provider's kind.
|
|
386
|
+
if (store.empty()) store = storename(*providers[index]);
|
|
387
|
+
entries_.push_back(Entry{store, "", providers[index]});
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
/// One chain entry, as a plugin instance.
|
|
392
|
+
///
|
|
393
|
+
/// The instance is `kind` for a store named after its kind and
|
|
394
|
+
/// `kind$store` otherwise - `hashicorp$prod` - so `host().list()` reads
|
|
395
|
+
/// like the chain. A store name that is already taken gets a numbered tag
|
|
396
|
+
/// from the host instead, because two providers MAY share a store name (a
|
|
397
|
+
/// directed read walks both) and an instance ref may not.
|
|
398
|
+
Sekreto::Entry Sekreto::declare(const ProviderSpec& spec) {
|
|
399
|
+
const std::string& kind = spec.kind;
|
|
400
|
+
|
|
401
|
+
if (!catalog_->has(kind)) {
|
|
402
|
+
throw SekretoError(unknownkind(kind, *catalog_));
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
std::string store = first(spec.name, kind);
|
|
406
|
+
|
|
407
|
+
if (!plugin::checktag(plugin::vstr(store))) {
|
|
408
|
+
throw SekretoError("sekreto: invalid store name: " + store);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
std::string ref =
|
|
412
|
+
(store == kind) ? kind : plugin::formatref(plugin::vstr(kind), plugin::vstr(store));
|
|
413
|
+
|
|
414
|
+
if (nullptr != host_->instance(ref)) ref = host_->autotag(kind);
|
|
415
|
+
|
|
416
|
+
plugin::DeclareSpec declaration;
|
|
417
|
+
declaration.definition = kind;
|
|
418
|
+
declaration.options = optionsof(spec);
|
|
419
|
+
|
|
420
|
+
// A provider built by a `define` that then fails to go live would sit in
|
|
421
|
+
// its slot for ever; the mark is where to discard back to.
|
|
422
|
+
double mark = providermark();
|
|
423
|
+
|
|
424
|
+
try {
|
|
425
|
+
// `load` runs the definition's `define`, which builds the provider from
|
|
426
|
+
// the spec; `activate` takes the instance live. Nothing is contacted by
|
|
427
|
+
// either: a provider opens nothing until its first lookup.
|
|
428
|
+
host_->load(ref, declaration);
|
|
429
|
+
host_->activate(ref);
|
|
430
|
+
} catch (const plugin::PluginError& err) {
|
|
431
|
+
providerdiscard(mark);
|
|
432
|
+
|
|
433
|
+
// A SekretoError that crossed the boundary comes back out as itself,
|
|
434
|
+
// byte for byte. Anything else is not sekreto's to rewrite.
|
|
435
|
+
if (ERROR_CODE == err.code) {
|
|
436
|
+
throw SekretoError(plugin::asstr(plugin::get(err.details, "cause")));
|
|
437
|
+
}
|
|
438
|
+
throw;
|
|
439
|
+
} catch (...) {
|
|
440
|
+
providerdiscard(mark);
|
|
441
|
+
throw;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
plugin::V ticket = host_->exports(ref + "/" + PROVIDER_EXPORT);
|
|
445
|
+
std::shared_ptr<Provider> provider =
|
|
446
|
+
plugin::isnum(ticket) ? takeprovider(plugin::asnum(ticket)) : nullptr;
|
|
447
|
+
|
|
448
|
+
if (nullptr == provider) {
|
|
449
|
+
providerdiscard(mark);
|
|
450
|
+
throw SekretoError("sekreto: plugin " + kind + " exported no provider");
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
return Entry{store, ref, provider};
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
std::string Sekreto::get(const Name& name) {
|
|
457
|
+
std::optional<std::string> found = tryget(name);
|
|
458
|
+
|
|
459
|
+
if (!found.has_value()) {
|
|
460
|
+
throw SekretoError("sekreto: unknown secret: " + name);
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
return found.value();
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
std::optional<std::string> Sekreto::tryget(const Name& name) {
|
|
467
|
+
return resolve("", name, entries_);
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
std::string Sekreto::getfrom(const std::string& store, const Name& name) {
|
|
471
|
+
std::optional<std::string> found = tryfrom(store, name);
|
|
472
|
+
|
|
473
|
+
if (!found.has_value()) {
|
|
474
|
+
throw SekretoError("sekreto: unknown secret: " + store + ":" + name);
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
return found.value();
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
std::optional<std::string> Sekreto::tryfrom(const std::string& store, const Name& name) {
|
|
481
|
+
std::vector<Entry> matching;
|
|
482
|
+
|
|
483
|
+
for (const Entry& entry : entries_) {
|
|
484
|
+
if (store == entry.store) matching.push_back(entry);
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
// Naming a store that is not in the chain is an error, not a miss:
|
|
488
|
+
// `tryget` already means "this store may not have it", so it cannot also
|
|
489
|
+
// mean "this store may not exist" without hiding a typo. Raised BEFORE
|
|
490
|
+
// the name is validated.
|
|
491
|
+
if (matching.empty()) {
|
|
492
|
+
throw SekretoError("sekreto: unknown store: " + store);
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
return resolve(store, name, matching);
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
std::optional<std::string> Sekreto::resolve(const std::string& store, const Name& name,
|
|
499
|
+
const std::vector<Entry>& useentries) {
|
|
500
|
+
// The name is validated first: before the cache, and before any provider
|
|
501
|
+
// is asked.
|
|
502
|
+
checkname(name);
|
|
503
|
+
|
|
504
|
+
if (docache_) {
|
|
505
|
+
for (const Cached& hit : cache_) {
|
|
506
|
+
if (store == hit.store && name == hit.name) return hit.value;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
for (const Entry& entry : useentries) {
|
|
511
|
+
// A provider that throws is not caught: a store that could not answer
|
|
512
|
+
// must not read as a store that does not hold the secret.
|
|
513
|
+
std::optional<std::string> found = entry.provider->lookup(name);
|
|
514
|
+
|
|
515
|
+
if (found.has_value()) {
|
|
516
|
+
if (docache_) cache_.push_back(Cached{store, name, found.value()});
|
|
517
|
+
seen_.push_back(found.value());
|
|
518
|
+
return found;
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
// A miss is never cached: the secret may arrive later.
|
|
523
|
+
return std::nullopt;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
bool Sekreto::has(const Name& name) { return tryget(name).has_value(); }
|
|
527
|
+
|
|
528
|
+
bool Sekreto::hasin(const std::string& store, const Name& name) {
|
|
529
|
+
return tryfrom(store, name).has_value();
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
Ordered Sekreto::all(const std::vector<Name>& names) {
|
|
533
|
+
Ordered out;
|
|
534
|
+
|
|
535
|
+
for (const Name& name : names) {
|
|
536
|
+
out.set(name, get(name));
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
return out;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
std::vector<std::string> Sekreto::sources() const {
|
|
543
|
+
std::vector<std::string> out;
|
|
544
|
+
|
|
545
|
+
for (const Entry& entry : entries_) {
|
|
546
|
+
out.push_back(entry.provider->describe());
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
return out;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
std::vector<std::string> Sekreto::stores() const {
|
|
553
|
+
std::vector<std::string> out;
|
|
554
|
+
|
|
555
|
+
for (const Entry& entry : entries_) {
|
|
556
|
+
bool seen = false;
|
|
557
|
+
for (const std::string& already : out) {
|
|
558
|
+
if (already == entry.store) seen = true;
|
|
559
|
+
}
|
|
560
|
+
if (!seen) out.push_back(entry.store);
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
return out;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
std::string Sekreto::redact(const std::string& text) const {
|
|
567
|
+
return sekreto::redact(text, seen_);
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
void Sekreto::refresh() { cache_.clear(); }
|
|
571
|
+
|
|
572
|
+
void Sekreto::close() {
|
|
573
|
+
// The host's own teardown: every instance is deactivated and unloaded,
|
|
574
|
+
// in reverse. `seen_` is untouched, so redaction still knows every value
|
|
575
|
+
// this chain ever resolved.
|
|
576
|
+
host_->close();
|
|
577
|
+
entries_.clear();
|
|
578
|
+
cache_.clear();
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
std::string Sekreto::str() const {
|
|
582
|
+
std::string out = "Sekreto { stores: [ ";
|
|
583
|
+
std::vector<std::string> names = stores();
|
|
584
|
+
|
|
585
|
+
for (size_t index = 0; index < names.size(); index++) {
|
|
586
|
+
if (0 < index) out += ", ";
|
|
587
|
+
out += names[index];
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
return out + " ] }";
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
Json Sekreto::tojson() const {
|
|
594
|
+
std::vector<Json> names;
|
|
595
|
+
|
|
596
|
+
for (const std::string& store : stores()) {
|
|
597
|
+
names.push_back(Json::str(store));
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
return Json::obj({{"stores", Json::arr(names)}});
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
Sekreto makesekreto(const std::vector<ProviderSpec>& specs,
|
|
604
|
+
const std::vector<Definition>& plugins, bool cache) {
|
|
605
|
+
SekretoOptions options;
|
|
606
|
+
options.providers = specs;
|
|
607
|
+
options.plugins = plugins;
|
|
608
|
+
options.cache = cache;
|
|
609
|
+
|
|
610
|
+
return Sekreto(options);
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
} // namespace sekreto
|