Closed katp4 closed 5 years ago
Scratch that, solved it with the inject function :)
Hey @katp4, can you tell me how you did this? I thought the key was a string, but it's an object, quite hard to store easily, would prefer a simple string instead of this mess :cry:
@Extarys - You can extract the raw key buffer using the corresponding .raw()
method - https://github.com/sjudson/paseto.js/blob/master/lib/key/symmetric.js#L182-L195
The use of an object instead of a raw string is intentional - it allows additional validation to be required before a key may be used, and also reduces the propensity for mishaps with improper passing/use of keying material.
Thank you @sjudson for that! I understand the why, I just find the documentation in the readme hard to understand when you are not to familiar with it. That's where answers like yours help me a lot.
Thanks again.
Hi,
First of all thanks for this, it has been very useful.
I want to store the key generated by
return encoder.symmetric()
to a mongoDB database as a string, retrieve it and then use it to decrypt data. However, when storing it as string, it loses all of its attached properties i.e key.protocol().Do you have any suggestions on how to do this? Is there a function i can use/expose i.e StringToV2?