Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
codediodeio committed Mar 17, 2020
0 parents commit 34ca5aa
Show file tree
Hide file tree
Showing 10 changed files with 584 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .gitignore
@@ -0,0 +1,65 @@
private.txt
private.key

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
private.txt

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# parcel-bundler cache (https://parceljs.org/)
.cache
5 changes: 5 additions & 0 deletions .vscode/settings.json
@@ -0,0 +1,5 @@
{
"files.exclude": {
"**/.git": false
}
}
27 changes: 27 additions & 0 deletions README.md
@@ -0,0 +1,27 @@
📺 Watch [How to Submit a Pull Request in 100 Seconds]() on YouTube

![Fireship Sticker](https://firebasestorage.googleapis.com/v0/b/fireship-app.appspot.com/o/assets%2Fsticker-holo.png?alt=media&token=b41ebeaf-d5e9-4823-a294-5b11e63d7284)

🚨 This giveaway is for 200 limited-edition holographic stickers. The readme will be updated when supplies have been depleted.

# Free Sticker for a Pull Request

This project provides a node script that encrypts your mailing address with a public key.

## Instructions

Note: You must have Node 10 installed locally.

1. fork this repo
1. `git clone` your fork url
1. enter the project and run `npm install`
1. create a new branch with `git checkout -b ilikefreestuff`
1. run `npm start` to encrypt your address
1. create a new file named `stickers/<your-github-username>.txt` and paste in the encrypted string
1. run `git add .` and `git commit -m "your-message"`
1. `git push origin mysticker`
1. open new pull request on Github

Your commit must contain **only 1 file**. Verify that you did not change any existing code before making your PR.

[Follow me on Github](https://github.com/codediodeio) to keep track of new projects landing Fireship 🔥
14 changes: 14 additions & 0 deletions decrypt.js
@@ -0,0 +1,14 @@
const NodeRSA = require('node-rsa');
const fs = require('fs');

(async () => {
const keyData = fs.readFileSync('private.key', 'utf8');
const test = fs.readFileSync('stickers/codediodeio.txt', 'utf8');

const key = NodeRSA();
key.importKey(keyData);

const decrypted = key.decrypt(test, 'utf8');

console.log(decrypted);
})();
68 changes: 68 additions & 0 deletions index.js
@@ -0,0 +1,68 @@
const inquirer = require('inquirer');
const chalk = require('chalk');
const NodeRSA = require('node-rsa');
const fs = require('fs');

(async () => {
const answers = await inquirer.prompt([
{
type: 'input',
name: 'name',
message: "What's your name?"
},
{
type: 'input',
name: 'street',
message: 'Street address'
},
{
type: 'input',
name: 'street2',
message: 'Suite or Apt # (optional)'
},
{
type: 'input',
name: 'city',
message: 'City'
},
{
type: 'input',
name: 'state',
message: 'State/Region'
},
{
type: 'input',
name: 'zip',
message: 'Postal Code'
},
{
type: 'input',
name: 'country',
message: 'Country'
},
{
type: 'input',
name: 'notes',
message: 'Any special notes?'
}
]);

const keyData = fs.readFileSync('public.key', 'utf8');

const key = NodeRSA();
key.importKey(keyData);

const encrypted = key.encrypt(answers, 'base64');
console.log(chalk.yellow('------ copy below ------'));
console.log(chalk.green(encrypted));
console.log(chalk.yellow('------ copy above ------'));
console.log(`
${chalk.blueBright('Step 1:')} Copy the green text above - it's your encrypted address. Nobody can read it but me.
${chalk.blueBright('Step 2:')} Create a new file named ${chalk.bgBlue('stickers/<your-github-username>.txt')}. Paste in the green text.
${chalk.blueBright('Step 3:')} Submit a pull request on Github.
${chalk.blueBright('Step 4:')} Check your mailbox in a few weeks!
${chalk.bgKeyword('orange')(chalk.black(' Warning '))} Your PR should have exactly 1 new file. It may be rejected if multiple files are modified.
`);
})();
9 changes: 9 additions & 0 deletions keygen.js
@@ -0,0 +1,9 @@
const NodeRSA = require('node-rsa');
const fs = require('fs');

(async () => {
const key = new NodeRSA();
key.generateKeyPair();
fs.writeFileSync(`public.key`, key.exportKey('public'));
fs.writeFileSync(`private.key`, key.exportKey('private'));
})();

0 comments on commit 34ca5aa

Please sign in to comment.