serokell / coffer

Multi-backend password store with multiple frontends
4 stars 2 forks source link

Hide `listSecrets`'s implementation details #106

Closed dcastro closed 2 years ago

dcastro commented 2 years ago

Clarification and motivation

The listSecrets function (soon to be renamed in #100) returns a [Text]. These strings can be either entry names or directory names.

Vault will add a / suffix to directory names, and Backend.Commands.getEntryOrDir relies on this behaviour to decide whether each of those strings is an entry name or a directory name.

However, this behavior is specific to the Vault backend. Other backends might not behave like this. So we should hide this behavior behind listSecrets.

Instead of returning a [Text], it should return a new data structure DirectoryContents with two fields: directoryNames :: [PathSegment] and entryNames :: [PathSegment].

Also:

Acceptance criteria