Git Product home page Git Product logo

Comments (8)

CMCDragonkai avatar CMCDragonkai commented on August 24, 2024

Rewrote the above for some secret command interaction. @ll-aashwin-ll your opinion?

from polykey.

CMCDragonkai avatar CMCDragonkai commented on August 24, 2024

As for editing something like this might be possible: https://unix.stackexchange.com/a/282384/56970

It seems in general, it might be possible to pipe the output into an editor. Or pipe it to a file, where you then open the file descriptor but delete the file contents (thus you end up with a read/write descriptor). Then pipe that file back into the same command.

Note that one has to be careful with concurrent usage. We should expect similar concurrency issues.

Also note the usage of echo 'abc' >> file. It is also possible to do echo 'abc' >> >(cat > file). But this is more advanced.

from polykey.

CMCDragonkai avatar CMCDragonkai commented on August 24, 2024

I really want to be able to run a polykey command to create a secret, that launches the $EDITOR or $VISUAL and upon saving, pipe the output to the polykey command without leaking any data on disk. Not entirely sure how to achieve this though.

Oh it seems vipe might be the right way to do it. There's also how git launches the editor when you ask to do rebases.

from polykey.

CMCDragonkai avatar CMCDragonkai commented on August 24, 2024

Based on my reading of https://en.wikipedia.org/wiki/Uniform_Resource_Identifier I think this should mean that we can just use pk:/a/b. As well. Or even just pk:a/b. But without the root slash it could mean something else like the current context. I don't think it's specified. There are some good discussion about this here? https://github.com/ipfs/in-web-browsers/blob/master/ADDRESSING.md

from polykey.

CMCDragonkai avatar CMCDragonkai commented on August 24, 2024
polykey secrets ed pk:/a/b

Launches editor for secret, and allows one to save the file.

It works!

tmpfile=$(mktemp /tmp/abc.XXXXXX)
exec {fd}<> "$tmpfile"
rm -f "$tmpfile"
vim "/proc/self/fd/$fd"
cat <&${fd}

The above works in ZSH and Bash using automatic fd allocation.

We would do this inside JS which should be alot more robust.

from polykey.

CMCDragonkai avatar CMCDragonkai commented on August 24, 2024

@robert-cronin Given that you've created the demo already, could we get an update on the status of this issue?

In relation to #3 as well.

from polykey.

robert-cronin avatar robert-cronin commented on August 24, 2024

The cli now exposes a sub-command for interacting with secrets, the pattern looks like this:

pk secrets <action>

Under this sub command, the user can manipulate secrets with the following commands:

pk secrets ls|list --vault-name <vault-name> # lists the secrets in a particular vault
pk secrets create --vault-name <vault-name> --secret-name <secret-name> --secret-path /path/to/secret # add a secret to a vault
pk secrets get --vault-name <vault-name> --secret-name <secret-name> # get an existing secret

There is still the option of doing away with command options like --vault-name and --secret-name and just doing something like a file path: <vault-name>/<secret-name> but lets just stick with the existing options for now and it can be a convenience later.

The other thing that is useful is environment variables to set default values:

export KEYNODE_PATH=/home/user/Polykey
export DEFAULT_VAULT=Vault1

from polykey.

robert-cronin avatar robert-cronin commented on August 24, 2024

secrets are now referenced on the CLI with the format <vaultName>:<secretName>
The only thing remaining is to develop the editor for the secrets. I will make a new issue for this

polykey secrets ed pk:/a/b

Launches editor for secret, and allows one to save the file.

It works!

tmpfile=$(mktemp /tmp/abc.XXXXXX)
exec {fd}<> "$tmpfile"
rm -f "$tmpfile"
vim "/proc/self/fd/$fd"
cat <&${fd}

The above works in ZSH and Bash using automatic fd allocation.

We would do this inside JS which should be alot more robust.

from polykey.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.