libves 2.1.2 → 2.3.1

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.
package/README.md CHANGED
@@ -1,47 +1,46 @@
1
- ## libVES
1
+ # libVES
2
2
 
3
+ ### Browser PIN-based e2e encryption at-rest
4
+ ## Simple * Safe * Secure
3
5
 
4
- Simple, safe and secure e2e encryption for data at-rest.
5
6
 
7
+ [VESvault.com](https://vesvault.com) | [VES.host](https://ves.host) | [VESlocker.com](https://veslocker.com) | [demo.VES.world](https://demo.ves.world)
6
8
 
7
- https://VESvault.com
8
9
 
9
- https://VES.host
10
+ #### Instantiate libVES
10
11
 
12
+ var VES = new libVES({domain: 'x-myapp'});
11
13
 
12
- ; Instantiate libVES
13
14
 
14
- var VES = new libVES({domain: 'x-myapp'});
15
+ #### Authorize with VES in the same browser window
15
16
 
17
+ VES.flow(true).then(....)
16
18
 
17
- ; Authorize with VES in the same browser window
18
19
 
19
- VES.flow(true).then(....)
20
+ #### Or, authorize with VES via a popup window
20
21
 
22
+ VES.delegate().then(....)
21
23
 
22
- ; Or, authorize in a popup window
23
24
 
24
- VES.delegate().then(....)
25
+ #### Store an e2e encrypted value
25
26
 
27
+ VES.putValue('item-id', 'value')
26
28
 
27
- ; Store an e2e encrypted value
28
29
 
29
- VES.putValue('item-id', 'value')
30
+ #### Store a value and e2e share with other VES accounts
30
31
 
32
+ VES.putValue('item-id', 'value', [
33
+ {externalId: 'me@acme.com'},
34
+ {externalId: 'user1@acme.com'},
35
+ {externalId: 'user2@acme.com'}
36
+ ])
31
37
 
32
- ; Store a value and e2e share with other VES accounts
33
38
 
34
- VES.putValue('item-id', 'value', [{externalId: 'me@acme.com'}, {externalId: 'user1@acme.com'}, {externalId: 'user2@acme.com'}])
39
+ #### Retrieve a previously stored value
35
40
 
41
+ VES.getValue('item-id').then(function(value) { .... })
36
42
 
37
- ; Retrieve a previously stored value
38
43
 
39
- VES.getValue('item-id').then(function(value) { .... })
40
-
41
-
42
- See https://demo.ves.world
43
-
44
-
45
- Full API Docs:
44
+ ### Full API Docs:
46
45
 
47
46
  https://ves.host/docs/libVES
package/libVES.node.js CHANGED
@@ -27,7 +27,7 @@
27
27
  *
28
28
  * @title libVES
29
29
  * @dev A JavaScript end-to-end encryption interface to VESvault REST API
30
- * @version 2.01
30
+ * @version 2.03
31
31
  *
32
32
  * @dev Official source code: https://github.com/vesvault/libVES
33
33
  *
@@ -141,7 +141,7 @@ libVES.prototype = {
141
141
  });
142
142
  },
143
143
  logout: function() {
144
- this.token = undefined;
144
+ this.token = this.userMe = this.vaultKey = undefined;
145
145
  return this.lock();
146
146
  },
