Suggestions and edits are welcome 👻
This project is built using NodeJS
.
Node
uses other packages also called modules
available at repositories which can be installed via a command.
The default package manager
is npm
.
keygen.js - Used to generate the public and private keys and export them as public.txt and private.txt files.
decrypt.js - As the name suggests it is used to decrypt the files using the public and private keys.
index.js - It is used to encrpyt the data. Remember how we entered our details and got out an encrypted string? This is the file that does that
P.S. Executing this line would break the code. As in your encrypted text would be encrypted via a different key. Do on a separate branch and do NOT raise a PR!
DO NOT EXECUTE IF YOU WANT A STICKER
node keygen.js
This generates a new set of public and private keys at the root of the project called you guessed it - public.txt
and private.txt
.
-
Have a look at
package.json
under the scripts section you can findaddress
. Whenever you runnpm run address
it means run the command corresponding to theaddress
script, which isnode index.js
. -
Here we use the
inquirer
package to gather information and store it asanswers
. -
We then read the
public.txt
file using thefs
package and encrypt theanswers
using this public key.
-
Have a look at
package.json
under the scripts section you can findtest
, which isnode decrypt.js
. -
We read the
private.txt
file using thefs
package and also the file you've written into. Please note currently itstest.txt
. This then reads the data and decrypts the encrypted string into your address.
I guess that is it.
Happy coding.