DevDocsv1.0.1

CryptoStorage

CryptoStorage stores data in a local storeage using standard and secure encryption algorithms.

Install

"crypto-js-storage" can be installed and used from NPM.
Install now

Reference

Top of Reference.
Learn more

Changelog

Learn more

Install

Install with NPM
npm install --save crypto-js-storage

Storage Classes

About storage with cryptographic algorithms.

AES Storage

The Advanced Encryption Standard (AES) is a U.S. Federal Information Processing Standard (FIPS).
It was selected after a 5-year process where 15 competing designs were evaluated.
import {AesStorage} from 'crypto-js-storage';

AesStorage.setItem('myCat', 'Tom', 'Secret Passphrase');
const cat = AesStorage.getItem('myCat', 'Secret Passphrase');
console.log(cat);// =>Tom
<script src="node_modules/crypto-js-storage/dist/build.js"></script>
<script>
const {AesStorage} = window.CryptoJsStorage;

AesStorage.setItem('myCat', 'Tom', 'Secret Passphrase');
const cat = AesStorage.getItem('myCat', 'Secret Passphrase');
console.log(cat);// =>Tom
</script>

Static Methods of the AES Storage

Method Description
setItem(key: string, value: string, secret: string): void Save Data to Local Storage.
AesStorage.setItem('myCat', 'Tom', 'Secret Passphrase');
getItem(key: string, secret :string): string|null Read Data from Local Storage.
const cat = AesStorage.getItem('myCat', 'Secret Passphrase');
removeItem(key: string): void Remove Data from Local Storage.
AesStorage.removeItem('myCat');
clear(): void Remove All (Clear Local Storage).
AesStorage.clear();

DES Storage

DES is a previously dominant algorithm for encryption, and was published as an official Federal Information Processing Standard (FIPS).
DES is now considered to be insecure due to the small key size.
import {DesStorage} from 'crypto-js-storage';

DesStorage.setItem('myCat', 'Tom', 'Secret Passphrase');
const cat = DesStorage.getItem('myCat', 'Secret Passphrase');
console.log(cat);// =>Tom
<script src="node_modules/crypto-js-storage/dist/build.js"></script>
<script>
const {DesStorage} = window.CryptoJsStorage;

DesStorage.setItem('myCat', 'Tom', 'Secret Passphrase');
const cat = DesStorage.getItem('myCat', 'Secret Passphrase');
console.log(cat);// =>Tom
</script>

Static Methods of the DES Storage

Method Description
setItem(key: string, value: string, secret: string): void Save Data to Local Storage.
DesStorage.setItem('myCat', 'Tom', 'Secret Passphrase');
getItem(key: string, secret :string): string|null Read Data from Local Storage.
const cat = DesStorage.getItem('myCat', 'Secret Passphrase');
removeItem(key: string): void Remove Data from Local Storage.
DesStorage.removeItem('myCat');
clear(): void Remove All (Clear Local Storage).
DesStorage.clear();

Triple DES Storage

Triple DES applies DES three times to each block to increase the key size.
The algorithm is believed to be secure in this form.
import {TripleDesStorage} from 'crypto-js-storage';

TripleDesStorage.setItem('myCat', 'Tom', 'Secret Passphrase');
const cat = TripleDesStorage.getItem('myCat', 'Secret Passphrase');
console.log(cat);// =>Tom
<script src="node_modules/crypto-js-storage/dist/build.js"></script>
<script>
const {TripleDesStorage} = window.CryptoJsStorage;

TripleDesStorage.setItem('myCat', 'Tom', 'Secret Passphrase');
const cat = TripleDesStorage.getItem('myCat', 'Secret Passphrase');
console.log(cat);// =>Tom
</script>

Static Methods of the Triple DES Storage

Method Description
setItem(key: string, value: string, secret: string): void Save Data to Local Storage.
TripleDesStorage.setItem('myCat', 'Tom', 'Secret Passphrase');
getItem(key: string, secret :string): string|null Read Data from Local Storage.
const cat = TripleDesStorage.getItem('myCat', 'Secret Passphrase');
removeItem(key: string): void Remove Data from Local Storage.
TripleDesStorage.removeItem('myCat');
clear(): void Remove All (Clear Local Storage).
TripleDesStorage.clear();

Rabbit Storage

Rabbit is a high-performance stream cipher and a finalist in the eSTREAM Portfolio.
It is one of the four designs selected after a 3 1/2-year process where 22 designs were evaluated.
import {RabbitStorage} from 'crypto-js-storage';

RabbitStorage.setItem('myCat', 'Tom', 'Secret Passphrase');
const cat = RabbitStorage.getItem('myCat', 'Secret Passphrase');
console.log(cat);// =>Tom
<script src="node_modules/crypto-js-storage/dist/build.js"></script>
<script>
const {RabbitStorage} = window.CryptoJsStorage;

RabbitStorage.setItem('myCat', 'Tom', 'Secret Passphrase');
const cat = RabbitStorage.getItem('myCat', 'Secret Passphrase');
console.log(cat);// =>Tom
</script>

Static Methods of the Rabbit Storage

Method Description
setItem(key: string, value: string, secret: string): void Save Data to Local Storage.
RabbitStorage.setItem('myCat', 'Tom', 'Secret Passphrase');
getItem(key: string, secret :string): string|null Read Data from Local Storage.
const cat = RabbitStorage.getItem('myCat', 'Secret Passphrase');
removeItem(key: string): void Remove Data from Local Storage.
RabbitStorage.removeItem('myCat');
clear(): void Remove All (Clear Local Storage).
RabbitStorage.clear();

RC4 Storage

RC4 is a widely-used stream cipher.
It's used in popular protocols such as SSL and WEP.
Although remarkable for its simplicity and speed, the algorithm's history doesn't inspire confidence in its security.
import {RC4Storage} from 'crypto-js-storage';

RC4Storage.setItem('myCat', 'Tom', 'Secret Passphrase');
const cat = RC4Storage.getItem('myCat', 'Secret Passphrase');
console.log(cat);// =>Tom
<script src="node_modules/crypto-js-storage/dist/build.js"></script>
<script>
const {RC4Storage} = window.CryptoJsStorage;

RC4Storage.setItem('myCat', 'Tom', 'Secret Passphrase');
const cat = RC4Storage.getItem('myCat', 'Secret Passphrase');
console.log(cat);// =>Tom
</script>

Static Methods of the RC4 Storage

Method Description
setItem(key: string, value: string, secret: string): void Save Data to Local Storage.
RC4Storage.setItem('myCat', 'Tom', 'Secret Passphrase');
getItem(key: string, secret :string): string|null Read Data from Local Storage.
const cat = RC4Storage.getItem('myCat', 'Secret Passphrase');
removeItem(key: string): void Remove Data from Local Storage.
RC4Storage.removeItem('myCat');
clear(): void Remove All (Clear Local Storage).
RC4Storage.clear();

Changelog

Changelog is available here.