From fb6289b159023d58619eab781d95afe5386b0677 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl-Einar=20Bergstr=C3=B8m?= Date: Tue, 13 Oct 2026 20:57:08 +0200 Subject: [PATCH] fix: help and errors name sharing.key and sharing.keyRules, not share.* --- cmd/lazysecrets/main.go | 2 +- cmd/lazysecrets/share.go | 8 ++++---- internal/provider/fake/fake.go | 2 +- internal/provider/repo/repo.go | 2 +- internal/share/rules.go | 2 +- internal/share/share.go | 6 +++--- internal/ui/app/app.go | 6 +++--- internal/ui/app/sharefiles.go | 2 +- internal/ui/app/sharefiles_test.go | 4 ++-- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/cmd/lazysecrets/main.go b/cmd/lazysecrets/main.go index 3face6b..c1c11da 100644 --- a/cmd/lazysecrets/main.go +++ b/cmd/lazysecrets/main.go @@ -122,7 +122,7 @@ func run() error { for scripts: VAR=$(lazysecrets get ) lazysecrets [flags] share [--key ] ... print a link to env files of a repo, encrypted - with a secret's value (default: share.key) + with a secret's value (default: sharing.key) lazysecrets [flags] keybindings print every action and its keys (with your config applied), as config to copy and edit lazysecrets handler install [--terminal NAME] diff --git a/cmd/lazysecrets/share.go b/cmd/lazysecrets/share.go index 866f20b..2791307 100644 --- a/cmd/lazysecrets/share.go +++ b/cmd/lazysecrets/share.go @@ -17,12 +17,12 @@ import ( ) // shareFiles prints a share link to env files of one repo, encrypted with -// the --key secret's value, else the repo's or the config's share.key: +// the --key secret's value, else the repo's or the config's sharing.key: // // lazysecrets share .env apps/api/.env func shareFiles(ctx context.Context, providers []provider.Provider, st *store.Store, general string, rules share.Rules, args []string, out io.Writer) error { fs := flag.NewFlagSet("share", flag.ContinueOnError) - keyLink := fs.String("key", "", "the secret to encrypt with: its lazysecrets:// link, Key Vault URL or reference (default: share.key)") + keyLink := fs.String("key", "", "the secret to encrypt with: its lazysecrets:// link, Key Vault URL or reference (default: sharing.key)") if err := fs.Parse(args); err != nil { return err } @@ -73,7 +73,7 @@ func shareFiles(ctx context.Context, providers []provider.Provider, st *store.St return err } if !ok { - return errors.New("which secret to encrypt with? --key , or share.key in the repo's .lazysecrets.yaml or the config") + return errors.New("which secret to encrypt with? --key , or sharing.key in the repo's .lazysecrets.yaml or the config") } v, version, err := readKey(ctx, providers, st, key) if err != nil { @@ -87,7 +87,7 @@ func shareFiles(ctx context.Context, providers []provider.Provider, st *store.St return err } -// shareRules are the config's share.keyRules. +// shareRules are the config's sharing.keyRules. func shareRules(cfg config.Config) share.Rules { return share.Rules{MinLength: cfg.Sharing.KeyRules.MinLength, MinClasses: cfg.Sharing.KeyRules.MinClasses} } diff --git a/internal/provider/fake/fake.go b/internal/provider/fake/fake.go index 4bf3a21..572e7e2 100644 --- a/internal/provider/fake/fake.go +++ b/internal/provider/fake/fake.go @@ -332,7 +332,7 @@ func Azure(delay time.Duration) *Provider { }, demoCert) shared := p.addContainer(prod, "kv-shared-prod", "https://kv-shared-prod.vault.azure.net", allTypes...) - // A key to share env files with (S → f): random, as share.keyRules wants. + // A key to share env files with (S → f): random, as sharing.keyRules wants. p.add(shared, provider.TypeSecret, provider.Object{ Name: "env-share", Enabled: &yes, Updated: base, Reference: secretRef("kv-shared-prod", "env-share"), }, "q8Zt3VwL1mXc7Rk2Pj9Ys4Hn6Bf0Ga5Ud+Te/OiWlE=") diff --git a/internal/provider/repo/repo.go b/internal/provider/repo/repo.go index 277858d..af139f7 100644 --- a/internal/provider/repo/repo.go +++ b/internal/provider/repo/repo.go @@ -606,7 +606,7 @@ type lazysecretsFile struct { } `yaml:"sharing"` } -// ShareKey is the share.key of the repo's .lazysecrets.yaml, if any. +// ShareKey is the sharing.key of the repo's .lazysecrets.yaml, if any. func ShareKey(root string) (string, error) { b, err := os.ReadFile(filepath.Join(root, ".lazysecrets.yaml")) if errors.Is(err, os.ErrNotExist) { diff --git a/internal/share/rules.go b/internal/share/rules.go index 48311c7..9274cb1 100644 --- a/internal/share/rules.go +++ b/internal/share/rules.go @@ -53,7 +53,7 @@ func (r Rules) Check(key []byte) error { if len(has) == 0 { return nil } - return fmt.Errorf("its value has %s; share.keyRules needs %s", + return fmt.Errorf("its value has %s; sharing.keyRules needs %s", strings.Join(has, " and "), strings.Join(needs, " and ")) } diff --git a/internal/share/share.go b/internal/share/share.go index 7830f24..8a65a66 100644 --- a/internal/share/share.go +++ b/internal/share/share.go @@ -259,8 +259,8 @@ func CheckPath(p string) error { return nil } -// DefaultKey is the key for a repo's files: share.key in the repo's -// .lazysecrets.yaml, else general (share.key in the config). ok is false +// DefaultKey is the key for a repo's files: sharing.key in the repo's +// .lazysecrets.yaml, else general (sharing.key in the config). ok is false // when neither names one. func DefaultKey(root, general string) (key ref.Ref, ok bool, err error) { link, err := repo.ShareKey(root) @@ -276,7 +276,7 @@ func DefaultKey(root, general string) (key ref.Ref, ok bool, err error) { } key, err = ParseKey(link) if err != nil { - return ref.Ref{}, false, fmt.Errorf("share.key in %s: %w", where, err) + return ref.Ref{}, false, fmt.Errorf("sharing.key in %s: %w", where, err) } return key, true, nil } diff --git a/internal/ui/app/app.go b/internal/ui/app/app.go index 448dda8..d764300 100644 --- a/internal/ui/app/app.go +++ b/internal/ui/app/app.go @@ -84,7 +84,7 @@ type Options struct { // CacheFile keeps what was loaded between runs; "" keeps it for this // run only. CacheFile string - // ShareKey is the config's share.key: the secret that encrypts shared + // ShareKey is the config's sharing.key: the secret that encrypts shared // env files, for repos whose .lazysecrets.yaml names none. ShareKey string // ShareRules are what a key's value must be to share with it. @@ -281,8 +281,8 @@ type Model struct { linked []provider.Container // vaults opened from links, this session open *ref.Ref // reference to open at startup - shareKey string // the config's share.key - shareRules share.Rules // and share.keyRules + shareKey string // the config's sharing.key + shareRules share.Rules // and sharing.keyRules // A lazysecrets:// link found on the clipboard, offered in the footer. dismissedLink string // the last link offered: not offered again diff --git a/internal/ui/app/sharefiles.go b/internal/ui/app/sharefiles.go index 06f5fb0..d693b27 100644 --- a/internal/ui/app/sharefiles.go +++ b/internal/ui/app/sharefiles.go @@ -38,7 +38,7 @@ type shareFilesMsg struct { type sealedMsg struct { link ref.Ref n int - // from is the picker the key was picked in; nil for share.key's. + // from is the picker the key was picked in; nil for sharing.key's. from *picker err error } diff --git a/internal/ui/app/sharefiles_test.go b/internal/ui/app/sharefiles_test.go index d33d0e3..8789ad8 100644 --- a/internal/ui/app/sharefiles_test.go +++ b/internal/ui/app/sharefiles_test.go @@ -50,7 +50,7 @@ func shareFrom(t *testing.T, root string, paste bool) string { t.Fatalf("selected %v, want the repo", src.ID) } d.keys("S", "f") - // No share.key set: it asks which secret, in Go to, which lists + // No sharing.key set: it asks which secret, in Go to, which lists // only secrets. v := d.m.search if v == nil || v.picker == nil { @@ -218,7 +218,7 @@ func TestShareInDemo(t *testing.T) { } // Too short a key: the picker stays, saying why. d.send(tea.PasteMsg{Content: "https://kv-app-prod.vault.azure.net/secrets/db-password"}) - if d.m.search == nil || !strings.Contains(d.m.search.picker.err, "Can't use db-password: its value has 28 characters; share.keyRules needs 32 (minLength)") { + if d.m.search == nil || !strings.Contains(d.m.search.picker.err, "Can't use db-password: its value has 28 characters; sharing.keyRules needs 32 (minLength)") { t.Fatalf("not said in the picker: %v\n%s", d.m.search != nil, d.screen()) } if !strings.Contains(d.screen(), "28 characters") { -- 2.54.0