Open jcalfee opened 8 years ago
If you're interested, I created a branch that is close to being a pull request. It is a breaking change and I'm not sure how you want to handle that.
https://github.com/steemit/koa-crypto-session/tree/koa-crypto-session-pull-request
SGTM, PR welcome
Looks like your using a CBC (
aes-128-cbc
), so this should apply to you:https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Initialization_vector_.28IV.29
Sounds like you can simply prefix your encrypted data with a unique nonce (like
Date.now()
+ random_value). The random_value is a value in RAM used to keep the none unique in a cluster of nodes. Sha256 hash the nonce to get the IV value.