-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CHANGE] #84, writing key check to be simpler, introduced scripts for…
… setting up environment variables
- Loading branch information
1 parent
b083e02
commit cdf24f8
Showing
8 changed files
with
68 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Usage: open console run: node init/generateKey.js | ||
* type desired key and hit enter | ||
* copy output to .env add a line starting with: | ||
* KEY= | ||
* directly followed by your output | ||
*/ | ||
|
||
// Import required modules | ||
const readline = require('readline'); | ||
|
||
// set up readline to read input from the console | ||
const rl = readline.createInterface({ | ||
input: process.stdin, | ||
output: process.stdout | ||
}); | ||
|
||
// Prompt user for input | ||
rl.question('Enter the string to be encoded: ', (input) => { | ||
// encode to escape special chars | ||
const escapedString = encodeURIComponent(input); | ||
|
||
// convert the escaped string to base64 | ||
const base64String = Buffer.from(escapedString).toString('base64'); | ||
|
||
// print the result | ||
console.log('Base64 Encoded String:', base64String); | ||
|
||
rl.close(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* This is used to setup Passwords initially | ||
* You can create passwords using the same logic as in the environment | ||
* Prerequisite: You need to have KEY already generated! | ||
* Run the build command from the package.json (npm run build) | ||
* Then call the compiled version of this script using the key as environment variable like so: | ||
* KEY=your-key node ./init/generatePassword.js | ||
* Enter your password | ||
* Copy that to the Environment Variables and .env file | ||
* USER-WHATEVER= | ||
* followed by the output of the console | ||
*/ | ||
|
||
// Import required modules | ||
const readline = require('readline'); | ||
const { crypt } = require('../dist/scripts/crypt'); | ||
|
||
// Set up readline to read input from the console | ||
const rl = readline.createInterface({ | ||
input: process.stdin, | ||
output: process.stdout | ||
}); | ||
|
||
// Prompt user for input | ||
rl.question('Enter Password to be generated: ', async (input) => { | ||
const cryptedPassword = await crypt(input); | ||
console.log(cryptedPassword); | ||
rl.close(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters