Package Exports
- @cartago-git/keyer
- @cartago-git/keyer/src/index.ts
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@cartago-git/keyer) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Keyer
This app is just a library to encrypt and decrypt texts and any other variables with a salt.
Secret encrypter for keys, api-keys, envs or others
To install
To install in project
npm install @cartago-git/keyer
or for global install
npm install --global @cartago-git/keyer
CLI
CLI Basic
Keyer Cli:
Usage: keyer [options] or [command]
-v output Keyer current version
-er, encrypt-route <encrypt-route> route from file to encrypt (default: ".env")
-edr, encrypted-route <encrypted-route> route from file when it will be encrypted (default: "keyer/encrypted.txt")
-dr, decrypted-route <decrypted-route> route from file when it will be decrypted (default: "keyer/decrypted.txt")
-h, --help output Keyer help
Commands:
encrypt [options] encrypt command cli
decrypt [options] decrypt command cliKeyer encrypt:
Usage: keyer encrypt [options]
encrypt command cli
Options:
-f, --file <file> route where is the file for encrypting (default: ".env")
-o, --output <output> route where file encrypted will create (default: "keyer/encrypted.txt")
-s, --salt <salt> secret salt (required option)
-h, --help output Keyer helpKeyer decrypt:
Usage: keyer decrypt [options]
decrypt command cli
Options:
-f, --file <file> route file (default: "keyer/encrypted.txt")
-o, --output <output> route where file will decrypted (default: "keyer/decrypted.txt")
-s, --salt <salt> secret salt (required option)
-co, --create-output create file output (default: false)
-h, --help output Keyer helpLibrary
To use methods
For Example:
import {encrypt, decrypt, encryptAny, decriptAny}
const salt = "This is just a secret salt that you must hide for others";
const apiKey = 'api_false_example_to_show'
// To get the encrypted Hash
const apiKeyHash = encrypt({
toEncrypt: apiKey,
secretSalt: salt
})
// to get decrypt the Hash
const apiKeyDecrypted = decrypt({
toDecrypt: apiKeyHash,
secretSalt: salt
})
// NOTE - With an object or other var kind
const objectToEncrypt = {
name: 'Joe',
prename: 'Doe',
age: 30
}
// To get the encrypted Hash
const objectHash = encryptAny({
toEncrypt: objectToEncrypt,
secretSalt: salt
})
// to get decrypt Hash
const objectDecrypted({
toDecrypt: objectHash,
secretSalt: salt
})
console.log({apiKeyHash, apiKeyDecrypted, objectHash, objectDecrypted})Optional
Every function has a showLog prop in true, just put it to false if doesnt want the encrypt log
encrypt({
toEncrypt: apiKey,
secretSalt: salt,
showLog: false
})Methods for console and create files encrypted/decrypted
import {keyerCommand, encryptCommand, decryptCommand}keyerCommand({
encryptRoute: string;
encryptedRoute: string;
decryptedRoute: string;
})encryptCommand({
file: string;
output: string;
salt: string;
})decryptCommand({
file: string;
output: string;
salt: string;
createOutput?: boolean // (default:false)
})