Core Encryption
This module offers a multitude of encryption functions
AES-256 Encryption
This allows you to encrypt/decrypt any piece of data. Encryption keys are stored with SelfGuard.
Encrypt (AES-256)
A string or object that you want encrypted.
await sg.encrypt(value);
Decrypt (AES-256)
A string or object that you want decrypted.
The id of the encryption key returned from sg.encrypt
.
await sg.decrypt(value, encryption_key_id);
Password Encryption
This allows you to encrypt/decrypt any piece of data with a password. Nothing is stored with SelfGuard here.
Encrypt With Password
A string or object that you want encrypted.
The password you want to use to encrypt the value.
sg.encryptWithPassword(value,password);
Decrypt With Password
A string or object that you want decrypted.
The password you want to use to decrypt the value.
sg.decryptWithPassword(value, password);
Data Tokenization
This allows you to encrypt data and store the encrypted data with SelfGuard itself. Each piece of data encrypted will have a respective token id.
Tokenize
A string or object that you want tokenized.
await sg.tokenize(value);
Detokenize
The token id of the data previously tokenized using sg.tokenize
await sg.detokenize(token_id);
Encrypted Key/Value Storage
This allows you to store any key value data where the value is encrypted.
Put
The key with which you want to associate the value.
A string or object that you want encrypted.
await sg.put(key, value);
Get
The key with which you want to retrieve the value.
await sg.get(key);
Get All Keys
await sg.getKeys();