-
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.
* Add api key encryption secret input field * Add api secret input to storage * Add function to use encrypted api key * Show icon fetch error in dropdown * Add script to encrypt api key * Add instructions for new api keys / secrets to README
- Loading branch information
1 parent
57c206c
commit 1f50187
Showing
9 changed files
with
79 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const readline = require("readline"); | ||
const cryptoJS = require("crypto-js"); | ||
|
||
const rl = readline.createInterface({ | ||
input: process.stdin, | ||
output: process.stdout, | ||
}); | ||
|
||
rl.question("Enter Freepik API key from 1Password: ", (apiKey) => { | ||
rl.question("Enter API key secret from 1Password: ", (secret) => { | ||
console.log(`Encrypted API key: ${cryptoJS.AES.encrypt(apiKey, secret).toString()}`); | ||
rl.close(); | ||
}); | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,17 @@ | ||
import CryptoJS from "crypto-js"; | ||
|
||
const encryptedFreepikApiKey = | ||
"U2FsdGVkX1+uakX7Pa7rDwZUW41gsxUcc5Mk1Zf9Ff/RkAhy5TT6snpzfSoe7kn+A7ulqhvrLMasq4hJ/KkwoA=="; | ||
|
||
export function storeFreepikApiKeySecret() { | ||
document.getElementById("save-api-key-secret").onclick = () => { | ||
const encryptionSecret = (<HTMLInputElement>document.getElementById("api-key-secret")).value; | ||
localStorage.setItem("apiKeySecret", encryptionSecret); | ||
(<HTMLTextAreaElement>document.getElementById("api-key-secret")).value = "API key secret stored"; | ||
}; | ||
} | ||
|
||
export function getDecryptedFreepikApiKey(): string { | ||
const decryptedBytes = CryptoJS.AES.decrypt(encryptedFreepikApiKey, localStorage.getItem("apiKeySecret")); | ||
return decryptedBytes.toString(CryptoJS.enc.Utf8); | ||
} |
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