Skip to content

Commit

Permalink
fix(daemon): return empty list on unitialised keyring
Browse files Browse the repository at this point in the history
  • Loading branch information
juligasa committed Jun 25, 2024
1 parent 838ca1e commit cb21303
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion backend/core/keystore.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func (ks *osKeyStore) ListKeys(ctx context.Context) ([]NamedKey, error) {

secret, err := keyring.Get(ks.serviceName, collectionName)
if err != nil {
return ret, errEmptyEnvironment
return ret, nil
}

collection := keyCollection{}
Expand Down
3 changes: 2 additions & 1 deletion backend/core/keystore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ func TestOSKeyStore(t *testing.T) {
emptyKey, err := ks.GetKey(ctx, "keyName")
require.Error(t, err)
keys, err := ks.ListKeys(ctx)
require.Error(t, err)
require.NoError(t, err)
require.Len(t, keys, 0)
require.NoError(t, ks.StoreKey(ctx, "keyName", kp))
key, err := ks.GetKey(ctx, "keyName")
require.NoError(t, err)
Expand Down

0 comments on commit cb21303

Please sign in to comment.