Skip to content

Commit c549192

Browse files
committed
refactor: secrets
- remove delete operation - remove store interface
1 parent dd28116 commit c549192

File tree

1 file changed

+1
-20
lines changed

1 file changed

+1
-20
lines changed

internal/secrets/keyring.go

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,13 @@ import (
99

1010
var ErrSecretNotFound = errors.New("secret not found")
1111

12-
// Store provides secure credential storage operations.
13-
type Store interface {
14-
Get(key string) ([]byte, error)
15-
Put(key string, data []byte) error
16-
Delete(key string) error
17-
}
18-
1912
type keyringStore struct {
2013
ctx context.Context
2114
serviceName string
2215
}
2316

2417
// Open opens the system keyring for the Sourcegraph CLI.
25-
func Open(ctx context.Context) (Store, error) {
18+
func Open(ctx context.Context) (*keyringStore, error) {
2619
return &keyringStore{ctx: ctx, serviceName: "Sourcegraph CLI"}, nil
2720
}
2821

@@ -72,15 +65,3 @@ func (k *keyringStore) Get(key string) ([]byte, error) {
7265
return []byte(secret), nil
7366
})
7467
}
75-
76-
// Delete removes a key from the keyring.
77-
func (k *keyringStore) Delete(key string) error {
78-
_, err := withContext(k.ctx, func() (struct{}, error) {
79-
err := keyring.Delete(k.serviceName, key)
80-
if err != nil && err != keyring.ErrNotFound {
81-
return struct{}{}, errors.Wrap(err, "removing item from keyring")
82-
}
83-
return struct{}{}, nil
84-
})
85-
return err
86-
}

0 commit comments

Comments
 (0)