spd-lib 1.1.4 → 1.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +11 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -90,15 +90,25 @@ this.salt = salt;
90
90
  }
91
91
 
92
92
  async extractData() {
93
+ return new Promise(async(res,rej)=>{
94
+ try{
93
95
  await sodium.ready;
94
96
  let extractedFiles = {};
95
97
  this.data.forEach(async dat => {
98
+ try{
96
99
  const decryptedData = sodium.crypto_secretbox_open_easy(dat.data, dat.nonce, this.userKey);
97
100
  const decompressedData = zlib.inflateSync(decryptedData);
98
101
  const dt = decompressedData.toString('utf8');
99
102
  extractedFiles[dat.dataName] = await this.CSTI(dt, dat.dataType);
103
+ }catch{
104
+ rej()
105
+ }
100
106
  });
101
- return extractedFiles;
107
+ res(extractedFiles);
108
+ }catch{
109
+ rej()
110
+ }
111
+ })
102
112
  }
103
113
 
104
114
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spd-lib",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "description": "SPD or Secure Packaged Data is a compress PQC protected file format to store sensitive data localy",
5
5
  "main": "index.js",
6
6
  "scripts": {