@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,479 @@
|
|
|
1
|
+
-- VENDORED: @voxgig/sekreto sdk-20260908-1556-0 (lua/src/sekreto.lua)
|
|
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
|
+
-- sekreto: one interface for secrets, wherever they live.
|
|
5
|
+
--
|
|
6
|
+
-- A Sekreto is an ordered chain of providers. `get` asks each in turn and
|
|
7
|
+
-- returns the first hit, so an app can be configured from environment
|
|
8
|
+
-- variables in development and a vault in production without changing a
|
|
9
|
+
-- line of its own code.
|
|
10
|
+
--
|
|
11
|
+
-- This module is the whole core surface: the facade, the pure name
|
|
12
|
+
-- functions (re-exported from sekreto.name, which the providers need
|
|
13
|
+
-- too), the error type, and the four built-in provider kinds.
|
|
14
|
+
--
|
|
15
|
+
-- THE CORE REQUIRES NO PROVIDER THAT OPENS A SOCKET, SPAWNS A PROCESS OR
|
|
16
|
+
-- SIGNS A REQUEST. The four built-in kinds - env, memory, dotenv, file -
|
|
17
|
+
-- read at most a local file; every other kind is a voxgig/plugin
|
|
18
|
+
-- definition under sekreto/plugins/, and a chain may name one only if the
|
|
19
|
+
-- calling project handed it in through `plugins`:
|
|
20
|
+
--
|
|
21
|
+
-- local sekreto = require('sekreto')
|
|
22
|
+
-- local hashicorp = require('feature.secrets.sekreto.plugins.hashicorp').hashicorp
|
|
23
|
+
--
|
|
24
|
+
-- local secrets = sekreto.sekreto({
|
|
25
|
+
-- plugins = { hashicorp },
|
|
26
|
+
-- providers = {
|
|
27
|
+
-- { kind = 'env' },
|
|
28
|
+
-- { kind = 'hashicorp', addr = addr, token = token },
|
|
29
|
+
-- },
|
|
30
|
+
-- })
|
|
31
|
+
--
|
|
32
|
+
-- or, for every kind at once, `allplugins` from `sekreto.plugins`. See
|
|
33
|
+
-- docs/design/plugin-providers.md.
|
|
34
|
+
--
|
|
35
|
+
-- A port of typescript/src/Sekreto.ts, which is canonical.
|
|
36
|
+
|
|
37
|
+
local plugin = require('feature.secrets.plugin')
|
|
38
|
+
|
|
39
|
+
local err = require('feature.secrets.sekreto.err')
|
|
40
|
+
local name = require('feature.secrets.sekreto.name')
|
|
41
|
+
local addr = require('feature.secrets.sekreto.addr')
|
|
42
|
+
local providers = require('feature.secrets.sekreto.providers')
|
|
43
|
+
|
|
44
|
+
local M = {}
|
|
45
|
+
|
|
46
|
+
-- ---------------------------------------------------------- re-exports
|
|
47
|
+
|
|
48
|
+
M.SekretoError = err.SekretoError
|
|
49
|
+
M.issekretoerror = err.issekretoerror
|
|
50
|
+
M.errmessage = err.message
|
|
51
|
+
|
|
52
|
+
M.validname = name.validname
|
|
53
|
+
M.checkname = name.checkname
|
|
54
|
+
M.envkey = name.envkey
|
|
55
|
+
M.vaultref = name.vaultref
|
|
56
|
+
M.flatname = name.flatname
|
|
57
|
+
M.awsparam = name.awsparam
|
|
58
|
+
M.parsedotenv = name.parsedotenv
|
|
59
|
+
M.redact = name.redact
|
|
60
|
+
M.storename = name.storename
|
|
61
|
+
|
|
62
|
+
M.checkaddr = addr.checkaddr
|
|
63
|
+
M.safeaddr = addr.safeaddr
|
|
64
|
+
|
|
65
|
+
M.spec = providers.spec
|
|
66
|
+
M.authspec = providers.authspec
|
|
67
|
+
|
|
68
|
+
-- The plugin bridge, and the four kinds built on it. `providerplugin` is
|
|
69
|
+
-- how a calling project adds a fifth.
|
|
70
|
+
M.providerplugin = providers.providerplugin
|
|
71
|
+
M.BUILTINS = providers.BUILTINS
|
|
72
|
+
M.KINDS = providers.KINDS
|
|
73
|
+
M.PROVIDER_EXPORT = providers.PROVIDER_EXPORT
|
|
74
|
+
M.ERROR_CODE = providers.ERROR_CODE
|
|
75
|
+
|
|
76
|
+
-- ------------------------------------------------------------- the type
|
|
77
|
+
|
|
78
|
+
local Sekreto = {}
|
|
79
|
+
Sekreto.__index = Sekreto
|
|
80
|
+
|
|
81
|
+
--- The stores this Sekreto can be asked by name, without repeats.
|
|
82
|
+
--- Defined before the print hooks, which are the only reason it needs to
|
|
83
|
+
--- come first.
|
|
84
|
+
function Sekreto:stores()
|
|
85
|
+
local out = {}
|
|
86
|
+
local seen = {}
|
|
87
|
+
|
|
88
|
+
for _, entry in ipairs(self.entries) do
|
|
89
|
+
if nil == seen[entry.store] then
|
|
90
|
+
seen[entry.store] = true
|
|
91
|
+
out[#out + 1] = entry.store
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
return out
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
-- Print hooks, and they are not optional. `cache` and `seen` are
|
|
99
|
+
-- ordinary fields, so anything that walks or prints a Sekreto - a
|
|
100
|
+
-- debugger, a logging helper, an error formatter - would otherwise emit
|
|
101
|
+
-- every secret ever resolved. Neither hook reaches a value.
|
|
102
|
+
Sekreto.__tostring = function(self)
|
|
103
|
+
return 'Sekreto { stores: [ ' .. table.concat(self:stores(), ', ') .. ' ] }'
|
|
104
|
+
end
|
|
105
|
+
Sekreto.__name = 'Sekreto'
|
|
106
|
+
|
|
107
|
+
--- The JSON-shaped form: the store names, and nothing else.
|
|
108
|
+
function Sekreto:tojson()
|
|
109
|
+
return { stores = self:stores() }
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
-- ------------------------------------------------------- the plugin seam
|
|
113
|
+
|
|
114
|
+
--- Is this a voxgig/plugin definition?
|
|
115
|
+
local function isdefinition(value)
|
|
116
|
+
return 'table' == type(value) and 'string' == type(value.name)
|
|
117
|
+
and 'function' == type(value.define)
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
--- The name a table is loaded under, when it is a module.
|
|
121
|
+
---
|
|
122
|
+
--- Lua gives a module no identity of its own, so the registry is asked.
|
|
123
|
+
--- It is only ever consulted on the error path below, where naming the
|
|
124
|
+
--- module is the whole point of the message.
|
|
125
|
+
local function modulename(value)
|
|
126
|
+
for key, loaded in pairs(package.loaded) do
|
|
127
|
+
if loaded == value then
|
|
128
|
+
return key
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
return nil
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
--- A plugin entry, checked to be a definition before the catalog sees it.
|
|
135
|
+
---
|
|
136
|
+
--- `require('feature.secrets.sekreto.plugins.hashicorp')` hands back the MODULE, and the
|
|
137
|
+
--- definition is one field further on - so the thing nearest to hand is
|
|
138
|
+
--- not a definition, and a module in the catalog would fail deep inside
|
|
139
|
+
--- voxgig/plugin with a message about a definition name. Refused here
|
|
140
|
+
--- instead, naming the module and what to pass out of it.
|
|
141
|
+
local function definition(entry)
|
|
142
|
+
if isdefinition(entry) then
|
|
143
|
+
return entry
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
local modname = ('table' == type(entry)) and modulename(entry) or nil
|
|
147
|
+
|
|
148
|
+
if nil ~= modname then
|
|
149
|
+
-- What the module holds that could have been meant: a definition, or
|
|
150
|
+
-- a list of them.
|
|
151
|
+
local holds = {}
|
|
152
|
+
for key, value in pairs(entry) do
|
|
153
|
+
if isdefinition(value) or
|
|
154
|
+
('table' == type(value) and isdefinition(value[1]))
|
|
155
|
+
then
|
|
156
|
+
holds[#holds + 1] = key
|
|
157
|
+
end
|
|
158
|
+
end
|
|
159
|
+
table.sort(holds)
|
|
160
|
+
|
|
161
|
+
if 0 < #holds then
|
|
162
|
+
err.fail('sekreto: not a plugin definition: the module ' .. modname ..
|
|
163
|
+
" - pass a definition it holds, such as require('" .. modname ..
|
|
164
|
+
"')." .. holds[1])
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
err.fail('sekreto: not a plugin definition: the module ' .. modname)
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
err.fail('sekreto: not a plugin definition: ' .. tostring(entry))
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
--- The message for a kind the catalog does not hold.
|
|
174
|
+
---
|
|
175
|
+
--- A kind sekreto has never heard of is a typo; a kind that exists as a
|
|
176
|
+
--- plugin but was not passed in is the split working as designed and
|
|
177
|
+
--- telling you what to pass. Collapsing the two was the first thing that
|
|
178
|
+
--- made the split confusing to use.
|
|
179
|
+
local function unknownkind(kind, catalog)
|
|
180
|
+
local message = 'sekreto: unknown provider kind: ' .. tostring(kind) ..
|
|
181
|
+
' (available: ' .. table.concat(catalog:names(), ', ') .. ')'
|
|
182
|
+
|
|
183
|
+
for _, known in ipairs(providers.KINDS.plugin) do
|
|
184
|
+
if known == kind then
|
|
185
|
+
return message .. ' - ' .. tostring(kind) ..
|
|
186
|
+
' is a sekreto plugin, not built in: pass it in the plugins option'
|
|
187
|
+
end
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
return message
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
--- A SekretoError that crossed the plugin boundary comes back out as
|
|
194
|
+
--- itself, byte for byte. Anything else is not sekreto's to rewrite.
|
|
195
|
+
local function unwrap(raised)
|
|
196
|
+
if providers.ERROR_CODE == plugin.codeof(raised) then
|
|
197
|
+
local cause = ('table' == type(raised.details)) and raised.details.cause or nil
|
|
198
|
+
if 'string' == type(cause) then
|
|
199
|
+
return err.SekretoError(cause)
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
return raised
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
--- One chain entry, as a plugin instance.
|
|
207
|
+
---
|
|
208
|
+
--- The instance is `kind` for a store named after its kind and
|
|
209
|
+
--- `kind$store` otherwise - `hashicorp$prod` - so `host:list()` reads like
|
|
210
|
+
--- the chain. A store name that is already taken gets a numbered tag from
|
|
211
|
+
--- the host instead, because two providers MAY share a store name (a
|
|
212
|
+
--- directed read walks both) and an instance ref may not.
|
|
213
|
+
function Sekreto:declare(spec)
|
|
214
|
+
local kind = ('table' == type(spec)) and spec.kind or nil
|
|
215
|
+
|
|
216
|
+
if 'string' ~= type(kind) or not self.catalog:has(kind) then
|
|
217
|
+
err.fail(unknownkind(kind, self.catalog))
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
local store = providers.nonempty(spec.name) and spec.name or kind
|
|
221
|
+
|
|
222
|
+
if 'string' ~= type(store) or not plugin.check_tag(store) then
|
|
223
|
+
err.fail('sekreto: invalid store name: ' .. tostring(store))
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
local ref = (store == kind) and kind or plugin.format_ref(kind, store)
|
|
227
|
+
if nil ~= self.host:instance(ref) then
|
|
228
|
+
ref = self.host:autotag(kind)
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
-- `load` runs the definition's `define`, which builds the provider from
|
|
232
|
+
-- the spec; `activate` takes the instance live. Nothing is contacted by
|
|
233
|
+
-- either: a provider opens nothing until its first lookup.
|
|
234
|
+
local ok, raised = pcall(function()
|
|
235
|
+
self.host:load(ref, plugin.types.map({ options = spec }))
|
|
236
|
+
self.host:activate(ref)
|
|
237
|
+
end)
|
|
238
|
+
|
|
239
|
+
if not ok then
|
|
240
|
+
error(unwrap(raised), 0)
|
|
241
|
+
end
|
|
242
|
+
|
|
243
|
+
return {
|
|
244
|
+
store = store,
|
|
245
|
+
provider = self.host:exports(ref .. '/' .. providers.PROVIDER_EXPORT),
|
|
246
|
+
}
|
|
247
|
+
end
|
|
248
|
+
|
|
249
|
+
--- Make a Sekreto.
|
|
250
|
+
---
|
|
251
|
+
--- `options` carries `plugins` (the definitions this chain may build,
|
|
252
|
+
--- beyond the four built-ins), `providers` (the chain itself, as specs or
|
|
253
|
+
--- as live providers) and `cache`. Construction contacts nothing: the
|
|
254
|
+
--- first network call is the first lookup.
|
|
255
|
+
function M.Sekreto(options)
|
|
256
|
+
local self = setmetatable({}, Sekreto)
|
|
257
|
+
local opts = options or {}
|
|
258
|
+
|
|
259
|
+
-- An options TABLE, not a list of specs. Before the plugin split this
|
|
260
|
+
-- took `sekreto(specs, cache)` positionally, and that call would now
|
|
261
|
+
-- find no `providers` key and build an EMPTY CHAIN IN SILENCE - every
|
|
262
|
+
-- `get` raising `unknown secret` with nothing to say why. A list is
|
|
263
|
+
-- refused outright instead.
|
|
264
|
+
if nil ~= opts[1] then
|
|
265
|
+
err.fail('sekreto: sekreto() takes an options table' ..
|
|
266
|
+
' { plugins = ..., providers = ..., cache = ... }, not a list of specs')
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
-- Built-ins first, then the plugins, into one catalog: a plugin that
|
|
270
|
+
-- names a built-in kind replaces it, which is how a host substitutes an
|
|
271
|
+
-- implementation and never an accident, because the four names are
|
|
272
|
+
-- documented.
|
|
273
|
+
--
|
|
274
|
+
-- `catalog` is the definitions this Sekreto can build; `host` is the
|
|
275
|
+
-- voxgig/plugin host every spec'd provider is an instance of. Read them
|
|
276
|
+
-- for introspection - `host:list()` names each store's ref and status -
|
|
277
|
+
-- and nothing on either advances the chain.
|
|
278
|
+
local defs = {}
|
|
279
|
+
for _, builtin in ipairs(providers.BUILTINS) do
|
|
280
|
+
defs[#defs + 1] = builtin
|
|
281
|
+
end
|
|
282
|
+
for _, given in ipairs(opts.plugins or {}) do
|
|
283
|
+
defs[#defs + 1] = definition(given)
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
self.catalog = plugin.make_catalog(defs)
|
|
287
|
+
self.host = plugin.make_host(plugin.types.map({ catalog = self.catalog }))
|
|
288
|
+
|
|
289
|
+
-- {store, provider} pairs, in chain order. A provider handed in live is
|
|
290
|
+
-- backed by no instance; a spec'd one is an instance of its kind on the
|
|
291
|
+
-- host.
|
|
292
|
+
self.entries = {}
|
|
293
|
+
|
|
294
|
+
for index, entry in ipairs(opts.providers or {}) do
|
|
295
|
+
if 'function' == type(entry.lookup) then
|
|
296
|
+
self.entries[index] = { store = name.storename(entry), provider = entry }
|
|
297
|
+
else
|
|
298
|
+
self.entries[index] = self:declare(entry)
|
|
299
|
+
end
|
|
300
|
+
end
|
|
301
|
+
|
|
302
|
+
-- A list, not a map: the store a value came from stays attached, and
|
|
303
|
+
-- redaction order does not vary between runs.
|
|
304
|
+
self.cache = {}
|
|
305
|
+
|
|
306
|
+
-- Every value ever resolved, for redact(). Kept independently of the
|
|
307
|
+
-- read cache so that redaction still works when caching is off -
|
|
308
|
+
-- otherwise an uncached Sekreto would silently disable redact() and
|
|
309
|
+
-- leak secrets to logs. Append-only for the object's life: neither
|
|
310
|
+
-- refresh() nor close() clears it.
|
|
311
|
+
self.seen = {}
|
|
312
|
+
|
|
313
|
+
-- A strict identity test, as canonical: only an exact `false` turns
|
|
314
|
+
-- caching off, so nil leaves it on.
|
|
315
|
+
self.docache = (false ~= opts.cache)
|
|
316
|
+
|
|
317
|
+
return self
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
--- The one resolution path both readers share.
|
|
321
|
+
function Sekreto:resolve(store, secret, useentries)
|
|
322
|
+
-- The name is validated FIRST: before the cache, before the first
|
|
323
|
+
-- provider.
|
|
324
|
+
name.checkname(secret)
|
|
325
|
+
|
|
326
|
+
if self.docache then
|
|
327
|
+
for _, hit in ipairs(self.cache) do
|
|
328
|
+
if store == hit.store and secret == hit.name then
|
|
329
|
+
return hit.value
|
|
330
|
+
end
|
|
331
|
+
end
|
|
332
|
+
end
|
|
333
|
+
|
|
334
|
+
for _, entry in ipairs(useentries) do
|
|
335
|
+
local found = entry.provider.lookup(secret)
|
|
336
|
+
|
|
337
|
+
-- The empty string is a HIT. Only nil is a miss, and a provider that
|
|
338
|
+
-- raises is not caught here: the error propagates out of get/try.
|
|
339
|
+
if nil ~= found then
|
|
340
|
+
if self.docache then
|
|
341
|
+
self.cache[#self.cache + 1] = { store = store, name = secret, value = found }
|
|
342
|
+
end
|
|
343
|
+
self.seen[#self.seen + 1] = found
|
|
344
|
+
return found
|
|
345
|
+
end
|
|
346
|
+
end
|
|
347
|
+
|
|
348
|
+
-- Misses are never cached.
|
|
349
|
+
return nil
|
|
350
|
+
end
|
|
351
|
+
|
|
352
|
+
--- The secret, or nil if no provider has it.
|
|
353
|
+
---
|
|
354
|
+
--- Named `tryget` because `try` is not usable as a Lua field name without
|
|
355
|
+
--- quoting at every call site; `sekreto['try']` is kept as an alias for
|
|
356
|
+
--- callers translating from canonical.
|
|
357
|
+
function Sekreto:tryget(secret)
|
|
358
|
+
return self:resolve('', secret, self.entries)
|
|
359
|
+
end
|
|
360
|
+
|
|
361
|
+
Sekreto.try = Sekreto.tryget
|
|
362
|
+
|
|
363
|
+
--- The secret, or a SekretoError if no provider has it.
|
|
364
|
+
function Sekreto:get(secret)
|
|
365
|
+
local found = self:tryget(secret)
|
|
366
|
+
|
|
367
|
+
if nil == found then
|
|
368
|
+
err.fail('sekreto: unknown secret: ' .. tostring(secret))
|
|
369
|
+
end
|
|
370
|
+
|
|
371
|
+
return found
|
|
372
|
+
end
|
|
373
|
+
|
|
374
|
+
--- The secret from one named store, or nil if that store does not have
|
|
375
|
+
--- it.
|
|
376
|
+
---
|
|
377
|
+
--- Naming a store that is not in the chain is an error, not a miss:
|
|
378
|
+
--- `tryget` already means "this store may not have it", so it cannot also
|
|
379
|
+
--- mean "this store may not exist" without hiding a typo. It is raised
|
|
380
|
+
--- BEFORE the name is validated.
|
|
381
|
+
function Sekreto:tryfrom(store, secret)
|
|
382
|
+
local matching = {}
|
|
383
|
+
|
|
384
|
+
for _, entry in ipairs(self.entries) do
|
|
385
|
+
if store == entry.store then
|
|
386
|
+
matching[#matching + 1] = entry
|
|
387
|
+
end
|
|
388
|
+
end
|
|
389
|
+
|
|
390
|
+
if 0 == #matching then
|
|
391
|
+
err.fail('sekreto: unknown store: ' .. tostring(store))
|
|
392
|
+
end
|
|
393
|
+
|
|
394
|
+
return self:resolve(store, secret, matching)
|
|
395
|
+
end
|
|
396
|
+
|
|
397
|
+
--- The secret from one named store, or a SekretoError.
|
|
398
|
+
function Sekreto:getfrom(store, secret)
|
|
399
|
+
local found = self:tryfrom(store, secret)
|
|
400
|
+
|
|
401
|
+
if nil == found then
|
|
402
|
+
err.fail('sekreto: unknown secret: ' .. tostring(store) .. ':' .. tostring(secret))
|
|
403
|
+
end
|
|
404
|
+
|
|
405
|
+
return found
|
|
406
|
+
end
|
|
407
|
+
|
|
408
|
+
--- Does any provider have this secret?
|
|
409
|
+
function Sekreto:has(secret)
|
|
410
|
+
return nil ~= self:tryget(secret)
|
|
411
|
+
end
|
|
412
|
+
|
|
413
|
+
--- Does this named store have this secret?
|
|
414
|
+
function Sekreto:hasin(store, secret)
|
|
415
|
+
return nil ~= self:tryfrom(store, secret)
|
|
416
|
+
end
|
|
417
|
+
|
|
418
|
+
--- Every named secret at once. Missing ones are an error.
|
|
419
|
+
function Sekreto:all(secrets)
|
|
420
|
+
local out = {}
|
|
421
|
+
local order = {}
|
|
422
|
+
|
|
423
|
+
for _, secret in ipairs(secrets) do
|
|
424
|
+
out[secret] = self:get(secret)
|
|
425
|
+
order[#order + 1] = secret
|
|
426
|
+
end
|
|
427
|
+
|
|
428
|
+
return out, order
|
|
429
|
+
end
|
|
430
|
+
|
|
431
|
+
--- A description of each provider, in resolution order, repeats kept.
|
|
432
|
+
function Sekreto:sources()
|
|
433
|
+
local out = {}
|
|
434
|
+
|
|
435
|
+
for index, entry in ipairs(self.entries) do
|
|
436
|
+
out[index] = entry.provider.describe()
|
|
437
|
+
end
|
|
438
|
+
|
|
439
|
+
return out
|
|
440
|
+
end
|
|
441
|
+
|
|
442
|
+
--- Replace every value this Sekreto has resolved with `[redacted]`.
|
|
443
|
+
--- Works whether or not caching is enabled.
|
|
444
|
+
function Sekreto:redact(text)
|
|
445
|
+
return name.redact(text, self.seen)
|
|
446
|
+
end
|
|
447
|
+
|
|
448
|
+
--- Drop cached values, so the next `get` asks the providers again. The
|
|
449
|
+
--- redaction history is NOT cleared.
|
|
450
|
+
function Sekreto:refresh()
|
|
451
|
+
self.cache = {}
|
|
452
|
+
end
|
|
453
|
+
|
|
454
|
+
--- Tear the chain down: every plugin instance is deactivated and
|
|
455
|
+
--- unloaded, in reverse, releasing whatever a provider acquired at
|
|
456
|
+
--- activation. Afterwards `stores()` and `sources()` are empty, `tryget`
|
|
457
|
+
--- misses and `get` raises - and `redact` still knows every value ever
|
|
458
|
+
--- resolved.
|
|
459
|
+
function Sekreto:close()
|
|
460
|
+
self.host:close()
|
|
461
|
+
self.entries = {}
|
|
462
|
+
self.cache = {}
|
|
463
|
+
end
|
|
464
|
+
|
|
465
|
+
M.SekretoClass = Sekreto
|
|
466
|
+
|
|
467
|
+
-- ---------------------------------------------------------- the factory
|
|
468
|
+
|
|
469
|
+
--- Make a Sekreto from options - the same shape the shared spec and an
|
|
470
|
+
--- app's config file use.
|
|
471
|
+
---
|
|
472
|
+
--- A `providers` element that already has a callable `lookup` is taken as
|
|
473
|
+
--- a live provider (duck-typed, never by class identity) and keeps its
|
|
474
|
+
--- own describe()-derived store name.
|
|
475
|
+
function M.sekreto(options)
|
|
476
|
+
return M.Sekreto(options)
|
|
477
|
+
end
|
|
478
|
+
|
|
479
|
+
return M
|