A simple server for storing and verifying public keys.
First, run npm install to install the dependencies.
To start the server, run node server.js. It can be configured with environment variables:
PORT: The port to listen on. Defaults to4545.USERNAME: The username to use for the server. Defaults tozachary.PASSWORD: The password to use for the server. Defaults topassword.
Example:
PORT=4546 USERNAME=zachary PASSWORD=password node server.jsTo start the client, run node client.js. It can be configured with environment variables:
PORT: The port to connect to. This should match the port used to launch the server.Defaults to4545.USERNAME: The username to use for the client. Defaults tozachary.PASSWORD: The password to use for the client. Defaults topassword.
Example:
PORT=4546 USERNAME=zachary PASSWORD=password node client.jsInitially you will need to create a keypair:
$ node client.js createYou can then publish the public key to the server. The server will update its database with the public key for the logged in user.
$ node client.js publishYou can then sign a message:
$ node ./client.js sign -m "Message"
Message
X/5ymqgv4d9vPafNXd3Wvzh4l09dZXT2zWAkb15QGuvTfCAI5Vf2sNsN8Yn/Hile+4lP9bUNkHIfLTFv7988E05WwYhLs2Lq1piZGt6VNcw8LTXEJcaKsMuCP9oRu9vZDpn6A/ACL9ysWe0axLH0J70R5e5/PNJLWFPgU7nbIardWwpMZO4pjYelU3JFOqTOunzKcOxI02pX6sGaXt2bfR74GxwjZGEWjWMMdi9BPgJ/qzYt+SEQm0JHr6cYYLqtF2RwDVJVtcee/RAsgk18Iveqj5uBfbEfTMYbjn7gthorPmnjV1gezXAoaT+ntSDgfJ6xqaAsvc740AcMY2eIh258oUpcT6jwnogaj+SZVNWkzDlgtDn0Hj2RXVtKsFE3LgsH36b4qJxp7o8jLqajrWN/3+JfFcLg0Y2ZYKklfQ4p5IcmHA4JbPbp7fk7fp3fMUAFn9TEDZDo8/fWTISuQdjy0qTUdGAlfvhTcU6sBApX31FtUHcLn2f+cIpqaxTvXRmS8hPVtBO2a5Jz9JyeBo95UMh3tFqMiIBFWTPmYeM1JW4yVVVF/WZCx7Vk4H75Dw0h99TC60Xv/XRItO8/nzE9z0av+P37zR8uTYLRTZq5HT6Wgzd2+p9aSvAUPYLhOHUak4cNiPg9zF0WnkQbCxwYTwa3dn19HyZ49TAtUkE=And finally, you can verify a signature:
$ node client.js verify -m "Message" -s "<signature>"
The message was signed by this signature.