Gathering detailed insights and metrics for ng-cryptostore
Gathering detailed insights and metrics for ng-cryptostore
npm install ng-cryptostore
Typescript
Module System
Node Version
NPM Version
69
Supply Chain
96.4
Quality
75.9
Maintenance
100
Vulnerability
98.9
License
TypeScript (75.93%)
HTML (13.08%)
JavaScript (10.69%)
CSS (0.3%)
Total Downloads
3,224
Last Day
9
Last Week
39
Last Month
116
Last Year
672
3 Stars
73 Commits
2 Watching
2 Branches
1 Contributors
Minified
Minified + Gzipped
Latest Version
16.0.0
Package Id
ng-cryptostore@16.0.0
Unpacked Size
106.21 kB
Size
19.64 kB
File Count
20
NPM Version
10.2.3
Node Version
18.19.0
Publised On
06 Dec 2023
Cumulative downloads
Total Downloads
Last day
-79.1%
9
Compared to previous day
Last week
-22%
39
Compared to previous week
Last month
18.4%
116
Compared to previous month
Last year
-31.1%
672
Compared to previous year
2
This library was generated with Angular CLI version 14.2.10. to store data (string, object or array of objects) in local stores or the session store with crypto-js package
1... 2import { StorageModule } from 'ng-cryptostore'; 3 4@NgModule({ 5 declarations: [ 6 ... 7 ], 8 imports: [ 9 ... 10 // ( localStorage | sessionStorage | cookies ) 11 StorageModule.withConfig({ storageType: "localStorage" }) 12 ], 13 providers: [...], 14 bootstrap: [...] 15}) 16export class AppModule { }
1import { StorageService } from 'ng-cryptostore'; 2 3@Component({ 4 selector: 'app-root', 5 templateUrl: './app.component.html', 6 styleUrls: ['./app.component.css'] 7}) 8export class AppComponent implements OnInit { 9 10 constructor(private store:StorageService){} // <---- dependency injection (DI) 11 12 ngOnInit(): void { 13 this.store.set('fruits',[{name:'fraise',icons:'🍓'},{name:'banana',icons:'🍌'}]) 14 } 15}
1set(name: string, data: any, secret?: string): Promise<void>; 2get(name: string, secret?: string): any; 3asyncGet(name: string, secret?: string): Promise<any>; 4getEncrypted(name: string): any 5remove(name: string): void; 6check(name: string): boolean; 7getItemLength(name: string, secret?: string): Promise<number>; 8clearAll(): void; 9crypt(data: any, secret?: string): Promise<any>; 10decrypt(scripts: string, secret?: string): Promise<any>;
(method) set(name: string, data: any, secret?: string): Promise
method 'set' store the data for example :
1// store array of objects encrypted 2const fruitsArray = [ 3 { name: "fraise", icons: "🍓" }, 4 { name: "banana", icons: "🍌" }, 5]; 6this.store.set("fruitsArray", fruitsArray); 7 8// store object encrypted 9this.store.set("fruit", { name: "orange", icons: "🍊" }); 10 11// store string encrypted 12this.store.set("strings", "fruits: orange,fraise,banana and ..."); 13 14// store numbers encrypted 15this.store.set("numbers", 1234567892121);
(method) get(name: string, secret?: string): any
method 'get' read the data for example :
1// get fruits array decrypted 2console.log(this.store.get("fruitsArray")); // [{…}, {…}] 3 4// get fruit object decrypted 5console.log(this.store.get("fruit")); // {…} 6 7// get fruit strings decrypted 8console.log(this.store.get("strings")); // fruits: orange,fraise,banana and ... 9 10// get numbers decrypted 11console.log(this.store.get("numbers")); // 1234567892121 12 13// in case the item does not exist 14console.log(this.store.get("this_item_does_not_exist")); // ""
(method) asyncGet(name: string, secret?: string): Promise
method 'asyncGet' read the data with promise for example :
1// get data decrypted 2this.store.asyncGet("fruitsArray").then((res) => { 3 console.log(res); // [{…}, {…}] 4}); 5 6// Or 7 8// get data decrypted 9console.log(await this.store.asyncGet("fruitsArray")); // [{…}, {…}]
(method) getEncrypted(name: string): any
method 'getEncrypted' read the data for example :
1// get data encrypted 2console.log(this.store.getEncrypted("fruitsArray")); // U2FsdGVkX18lKfMIr8dpIGGLy...
(method) check(name: string): boolean
method 'check' check the existence of the key and the value for example :
1// check if this item exist, if exist return true 2console.log(this.store.check("fruit")); // true or false
(method) remove(name: string): void
method 'remove' remove one item by name for example :
1this.store.remove("fruit");
(method) clearAll(): void
method 'clearAll' remove all items for example :
1this.store.clearAll();
(method) getItemLength(name: string, secret?: string): Promise
method 'getItemLength' decrypt and get length for example :
1console.log(this.store.getItemLength("fruit")); // 21
(method) crypt(data: any, secret?: string): Promise
method 'crypt' return data encrypted for example :
1const data = [ 2 { name: "fraise", icons: "🍓" }, 3 { name: "banana", icons: "🍌" }, 4]; 5 6console.log(await this.store.crypt(data)); // U2FsdGVkX18lKfMIr8dpIGGLy...
(method) decrypt(scripts: string, secret?: string): Promise
method 'decrypt' return data decrypted for example :
1const dataEncrypted = "U2FsdGVkX18lKfMIr8dpIGGLy..."; 2 3console.log(await this.store.decrypt(dataEncrypted)); // [{ name: "fraise", icons: "🍓" },{ name: "banana", icons: "🍌"}]
the secret is optional but if you used a custom secret in setItem you need to store it somewhere to use it later in getItem
1// set data encrypted with token !secret token @123456 2this.store.set( 3 "fruits", 4 [{ name: "orange", icons: "🍊" }], 5 "!secret token @123456" 6); 7 8// get data using token "!secret token @123456" 9 10this.store.asyncGet("fruits", "!secret token @123456").then((res) => { 11 console.log(res); // [{…}] 12}); 13 14console.log(this.store.get("fruits", "!secret token @123456")); // [{…}, {…}] 15 16console.log(this.store.getItemLength("fruit", "!secret token @123456")); // 1
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
Found 0/28 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
27 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More