Reputation: 21304
I'm searching for solution of encrypting my javascript object with some data (e.g. { data: [{...}, {...}] }
) into string and then be able to decrypt this back to the same object. These operations will be done on node.js server.
For now I'm stringifying object with JSON.stringify
and then using base64
url encoding and decoding with https://www.npmjs.org/package/b64url. What I don't like here is that output string is even longer than stringified json.
I would like to have encrypted string with some restricted size. Is it possible? Maybe there are some npm packages ready for that purporse?
Thanks!
Upvotes: 1
Views: 5417
Reputation: 21304
I've wrote a NPM module that copes with this - object-encrypter https://github.com/voronianski/node-object-encrypter.
Upvotes: 1