From ea26188dc03aafc3c9db8dd64a7df1cb8bdf97b2 Mon Sep 17 00:00:00 2001 From: Romain LE JEUNE Date: Mon, 13 Nov 2023 15:37:32 +0100 Subject: [PATCH] fix(GODT-2277): Fix keychains initialisation in vault-editor (for write as well). --- utils/vault-editor/main.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/utils/vault-editor/main.go b/utils/vault-editor/main.go index e2156b1e..fd241461 100644 --- a/utils/vault-editor/main.go +++ b/utils/vault-editor/main.go @@ -65,15 +65,17 @@ func readAction(c *cli.Context) error { func writeAction(c *cli.Context) error { return app.WithLocations(func(locations *locations.Locations) error { - return app.WithVault(locations, nil, async.NoopPanicHandler{}, func(vault *vault.Vault, insecure, corrupt bool) error { - b, err := io.ReadAll(os.Stdin) - if err != nil { - return fmt.Errorf("failed to read vault: %w", err) - } + return app.WithKeychainList(func(keychains *keychain.List) error { + return app.WithVault(locations, keychains, async.NoopPanicHandler{}, func(vault *vault.Vault, insecure, corrupt bool) error { + b, err := io.ReadAll(os.Stdin) + if err != nil { + return fmt.Errorf("failed to read vault: %w", err) + } - vault.ImportJSON(b) + vault.ImportJSON(b) - return nil + return nil + }) }) }) }