147
147
  delegate: function(optns) {
@@ -191,11 +191,13 @@ libVES.prototype = {
191
191
  },
192
192
  authorize: function(msg) {
193
193
  var self = this;
194
- if (msg.token) this.token = msg.token;
195
- if (msg.domain) this.domain = msg.domain;
196
- if (msg.externalId) this.externalId = msg.externalId;
197
- return (msg.VESkey ? this.unlock(msg.VESkey) : this.me()).then(function() {
198
- return self;
194
+ return this.logout().then(function() {
195
+ if (msg.token) self.token = msg.token;
196
+ if (msg.domain) self.domain = msg.domain;
197
+ if (msg.externalId) self.externalId = msg.externalId;
198
+ return (msg.VESkey ? self.unlock(msg.VESkey) : self.me()).then(function() {
199
+ return self;
200
+ });
199
201
  });
200
202
  },
201
203
  carry: function(optns) {
@@ -2683,6 +2685,10 @@ libVES.Cipher.AES256CBC = function(rec) {
2683
2685
  this.init(rec);
2684
2686
  };
2685
2687
 
2688
+ libVES.Cipher.AES256CFB = function(rec) {
2689
+ this.init(rec);
2690
+ };
2691
+
2686
2692
  libVES.Cipher.AES256GCM = function(rec) {
2687
2693
  this.init(rec);
2688
2694
  };
@@ -2713,6 +2719,7 @@ libVES.Cipher.AES.prototype = new libVES.Cipher({
2713
2719
  });
2714
2720
 
2715
2721
  libVES.Cipher.AES256CBC.prototype = new libVES.Cipher.AES({
2722
+ a: 'AES256CBC',
2716
2723
  algo: 'AES-CBC',
2717
2724
  keySize: 32,
2718
2725
  ivSize: 16
@@ -2736,6 +2743,11 @@ libVES.Cipher.AES256CBC.info = function(chain,optns) {
2736
2743
  return Promise.resolve({algorithm: {name: 'AES-CBC', length: 256}});
2737
2744
  };
2738
2745
 
2746
+ libVES.Cipher.AES256CFB.prototype = new libVES.Cipher.AES({
2747
+ a: 'AES256CFB',
2748
+ algo: 'AES-CFB'
2749
+ });
2750
+
2739
2751
  libVES.Cipher.AES256GCM.prototype = new libVES.Cipher.AES({
2740
2752
  algo: 'AES-GCM',
2741
2753
  keySize: 32,
@@ -2743,6 +2755,7 @@ libVES.Cipher.AES256GCM.prototype = new libVES.Cipher.AES({
2743
2755
  });
2744
2756
 
2745
2757
  libVES.Cipher.AES256GCMp.prototype = new libVES.Cipher.AES({
2758
+ a: 'AES256GCMp',
2746
2759
  algo: 'AES-GCM',
2747
2760
  keySize: 32,
2748
2761
  ivSize: 12,
@@ -2764,6 +2777,7 @@ libVES.Cipher.AES256GCMp.prototype = new libVES.Cipher.AES({
2764
2777
  });
2765
2778
 
2766
2779
  libVES.Cipher.AES256GCM1K.prototype = new libVES.Cipher.AES({
2780
+ a: 'AES256GCM1K',
2767
2781
  algo: 'AES-GCM',
2768
2782
  keySize: 32,
2769
2783
  ivSize: 12,
@@ -3204,9 +3218,12 @@ libVES.Delegate = {
3204
3218
  } catch(e) {
3205
3219
  window.alert(self.htmlBlockerMsg);
3206
3220
  }
3207
- window.addEventListener('message',self.listener.bind(self));
3208
- window.addEventListener('focus',self.chkCancel.bind(self));
3209
- window.addEventListener('beforeunload',self.cancel.bind(self));
3221
+ if (!self.listening) {
3222
+ window.addEventListener('message',self.listener.bind(self));
3223
+ window.addEventListener('focus',self.chkCancel.bind(self));
3224
+ window.addEventListener('beforeunload',self.cancel.bind(self));
3225
+ self.listening = true;
3226
+ }
3210
3227
  window.clearInterval(self.popupInterval);
3211
3228
  self.popupInterval = window.setInterval(self.chkCancel.bind(self),1000);
3212
3229
  });
@@ -3458,8 +3475,12 @@ libVES.Flow.prototype.click = function(a) {
3458
3475
  var self = this;
3459
3476
  (a.origin == this.origin ? self.store() : self.addToken(a.href).then(function(url) {
3460
3477
  a.href = url;
3461
- })).then(function() {
3478
+ })).catch(function(e) {
3479
+ if (!e || e.code != 'NotFound') throw e;
3480
+ }).then(function() {
3462
3481
  document.location.href = a.href;
3482
+ }).catch(function(e) {
3483
+ console.log(e);
3463
3484
  });
3464
3485
  return false;
3465
3486
  };
Binary file
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "libves",
3
- "version": "2.1.2",
4
- "description": "Simple, safe and secure end-to-end encryption for data at-rest",
3
+ "version": "2.3.1",
4
+ "description": "Simple, safe and secure end-to-end encryption at-rest",
5
5
  "main": "libVES.node.js",
6
6
  "scripts": {
7
7
  "test": "echo \"No test defined\" && exit 1"
@@ -24,7 +24,7 @@
24
24
  "dependencies": {
25
25
  "crypto": "*",
26
26
  "subtle": "*",
27
- "xh2r": "*"
27
+ "xhr2": "*"
28
28
  },
29
29
  "author": "jz@vesvault.com",
30
30
  "license": "GPL-3.0",
package/libves-2.1.2.tgz DELETED
Binary file