Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-line Text Prompts #136

Open
jhunt opened this issue Apr 10, 2018 · 0 comments
Open

Multi-line Text Prompts #136

jhunt opened this issue Apr 10, 2018 · 0 comments

Comments

@jhunt
Copy link
Contributor

jhunt commented Apr 10, 2018

Find some sigil we haven't used yet, and teach safe to prompt for multi-line values via that.

What we've done so far:

safe set path/in/vault key=value     # explicitly use "value"
safe set path/in/vault key@a/file    # read from a/file
safe set path/in/vault key           # prompt for value, newline terminates

Idea:

safe set path/in/vault key+

Have that open up the users editor of choice (via $EDITOR) and when they save, handle the tempfile output like a key<${tempfile} call. The buffer loaded into the editor should look like this:

# If there's a user prompt, yo I'll print it!
#
# Enter your secret below.  Use as many lines as you wish!
# When you're done, save and quit your editor, and safe will
# continue on to the next secret.
# ------8<-----------------------------------------------

If we don't find a line that matches ^#\s+--+8<--+$, we save the whole buffer as the secret. Otherwise, we start at the first line after that match and save the rest of the buffer.

This will require some changes to how safe prompt is dealt with -- we need to keep the value of safe prompt that immediately preceded the call to set / paste, and display that in the first section of the comment above, with the key that we are entering. If no $EDITOR variable has been set, inform the user and bail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant