4.0.2 ā€¢ Published 6 months ago

crypto-browser-storage v4.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

Crypto Browser Storage

ā˜¢ A simple package for secure local storage data by encryption using Crypto.JS. Project generated with angular version 12.2.0, sou must need an Angular Project ( version >= 12.2.x )

How to use

  • Use npm i crypto-browser-storage
  • Inject to your component or service as Dependency Injection
  • Then you will be able to access crypto-browser-storage's library functions,
    • setCache
    • getCache
    • removeCacheByKey
    • clearAllCache

Angular Compatibility Version

  • For ng v12.x.x use npm i crypto-browser-storage@1.0.3
  • For ng v14.x.x use npm i crypto-browser-storage@1.4.0
  • For ng v15.x.x use npm i crypto-browser-storage@2.1.0
  • For ng v16.x.x use npm i crypto-browser-storage@3.0.0
  • For ng v17.x.x use npm i crypto-browser-storage@4.0.2

For Angular Version 17 (only) šŸŽ‰

Now you can provide your custom encryption key. To provide your custom encryption key you have to follow this instruction. Provide CRYPTO_HASH_KEY in app.module.ts. Example:

providers: [
    ....
    CryptoBrowserStorageService,
    { provide: CRYPTO_HASH_KEY, useValue: 'YOUR_KEY_HERE' }
  ]

Sample Code Snippet

import { CryptoBrowserStorageService } from 'crypto-browser-storage';

export class AppComponent {

constructor(private cache: CryptoBrowserStorageService) {}


    tests() {
    
    this.cache.setCache("Posts1", [{"id": 1, "name": "Sample"}]);
    this.cache.setCache("Posts2", ["id", "name", "Sample"]);
    this.cache.setCache("Posts3", 3);
    this.cache.setCache("Posts5", {"id": 4, "name": "Sample"});
    
    // this.cache.removeCacheByKey("Posts1")
    
    console.log(this.cache.getCache("Posts1"))
    console.log(this.cache.getCache("Posts2"))
    console.log(this.cache.getCache("Posts3"))
    console.log(this.cache.getCache("Posts5"))

    this.cache.clearAllCache();
    
    }

}

End result of the following tests() method is bellow,

Screenshot 2021-10-30 204648

Screenshot 2021-10-30 205713

4.0.1

6 months ago

4.0.0

6 months ago

4.0.2

6 months ago

3.0.0

10 months ago

1.1.41-beta

1 year ago

1.0.6

1 year ago

1.1.4

1 year ago

1.0.5

1 year ago

1.4.0

1 year ago

2.0.3

1 year ago

2.0.2

1 year ago

1.1.42-beta

1 year ago

2.1.0

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

0.0.1

3 years ago