keybase / triplesec

Triple Security for the browser and Node.js
https://keybase.io/triplesec
MIT License
399 stars 48 forks source link

Weird _key bug #41

Closed SimeonC closed 5 years ago

SimeonC commented 9 years ago

Using the following coffeescript I get this error: Error: in KDF: Failed due to scrubbed key!

_key = new Buffer "some_key_here"
encrypt { _key, data: new Buffer "secret_here" }, cb

But the following works flawsessly:

key = new Buffer "some_key_here"
encrypt { key, data: new Buffer "secret_here" }, cb

I think somewhere in the triplesec a _key variable is not being scoped properly?

dr-dimitru commented 8 years ago

+1, Any explanation on this error (or all errors) in a docs - will be helpful

maxtaco commented 8 years ago

Encrypt needs parameter named key, not a _key. Is there documentation that says otherwise?

On Fri, Oct 2, 2015 at 3:12 PM, dr.dimitru notifications@github.com wrote:

+1

— Reply to this email directly or view it on GitHub https://github.com/keybase/triplesec/issues/41#issuecomment-145129026.

dr-dimitru commented 8 years ago

@maxtaco thank you for reply, but I believe my error is passed values into encrypt method. Which types of parameters it accepts in browser? Uint8Array?

dr-dimitru commented 8 years ago

Found an answer by myself, but it will be more better to see it in docs (API docs isn't readable and didn't give understanding of how this thing works), so encrypt/decrypt methods accepts triplesec.Buffer:

triplesec.encrypt({key: new triplesec.Buffer('pass'), data: new triplesec.Buffer('value')}, function(err, res){console.log(err,res)});