DavidTanner / nodecredstash

MIT License
43 stars 22 forks source link

Can't update a secret #25

Closed pdeveltere closed 6 years ago

pdeveltere commented 6 years ago

When running the following command: this.credstash.putSecret({ name: "TEST", secret: "..." })

I get an the following error when the value is already in the db:

Error: TEST version 0000000000000000001 is already in the credential store.
    at kms.getEncryptionKey.catch.then.then.then.catch (/Users/.../node_modules/nodecredstash/js/index.js:140:19)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:118:7)

Is this expected behavior? Because that means I have to delete a key and create it again if I want to update a key.

DavidTanner commented 6 years ago

The code doesn't handle auto versioning. It is assumed you are sending in the version you want to insert. You want to call credstash.incrementVersion({name: "TEST"}) to get the next version.

https://github.com/fugue/credstash#versioning-secrets