|
| 1 | +const inquirer = require("inquirer"); |
| 2 | +const chalk = require("chalk"); |
| 3 | +const NodeRSA = require("node-rsa"); |
| 4 | +const fs = require("fs"); |
| 5 | + |
| 6 | +(async () => { |
| 7 | + const answers = await inquirer.prompt([ |
| 8 | + { |
| 9 | + type: "input", |
| 10 | + name: "name", |
| 11 | + message: "Enter your full name", |
| 12 | + }, |
| 13 | + { |
| 14 | + type: "input", |
| 15 | + name: "street", |
| 16 | + message: "Street address", |
| 17 | + }, |
| 18 | + { |
| 19 | + type: "input", |
| 20 | + name: "street2", |
| 21 | + message: "Suite or Apt # (optional)", |
| 22 | + }, |
| 23 | + { |
| 24 | + type: "input", |
| 25 | + name: "city", |
| 26 | + message: "City", |
| 27 | + }, |
| 28 | + { |
| 29 | + type: "input", |
| 30 | + name: "state", |
| 31 | + message: "State/Region", |
| 32 | + }, |
| 33 | + { |
| 34 | + type: "input", |
| 35 | + name: "zip", |
| 36 | + message: "Postal Code", |
| 37 | + }, |
| 38 | + { |
| 39 | + type: "input", |
| 40 | + name: "country", |
| 41 | + message: "Country", |
| 42 | + }, |
| 43 | + { |
| 44 | + type: "input", |
| 45 | + name: "notes", |
| 46 | + message: "Any special notes?", |
| 47 | + }, |
| 48 | + ]); |
| 49 | + |
| 50 | + const keyData = fs.readFileSync("public.key", "utf8"); |
| 51 | + |
| 52 | + const key = NodeRSA(); |
| 53 | + key.importKey(keyData); |
| 54 | + |
| 55 | + const encrypted = key.encrypt(answers, "base64"); |
| 56 | + |
| 57 | + console.log(chalk.yellow("------ copy below ------")); |
| 58 | + console.log(chalk.green(encrypted)); |
| 59 | + console.log(chalk.yellow("------ copy above ------")); |
| 60 | + |
| 61 | + console.log(` |
| 62 | + ${chalk.blueBright( |
| 63 | + "Step 1:" |
| 64 | + )} Copy the green encrypted text above - it's your encrypted mailing address. |
| 65 | + ${chalk.blueBright("Step 2:")} Create a new file in ${chalk.bgBlue( |
| 66 | + "stickers/<your-github-username>.txt" |
| 67 | + )}. Paste in the green text. |
| 68 | + ${chalk.blueBright("Step 3:")} Submit a pull request on Github. |
| 69 | + ${chalk.blueBright("Step 4:")} Check your mailbox in a few weeks! |
| 70 | + ${chalk.bgKeyword("orange")( |
| 71 | + chalk.black(" Pull Request Requirements ") |
| 72 | + )} Your pull request should only contain 1 new file! Which is the stickers/<your-github-username>.txt file. |
| 73 | + `); |
| 74 | +})(); |
0 commit comments