Node.js Package

Node.js Package

Encryption has interested me for as long as I can remember. I’ve been writing a decent amount of JavaScript lately, so I decided to try ricmoo/aes-js. It works really well and does everything I was hoping it would do. Since it does so much, the interface requires a little more knowledge than the average person may have. This is why I decided to write a wrapper for it.

Wrapper

My wrapper, disguise, provides a simpler interface to the aes-js library. I wrote my code in TypeScript and compiled it into JavaScript. It provides two simple methods that accept all the needed parameters to encrypt/decrypt messages. You must pass a password, IV, and a message; these are required to encrypt/decrypt a message.

There are also two static methods that instantiate the class and encrypt/decrypt the message. It currently uses the same IV for every call, but I’ll eventually fix that. So don’t use this for anything important.

Advanced Encryption Standard

The U.S. government uses AES for TOP SECRET information. Or at least they did at one time, I don’t think anyone really knows what they do. There have been side-channel attacks on AES, but in my opinion, those don’t count. An example of a side-channel attack would be watching someone type in their password.

Tests with Mocha

You should always test your code, well maybe not always, but if you want anyone else to use it then you should. I like looking at tests that other people write, because it gives me insight into their thought process. I don’t have much experience writing tests for JavaScript, so I did some peeking at other repositories. So I wrote some basic tests and it passes!

Conclusion

My wrapper simplifies the aes-js library. I can see why people like using JavaScript for the backend and frontend. If I decide to put this package on npm then I’ll link it on the resources page.