securejs
Go to documentation
Download
npm i securejs
Usage
JavaScript
const secure =
TypeScript
Creating a new ID
secure // Output: 2o9GCroXsD
secure // Output: SUPRJVKXQL
secure // Output: 6724359154
secure // Output: 12345678910
Encryption / Decryption
// text, keysecure // Output: U2FsdGVkX1/IdEzGVRJ2NvQeVSImQrda0d4ucwpolRa4o7WPdspqxHWdz39Mz32G
// encrypted text, keysecure // Output: securejs is the best
Documentation
SecureOptions
case
uppercase
: Make all the letters upppercase
lowercase
: Make all the letters lowercase
any
(default): Randomize the capitalization
makeId
Creates a new ID with the specified character generation function
length
: The length of the new ID
each
: The character generation function. Takes in the index of the character, and returns a new character determined by the function
newId
Creates a new ID with the specified length, type, and options
length
: The length of the new ID
type
: default is "any"
if type = "any"
or left blank: numbers and letters
if type = "number"
: just numbers
if type = "string"
: just letters
options
(type SecureOptions): To further customize the ID creation. Must explicitly specify the type
if you want to add options
encrypt
Encrypts text with a key
text
: What you want to encrypt
key
: The encryption key
decrypt
Decrypts encrypted text with a key
text
: The encrypted text you want to decrypt
key
: The encryption key (the key you encrypted the original text with)