keybase-proofs 2.3.33 → 2.3.35

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/lib/schema3.js CHANGED
@@ -1,16 +1,22 @@
1
- // Generated by IcedCoffeeScript 108.0.12
1
+ // Generated by IcedCoffeeScript 108.0.11
2
2
  (function() {
3
- var Array, Binary, Bool, ChainType, Dict, Int, KID, LinkType, Node, Object, Or, Path, PtkType, Seqno, String, StringEnum, Struct, Time, Value, mkerr, parse,
3
+ var Array, Binary, Bool, ChainType, Dict, Int, KID, LinkType, Node, Object, Or, Path, PtkType, Seqno, String, StringEnum, Struct, Time, Value, get_own, has_own, is_reserved_key_name, mkerr, parse, _ref,
4
4
  __hasProp = {}.hasOwnProperty,
5
5
  __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
6
6
  __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
7
7
 
8
8
  parse = require('./parse3');
9
9
 
10
+ _ref = require('./util'), has_own = _ref.has_own, get_own = _ref.get_own;
11
+
10
12
  mkerr = function(path, err) {
11
13
  return new Error("At " + (path.toString()) + ": " + err);
12
14
  };
13
15
 
16
+ is_reserved_key_name = function(k) {
17
+ return k === '__proto__';
18
+ };
19
+
14
20
  Path = (function() {
15
21
  function Path(v) {
16
22
  this._v = v || [];
@@ -84,7 +90,7 @@
84
90
  return null;
85
91
  }
86
92
  if (obj == null) {
87
- mkerr(path, "value cannot be null");
93
+ return mkerr(path, "value cannot be null");
88
94
  }
89
95
  return checker._check({
90
96
  path: path,
@@ -100,15 +106,20 @@
100
106
  __extends(Dict, _super);
101
107
 
102
108
  function Dict(_arg) {
103
- var keys;
109
+ var k, keys;
104
110
  keys = _arg.keys;
111
+ for (k in keys) {
112
+ if (is_reserved_key_name(k)) {
113
+ throw new Error("schema key name is not allowed: " + k);
114
+ }
115
+ }
105
116
  this._keys = keys;
106
117
  this._allow_extra_keys = false;
107
118
  Dict.__super__.constructor.apply(this, arguments);
108
119
  }
109
120
 
110
121
  Dict.prototype._check = function(_arg) {
111
- var checker, err, k, new_path, obj, path, v, _ref;
122
+ var checker, err, k, new_path, obj, path, v, _ref1;
112
123
  path = _arg.path, obj = _arg.obj;
113
124
  if (!parse.is_dict(obj)) {
114
125
  return mkerr(path, "need a dictionary");
@@ -116,7 +127,10 @@
116
127
  for (k in obj) {
117
128
  v = obj[k];
118
129
  new_path = path.extend(k);
119
- if ((checker = this._keys[k]) == null) {
130
+ if (is_reserved_key_name(k)) {
131
+ return mkerr(new_path, "key name is not allowed");
132
+ }
133
+ if ((checker = get_own(this._keys, k)) == null) {
120
134
  if (this._allow_extra_keys) {
121
135
  continue;
122
136
  }
@@ -130,11 +144,11 @@
130
144
  return err;
131
145
  }
132
146
  }
133
- _ref = this._keys;
134
- for (k in _ref) {
135
- v = _ref[k];
147
+ _ref1 = this._keys;
148
+ for (k in _ref1) {
149
+ v = _ref1[k];
136
150
  new_path = path.extend(k);
137
- if ((obj[k] == null) && !v.is_optional()) {
151
+ if (!has_own(obj, k) && !v.is_optional()) {
138
152
  return mkerr(new_path, "key is missing but is mandatory");
139
153
  }
140
154
  }
@@ -142,12 +156,12 @@
142
156
  };
143
157
 
144
158
  Dict.prototype.debug_localize = function(obj) {
145
- var k, ret, v, _ref;
159
+ var k, ret, v, _ref1;
146
160
  ret = {};
147
- _ref = this._keys;
148
- for (k in _ref) {
149
- v = _ref[k];
150
- if (obj[k] != null) {
161
+ _ref1 = this._keys;
162
+ for (k in _ref1) {
163
+ v = _ref1[k];
164
+ if (has_own(obj, k)) {
151
165
  ret[v._name || k] = v.debug_localize(obj[k]);
152
166
  }
153
167
  }
@@ -155,6 +169,9 @@
155
169
  };
156
170
 
157
171
  Dict.prototype.set_key = function(k, v) {
172
+ if (is_reserved_key_name(k)) {
173
+ throw new Error("schema key name is not allowed: " + k);
174
+ }
158
175
  return this._keys[k] = v;
159
176
  };
160
177
 
@@ -282,7 +299,7 @@
282
299
  var bot, obj, path;
283
300
  path = _arg.path, obj = _arg.obj;
284
301
  if (this._convert && typeof obj === 'string') {
285
- obj = Buffer.from(obj, 'hex');
302
+ obj = parse.decode_hex(obj);
286
303
  }
287
304
  if (!(Buffer.isBuffer(obj) && obj.length === this._len)) {
288
305
  return [mkerr(path, "value needs to be buffer of length " + this._len), null];
@@ -297,12 +314,12 @@
297
314
  };
298
315
 
299
316
  Binary.prototype._check = function(_arg) {
300
- var err, obj, path, _, _ref;
317
+ var err, obj, path, _, _ref1;
301
318
  path = _arg.path, obj = _arg.obj;
302
- _ref = this._convert_and_check({
319
+ _ref1 = this._convert_and_check({
303
320
  path: path,
304
321
  obj: obj
305
- }), err = _ref[0], _ = _ref[1];
322
+ }), err = _ref1[0], _ = _ref1[1];
306
323
  return err;
307
324
  };
308
325
 
@@ -321,17 +338,17 @@
321
338
  }
322
339
 
323
340
  KID.prototype._check = function(_arg) {
324
- var err, obj, path, typ, _ref, _ref1;
341
+ var err, obj, path, typ, _ref1, _ref2;
325
342
  path = _arg.path, obj = _arg.obj;
326
- _ref = this._convert_and_check({
343
+ _ref1 = this._convert_and_check({
327
344
  path: path,
328
345
  obj: obj
329
- }), err = _ref[0], obj = _ref[1];
346
+ }), err = _ref1[0], obj = _ref1[1];
330
347
  if (err != null) {
331
348
  return err;
332
349
  }
333
350
  typ = this._encryption ? [0x21] : [0x20, 0x01, 0x11, 0x13, 0x16];
334
- if ((obj[0] !== 0x01) || (_ref1 = obj[1], __indexOf.call(typ, _ref1) < 0) || (obj.slice(-1)[0] !== 0x0a)) {
351
+ if ((obj[0] !== 0x01) || (_ref2 = obj[1], __indexOf.call(typ, _ref2) < 0) || (obj.slice(-1)[0] !== 0x0a)) {
335
352
  return mkerr(path, "value must be a KID" + (this._encryption ? ' (for encryption)' : ''));
336
353
  }
337
354
  return null;
@@ -431,12 +448,12 @@
431
448
  }
432
449
 
433
450
  String.prototype._check = function(_arg) {
434
- var max_length, obj, path, _ref;
451
+ var max_length, obj, path, _ref1;
435
452
  path = _arg.path, obj = _arg.obj;
436
453
  if (typeof obj !== 'string' || obj.length === 0) {
437
454
  return mkerr(path, "value must be a string");
438
455
  }
439
- if ((max_length = (_ref = this._args) != null ? _ref.max_length : void 0) != null) {
456
+ if ((max_length = (_ref1 = this._args) != null ? _ref1.max_length : void 0) != null) {
440
457
  if (obj.length > max_length) {
441
458
  return mkerr(path, "value length needs to be < " + max_length);
442
459
  }
@@ -457,6 +474,9 @@
457
474
  this._values = {};
458
475
  for (_i = 0, _len = values.length; _i < _len; _i++) {
459
476
  v = values[_i];
477
+ if (is_reserved_key_name(v)) {
478
+ throw new Error("enum value is not allowed: " + v);
479
+ }
460
480
  this._values[v] = true;
461
481
  }
462
482
  }
@@ -467,7 +487,7 @@
467
487
  if (typeof obj !== 'string') {
468
488
  return mkerr(path, "value must be a string");
469
489
  }
470
- if (!this._values[obj]) {
490
+ if (!has_own(this._values, obj)) {
471
491
  return mkerr(path, "unknown enum value (" + obj + ")");
472
492
  }
473
493
  return null;
@@ -567,13 +587,13 @@
567
587
  }
568
588
 
569
589
  Or.prototype._check = function(_arg) {
570
- var obj, ok, path, t, _i, _len, _ref;
590
+ var obj, ok, path, t, _i, _len, _ref1;
571
591
  path = _arg.path, obj = _arg.obj;
572
592
  ok = false;
573
- _ref = this._terms;
574
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
575
- t = _ref[_i];
576
- if (!(t.check(obj))) {
593
+ _ref1 = this._terms;
594
+ for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
595
+ t = _ref1[_i];
596
+ if (!(!t.check(obj))) {
577
597
  continue;
578
598
  }
579
599
  ok = true;
@@ -113,7 +113,7 @@
113
113
  return (function(__iced_k) {
114
114
  __iced_deferrals = new iced.Deferrals(__iced_k, {
115
115
  parent: ___iced_passed_deferral,
116
- filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/proofs/src/scrapers/twitter.iced",
116
+ filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/keybase-proofs/src/scrapers/twitter.iced",
117
117
  funcname: "TwitterScraper.hunt2"
118
118
  });
119
119
  _this._get_body_api({
@@ -174,7 +174,7 @@
174
174
  };
175
175
 
176
176
  TwitterScraper.prototype.users_lookup = function(_arg, cb) {
177
- var batch_size, cursor_wait, dict, done, err, i, identifier, ids, include_entities, input_list, j, json, key, query, r, rc, res, responses, screen_names, u, ___iced_passed_deferral, __iced_deferrals, __iced_k;
177
+ var batch_size, cursor_wait, done, err, i, identifier, ids, include_entities, input_list, j, json, key, map, query, r, rc, res, responses, screen_names, u, ___iced_passed_deferral, __iced_deferrals, __iced_k;
178
178
  __iced_k = __iced_k_noop;
179
179
  ___iced_passed_deferral = iced.findDeferral(arguments);
180
180
  ids = _arg.ids, screen_names = _arg.screen_names, cursor_wait = _arg.cursor_wait, include_entities = _arg.include_entities;
@@ -222,7 +222,7 @@
222
222
  (function(__iced_k) {
223
223
  __iced_deferrals = new iced.Deferrals(__iced_k, {
224
224
  parent: ___iced_passed_deferral,
225
- filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/proofs/src/scrapers/twitter.iced",
225
+ filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/keybase-proofs/src/scrapers/twitter.iced",
226
226
  funcname: "TwitterScraper.users_lookup"
227
227
  });
228
228
  _this._get_body_api({
@@ -265,7 +265,7 @@
265
265
  (function(__iced_k) {
266
266
  __iced_deferrals = new iced.Deferrals(__iced_k, {
267
267
  parent: ___iced_passed_deferral,
268
- filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/proofs/src/scrapers/twitter.iced",
268
+ filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/keybase-proofs/src/scrapers/twitter.iced",
269
269
  funcname: "TwitterScraper.users_lookup"
270
270
  });
271
271
  setTimeout(__iced_deferrals.defer({
@@ -294,16 +294,16 @@
294
294
  return function() {
295
295
  var _i, _j, _len, _len1;
296
296
  if (responses != null ? responses.length : void 0) {
297
- dict = {};
297
+ map = new Map;
298
298
  key = ids != null ? "id_str" : "screen_name";
299
299
  for (_i = 0, _len = responses.length; _i < _len; _i++) {
300
300
  r = responses[_i];
301
- dict[r[key]] = r;
301
+ map.set(String(r[key]), r);
302
302
  }
303
303
  res = [];
304
304
  for (i = _j = 0, _len1 = input_list.length; _j < _len1; i = ++_j) {
305
305
  identifier = input_list[i];
306
- res[i] = dict[identifier] || null;
306
+ res[i] = map.get(String(identifier)) || null;
307
307
  }
308
308
  }
309
309
  return cb(err, res);
@@ -351,7 +351,7 @@
351
351
  (function(__iced_k) {
352
352
  __iced_deferrals = new iced.Deferrals(__iced_k, {
353
353
  parent: ___iced_passed_deferral,
354
- filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/proofs/src/scrapers/twitter.iced",
354
+ filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/keybase-proofs/src/scrapers/twitter.iced",
355
355
  funcname: "TwitterScraper.get_follower_ids"
356
356
  });
357
357
  _this._get_body_api({
@@ -397,7 +397,7 @@
397
397
  (function(__iced_k) {
398
398
  __iced_deferrals = new iced.Deferrals(__iced_k, {
399
399
  parent: ___iced_passed_deferral,
400
- filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/proofs/src/scrapers/twitter.iced",
400
+ filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/keybase-proofs/src/scrapers/twitter.iced",
401
401
  funcname: "TwitterScraper.get_follower_ids"
402
402
  });
403
403
  setTimeout(__iced_deferrals.defer({
@@ -518,7 +518,7 @@
518
518
  return (function(__iced_k) {
519
519
  __iced_deferrals = new iced.Deferrals(__iced_k, {
520
520
  parent: ___iced_passed_deferral,
521
- filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/proofs/src/scrapers/twitter.iced",
521
+ filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/keybase-proofs/src/scrapers/twitter.iced",
522
522
  funcname: "TwitterScraper.check_status"
523
523
  });
524
524
  _this._get_url_body({
@@ -605,7 +605,7 @@
605
605
  return (function(__iced_k) {
606
606
  __iced_deferrals = new iced.Deferrals(__iced_k, {
607
607
  parent: ___iced_passed_deferral,
608
- filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/proofs/src/scrapers/twitter.iced",
608
+ filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/keybase-proofs/src/scrapers/twitter.iced",
609
609
  funcname: "TwitterScraper._get_bearer_token"
610
610
  });
611
611
  bt.get(__iced_deferrals.defer({
@@ -637,7 +637,7 @@
637
637
  return (function(__iced_k) {
638
638
  __iced_deferrals = new iced.Deferrals(__iced_k, {
639
639
  parent: ___iced_passed_deferral,
640
- filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/proofs/src/scrapers/twitter.iced",
640
+ filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/keybase-proofs/src/scrapers/twitter.iced",
641
641
  funcname: "TwitterScraper._get_body_api"
642
642
  });
643
643
  _this._get_bearer_token(__iced_deferrals.defer({
@@ -670,7 +670,7 @@
670
670
  (function(__iced_k) {
671
671
  __iced_deferrals = new iced.Deferrals(__iced_k, {
672
672
  parent: ___iced_passed_deferral,
673
- filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/proofs/src/scrapers/twitter.iced",
673
+ filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/keybase-proofs/src/scrapers/twitter.iced",
674
674
  funcname: "TwitterScraper._get_body_api"
675
675
  });
676
676
  _this._get_url_body(args, __iced_deferrals.defer({
package/lib/subkey.js CHANGED
@@ -90,7 +90,7 @@
90
90
  (function(__iced_k) {
91
91
  __iced_deferrals = new iced.Deferrals(__iced_k, {
92
92
  parent: ___iced_passed_deferral,
93
- filename: "/Users/max/src/keybase/proofs/src/subkey.iced",
93
+ filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/keybase-proofs/src/subkey.iced",
94
94
  funcname: "SubkeyBase._v_generate"
95
95
  });
96
96
  _this.generate_json({
@@ -108,7 +108,7 @@
108
108
  (function(__iced_k) {
109
109
  __iced_deferrals = new iced.Deferrals(__iced_k, {
110
110
  parent: ___iced_passed_deferral,
111
- filename: "/Users/max/src/keybase/proofs/src/subkey.iced",
111
+ filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/keybase-proofs/src/subkey.iced",
112
112
  funcname: "SubkeyBase._v_generate"
113
113
  });
114
114
  eng.box(msg, esc(__iced_deferrals.defer({
@@ -165,16 +165,16 @@
165
165
  };
166
166
 
167
167
  SubkeyBase.prototype._v_check = function(_arg, cb) {
168
- var assert_pgp_hash, esc, json, ___iced_passed_deferral, __iced_deferrals, __iced_k;
168
+ var assert_pgp_hash, esc, json, pgp_max_length, ___iced_passed_deferral, __iced_deferrals, __iced_k;
169
169
  __iced_k = __iced_k_noop;
170
170
  ___iced_passed_deferral = iced.findDeferral(arguments);
171
- json = _arg.json, assert_pgp_hash = _arg.assert_pgp_hash;
171
+ json = _arg.json, assert_pgp_hash = _arg.assert_pgp_hash, pgp_max_length = _arg.pgp_max_length;
172
172
  esc = make_esc(cb, "SubkeyBase::_v_check");
173
173
  (function(_this) {
174
174
  return (function(__iced_k) {
175
175
  __iced_deferrals = new iced.Deferrals(__iced_k, {
176
176
  parent: ___iced_passed_deferral,
177
- filename: "/Users/max/src/keybase/proofs/src/subkey.iced",
177
+ filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/keybase-proofs/src/subkey.iced",
178
178
  funcname: "SubkeyBase._v_check"
179
179
  });
180
180
  SubkeyBase.__super__._v_check.call(_this, {
@@ -189,13 +189,14 @@
189
189
  (function(__iced_k) {
190
190
  __iced_deferrals = new iced.Deferrals(__iced_k, {
191
191
  parent: ___iced_passed_deferral,
192
- filename: "/Users/max/src/keybase/proofs/src/subkey.iced",
192
+ filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/keybase-proofs/src/subkey.iced",
193
193
  funcname: "SubkeyBase._v_check"
194
194
  });
195
195
  _this.reverse_sig_check({
196
196
  json: json,
197
197
  new_km: _this.get_new_km(),
198
- assert_pgp_hash: assert_pgp_hash
198
+ assert_pgp_hash: assert_pgp_hash,
199
+ pgp_max_length: pgp_max_length
199
200
  }, esc(__iced_deferrals.defer({
200
201
  lineno: 64
201
202
  })));
@@ -222,10 +223,10 @@
222
223
  };
223
224
 
224
225
  SubkeyBase.prototype.reverse_sig_check = function(_arg, cb) {
225
- var a, assert_pgp_hash, b, eng, err, esc, json, new_km, payload, raw, rsk, sig, subkm, ___iced_passed_deferral, __iced_deferrals, __iced_k;
226
+ var a, assert_pgp_hash, b, eng, err, esc, json, new_km, payload, pgp_max_length, raw, rsk, sig, subkm, ___iced_passed_deferral, __iced_deferrals, __iced_k;
226
227
  __iced_k = __iced_k_noop;
227
228
  ___iced_passed_deferral = iced.findDeferral(arguments);
228
- json = _arg.json, new_km = _arg.new_km, subkm = _arg.subkm, assert_pgp_hash = _arg.assert_pgp_hash;
229
+ json = _arg.json, new_km = _arg.new_km, subkm = _arg.subkm, assert_pgp_hash = _arg.assert_pgp_hash, pgp_max_length = _arg.pgp_max_length;
229
230
  new_km || (new_km = subkm);
230
231
  esc = make_esc(cb, "SubkeyBase::reverse_sig_check");
231
232
  err = null;
@@ -236,7 +237,7 @@
236
237
  (function(__iced_k) {
237
238
  __iced_deferrals = new iced.Deferrals(__iced_k, {
238
239
  parent: ___iced_passed_deferral,
239
- filename: "/Users/max/src/keybase/proofs/src/subkey.iced",
240
+ filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/keybase-proofs/src/subkey.iced",
240
241
  funcname: "SubkeyBase.reverse_sig_check"
241
242
  });
242
243
  eng.unbox(sig, esc(__iced_deferrals.defer({
@@ -245,16 +246,17 @@
245
246
  return raw = arguments[0];
246
247
  };
247
248
  })(),
248
- lineno: 84
249
+ lineno: 86
249
250
  })), {
250
- assert_pgp_hash: assert_pgp_hash
251
+ assert_pgp_hash: assert_pgp_hash,
252
+ pgp_max_length: pgp_max_length
251
253
  });
252
254
  __iced_deferrals._fulfill();
253
255
  })(function() {
254
256
  (function(__iced_k) {
255
257
  __iced_deferrals = new iced.Deferrals(__iced_k, {
256
258
  parent: ___iced_passed_deferral,
257
- filename: "/Users/max/src/keybase/proofs/src/subkey.iced",
259
+ filename: "/Users/michal/SourceCode/keybase/go/src/github.com/keybase/keybase-proofs/src/subkey.iced",
258
260
  funcname: "SubkeyBase.reverse_sig_check"
259
261
  });
260
262
  a_json_parse(raw, esc(__iced_deferrals.defer({
@@ -263,7 +265,7 @@
263
265
  return payload = arguments[0];
264
266
  };
265
267
  })(),
266
- lineno: 85
268
+ lineno: 87
267
269
  })));
268
270
  __iced_deferrals._fulfill();
269
271
  })(function() {
package/lib/util.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // Generated by IcedCoffeeScript 108.0.11
2
2
  (function() {
3
- var Lock, bufeq_secure, constants, crypto, json_secure_compare, json_stringify_sorted, pack, v2_sig_type_from_sig_type, _ref;
3
+ var Lock, bufeq_secure, constants, crypto, get_own, has_own, json_secure_compare, json_stringify_sorted, pack, v2_sig_type_from_sig_type, _has_own, _ref;
4
4
 
5
5
  constants = require('./constants').constants;
6
6
 
@@ -10,6 +10,20 @@
10
10
 
11
11
  pack = require('purepack').pack;
12
12
 
13
+ _has_own = {}.constructor.prototype.hasOwnProperty;
14
+
15
+ exports.has_own = has_own = function(o, k) {
16
+ return _has_own.call(o, k);
17
+ };
18
+
19
+ exports.get_own = get_own = function(o, k) {
20
+ if (_has_own.call(o, k)) {
21
+ return o[k];
22
+ } else {
23
+ return void 0;
24
+ }
25
+ };
26
+
13
27
  exports.json_secure_compare = json_secure_compare = function(a, b) {
14
28
  var err, o1, o2, x, _ref1;
15
29
  _ref1 = (function() {
package/package.json CHANGED
@@ -1,8 +1,13 @@
1
1
  {
2
2
  "name": "keybase-proofs",
3
- "version": "2.3.33",
3
+ "version": "2.3.35",
4
4
  "description": "Publicly-verifiable proofs of identity",
5
5
  "main": "lib/main.js",
6
+ "files": [
7
+ "lib/",
8
+ "src/",
9
+ "CHANGELOG.md"
10
+ ],
6
11
  "scripts": {
7
12
  "test": "make test"
8
13
  },
@@ -27,7 +32,7 @@
27
32
  "iced-error": ">=0.0.9",
28
33
  "iced-lock": "^1.0.1",
29
34
  "iced-runtime": ">=0.0.1",
30
- "kbpgp": ">=2.1.13",
35
+ "kbpgp": ">=2.1.20",
31
36
  "pgp-utils": ">=0.0.22",
32
37
  "purepack": "^1.0.4",
33
38
  "triplesec": ">=3.0.16"
package/src/alloc.iced CHANGED
@@ -15,9 +15,9 @@ base = require './base'
15
15
  {PGPUpdate} = require './pgp_update'
16
16
  {UpdatePassphraseHash} = require './update_passphrase_hash'
17
17
  {UpdateSettings} = require './update_settings'
18
+ {get_own} = require './util'
18
19
  team = require './team'
19
20
  team_hidden = require './team_hidden'
20
- wot = require './wot'
21
21
 
22
22
  #=======================================================
23
23
 
@@ -65,15 +65,13 @@ lookup_tab = {
65
65
  "team.kbfs" : team.KBFS
66
66
  "team.settings" : team.Settings
67
67
  "team.bot_settings" : team.BotSettings
68
- "wot.vouch" : wot.Vouch
69
- "wot.react" : wot.React
70
68
  }
71
69
 
72
70
  #--------------------------------------------
73
71
 
74
72
  get_klass = (type, extra_lookup_tab) ->
75
73
  err = klass = null
76
- unless (klass = extra_lookup_tab?[type])? or (klass = lookup_tab[type])?
74
+ unless (extra_lookup_tab? and (klass = get_own(extra_lookup_tab, type))?) or (klass = get_own(lookup_tab, type))?
77
75
  err = new Error "Unknown proof class: #{type}"
78
76
  [err, klass]
79
77
 
package/src/base.iced CHANGED
@@ -76,7 +76,7 @@ compare_hash_buf_to_str = (b, s) ->
76
76
 
77
77
  class Verifier
78
78
 
79
- constructor : ({@armored, @id, @short_id, @skip_ids, @make_ids, @strict, @now, @critical_clock_skew_secs, @skip_clock_skew_check, @inner, @outer, @expansions, @assert_pgp_hash, @require_packet_hash}, @sig_eng, @base) ->
79
+ constructor : ({@armored, @id, @short_id, @skip_ids, @make_ids, @strict, @now, @critical_clock_skew_secs, @skip_clock_skew_check, @inner, @outer, @expansions, @assert_pgp_hash, @require_packet_hash, @pgp_max_length}, @sig_eng, @base) ->
80
80
 
81
81
  #---------------
82
82
 
@@ -215,7 +215,9 @@ class Verifier
215
215
 
216
216
  _parse_and_process : ({armored}, cb) ->
217
217
  err = null
218
- await @sig_eng.unbox armored, defer(err, payload, body), { @assert_pgp_hash, @require_packet_hash }
218
+ # pgp_max_length only applies to PGP messages since Keybase NaCl
219
+ # does not have a compression feature.
220
+ await @sig_eng.unbox armored, defer(err, payload, body), { @assert_pgp_hash, @require_packet_hash, @pgp_max_length }
219
221
  if not err? and not @skip_ids
220
222
  await @_check_ids body, defer err
221
223
  if not err? and @make_ids
@@ -244,7 +246,7 @@ class Verifier
244
246
  err = new Error "non-canonical JSON found in strict mode (#{errsan ours} v #{errsan json_str_utf8_trimmed})"
245
247
  return cb err
246
248
  await akatch (() -> expand_json({ json : json_tmp, expansions})), esc defer @json
247
- await @base._v_check {@json, @assert_pgp_hash}, esc defer()
249
+ await @base._v_check {@json, @assert_pgp_hash, @pgp_max_length}, esc defer()
248
250
  cb null, @json, json_str_utf8
249
251
 
250
252
  #==========================================================================
@@ -659,6 +661,7 @@ class Base
659
661
  # @option obj {bool} strict Turn on all strict-mode checks
660
662
  # @option obj {bool} require_packet_hash Turn on if we require a packet hash
661
663
  # @option obj {Function} assert_pgp_hash Callback to reject specific PGP hash functions if encountered
664
+ # @option obj {number} pgp_max_length Max length of PGP message (after decompression)
662
665
  verify : (obj, cb) ->
663
666
  verifier = new Verifier obj, @sig_eng, @
664
667
  await verifier.verify defer err, json_obj, json_str
@@ -44,6 +44,8 @@ exports.constants = constants =
44
44
  kbfs : "team.kbfs"
45
45
  settings : "team.settings"
46
46
  bot_settings : "team.bot_settings"
47
+ # wot proofs are deprecated, but constants must remain available to kbweb
48
+ # because of existing signatures.
47
49
  wot :
48
50
  vouch : "wot.vouch"
49
51
  react : "wot.react"
@@ -83,6 +85,8 @@ exports.constants = constants =
83
85
  bot_settings: 48
84
86
  wallet :
85
87
  stellar : 15
88
+ # wot proofs are deprecated, but constants must remain available to kbweb
89
+ # because of existing signatures.
86
90
  wot :
87
91
  vouch : 16
88
92
  vouch_with_revoke : 17
package/src/main.iced CHANGED
@@ -32,7 +32,6 @@ mods = [
32
32
  require('./scrapers/hackernews')
33
33
  require('./scrapers/generic_social')
34
34
  require('./errors')
35
- require('./wot')
36
35
  ]
37
36
 
38
37
  for m in mods
@@ -44,4 +43,3 @@ exports.team = require('./team')
44
43
  exports.team_hidden = require('./team_hidden')
45
44
  exports.sig3 = require('./sig3')
46
45
  exports.schema = require('./schema3')
47
- exports.wot = require('./wot')
package/src/parse3.iced CHANGED
@@ -15,10 +15,16 @@ exports.is_kid = (h) -> is_hex(h,35)
15
15
  exports.is_int = is_int = (s) ->
16
16
  n = Math.floor Number s
17
17
  return typeof(s) is 'number' and (n isnt Infinity) and (n is s) and n >= 0
18
+ exports.decode_hex = decode_hex = (s) ->
19
+ return null unless typeof(s) is 'string'
20
+ buf = Buffer.from s, 'hex'
21
+ return null unless buf.toString('hex') is s.toLowerCase()
22
+ buf
18
23
  exports.is_hex = is_hex = (h, l) ->
19
24
  return false unless h?
20
- if typeof(h) is 'string' then h = Buffer.from(h, 'hex')
21
- else if not Buffer.isBuffer then return false
25
+ if typeof(h) is 'string'
26
+ return false unless (h = decode_hex(h))?
27
+ else if not Buffer.isBuffer(h) then return false
22
28
  return (h.length is l)
23
29
  exports.is_seqno = (s) ->
24
30
  return false unless s?
@@ -75,6 +81,6 @@ exports.is_chain_type = (x) ->
75
81
  exports.unhex = (b) ->
76
82
  if not b? then null
77
83
  else if Buffer.isBuffer(b) then b
78
- else if typeof(b) is 'string' then Buffer.from(b, 'hex')
84
+ else if typeof(b) is 'string' and (h = decode_hex(b))? then h
79
85
  else throw new Error "bad binary or hex string"
80
86