meteor-node-stubs 1.2.13 → 1.2.14

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/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ v1.2.13 - 2025-02-27
2
+
3
+ * Update `elliptic` to v6.6.1 to address a security vulnerability.
4
+
1
5
  v1.2.12 - 2024-10-31
2
6
 
3
7
  * Update `elliptic` to v6.6.0 to address a security vulnerability.
@@ -2,7 +2,7 @@
2
2
  "author": "Dominic Tarr <dominic.tarr@gmail.com> (dominictarr.com)",
3
3
  "name": "@meteorjs/crypto-browserify",
4
4
  "description": "implementation of crypto for the browser",
5
- "version": "3.12.1",
5
+ "version": "3.12.2",
6
6
  "homepage": "https://github.com/meteor-compat/crypto-browserify",
7
7
  "sideEffects": false,
8
8
  "repository": {
@@ -24,8 +24,8 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "browserify-cipher": "^1.0.1",
27
- "browserify-sign": "^4.2.3",
28
- "create-ecdh": "^4.0.4",
27
+ "browserify-sign": "github:meteor-compat/browserify-sign",
28
+ "create-ecdh": "github:meteor-compat/createECDH",
29
29
  "create-hash": "^1.2.0",
30
30
  "create-hmac": "^1.1.7",
31
31
  "diffie-hellman": "^5.0.3",
@@ -7,7 +7,7 @@ var randomBytes = require('pseudorandombytes');
7
7
 
8
8
  for (var i = 0; i < 4; i += 1) {
9
9
  bcCrypto.listCiphers().forEach(function (cipher) {
10
- test('run: ' + i, function (t) {
10
+ test.skip('run: ' + i, function (t) {
11
11
  /* eslint no-loop-func: 0 */
12
12
  t.test('ciphers: ' + cipher, function (st) {
13
13
  st.plan(1);
@@ -34,7 +34,7 @@ test('getCiphers', function (t) {
34
34
  t.ok(bcCyphers.length, 'get ciphers returns an array');
35
35
  });
36
36
 
37
- test('through crypto browserify works', function (t) {
37
+ test.skip('through crypto browserify works', function (t) {
38
38
  t.plan(2);
39
39
  var crypto = require('../'); // eslint-disable-line global-require
40
40
  var cipher = 'aes-128-ctr';
@@ -1,39 +1,39 @@
1
1
  # hash-base
2
2
 
3
- [![NPM Package](https://img.shields.io/npm/v/hash-base.svg?style=flat-square)](https://www.npmjs.org/package/hash-base)
3
+ [![npm Package](https://img.shields.io/npm/v/hash-base.svg?style=flat-square)](https://www.npmjs.org/package/hash-base)
4
4
  [![Build Status](https://img.shields.io/travis/crypto-browserify/hash-base.svg?branch=master&style=flat-square)](https://travis-ci.org/crypto-browserify/hash-base)
5
5
  [![Dependency status](https://img.shields.io/david/crypto-browserify/hash-base.svg?style=flat-square)](https://david-dm.org/crypto-browserify/hash-base#info=dependencies)
6
6
 
7
- [![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)
8
-
9
7
  Abstract base class to inherit from if you want to create streams implementing the same API as node crypto [Hash][1] (for [Cipher][2] / [Decipher][3] check [crypto-browserify/cipher-base][4]).
10
8
 
11
9
  ## Example
12
10
 
13
11
  ```js
14
- const HashBase = require('hash-base')
15
- const inherits = require('inherits')
12
+ const HashBase = require('hash-base');
13
+ const inherits = require('inherits');
16
14
 
17
15
  // our hash function is XOR sum of all bytes
18
16
  function MyHash () {
19
- HashBase.call(this, 1) // in bytes
17
+ HashBase.call(this, 1); // in bytes
20
18
 
21
- this._sum = 0x00
22
- }
19
+ this._sum = 0x00;
20
+ };
23
21
 
24
22
  inherits(MyHash, HashBase)
25
23
 
26
24
  MyHash.prototype._update = function () {
27
- for (let i = 0; i < this._block.length; ++i) this._sum ^= this._block[i]
28
- }
25
+ for (let i = 0; i < this._block.length; ++i) {
26
+ this._sum ^= this._block[i];
27
+ }
28
+ };
29
29
 
30
30
  MyHash.prototype._digest = function () {
31
- return this._sum
32
- }
31
+ return this._sum;
32
+ };
33
33
 
34
- const data = Buffer.from([ 0x00, 0x42, 0x01 ])
35
- const hash = new MyHash().update(data).digest()
36
- console.log(hash) // => 67
34
+ const data = Buffer.from([0x00, 0x42, 0x01]);
35
+ const hash = new MyHash().update(data).digest();
36
+ console.log(hash); // => 67
37
37
  ```
38
38
  You also can check [source code](index.js) or [crypto-browserify/md5.js][5]
39
39
 
@@ -3,12 +3,6 @@ var Buffer = require('safe-buffer').Buffer
3
3
  var Transform = require('stream').Transform
4
4
  var inherits = require('inherits')
5
5
 
6
- function throwIfNotStringOrBuffer (val, prefix) {
7
- if (!Buffer.isBuffer(val) && typeof val !== 'string') {
8
- throw new TypeError(prefix + ' must be a string or a buffer')
9
- }
10
- }
11
-
12
6
  function HashBase (blockSize) {
13
7
  Transform.call(this)
14
8
 
@@ -44,10 +38,59 @@ HashBase.prototype._flush = function (callback) {
44
38
  callback(error)
45
39
  }
46
40
 
41
+ var useUint8Array = typeof Uint8Array !== 'undefined'
42
+ var useArrayBuffer = typeof ArrayBuffer !== 'undefined' &&
43
+ typeof Uint8Array !== 'undefined' &&
44
+ ArrayBuffer.isView &&
45
+ (Buffer.prototype instanceof Uint8Array || Buffer.TYPED_ARRAY_SUPPORT)
46
+
47
+ function toBuffer (data, encoding) {
48
+ // No need to do anything for exact instance
49
+ // This is only valid when safe-buffer.Buffer === buffer.Buffer, i.e. when Buffer.from/Buffer.alloc existed
50
+ if (data instanceof Buffer) return data
51
+
52
+ // Convert strings to Buffer
53
+ if (typeof data === 'string') return Buffer.from(data, encoding)
54
+
55
+ /*
56
+ * Wrap any TypedArray instances and DataViews
57
+ * Makes sense only on engines with full TypedArray support -- let Buffer detect that
58
+ */
59
+ if (useArrayBuffer && ArrayBuffer.isView(data)) {
60
+ if (data.byteLength === 0) return Buffer.alloc(0) // Bug in Node.js <6.3.1, which treats this as out-of-bounds
61
+ var res = Buffer.from(data.buffer, data.byteOffset, data.byteLength)
62
+ // Recheck result size, as offset/length doesn't work on Node.js <5.10
63
+ // We just go to Uint8Array case if this fails
64
+ if (res.byteLength === data.byteLength) return res
65
+ }
66
+
67
+ /*
68
+ * Uint8Array in engines where Buffer.from might not work with ArrayBuffer, just copy over
69
+ * Doesn't make sense with other TypedArray instances
70
+ */
71
+ if (useUint8Array && data instanceof Uint8Array) return Buffer.from(data)
72
+
73
+ /*
74
+ * Old Buffer polyfill on an engine that doesn't have TypedArray support
75
+ * Also, this is from a different Buffer polyfill implementation then we have, as instanceof check failed
76
+ * Convert to our current Buffer implementation
77
+ */
78
+ if (
79
+ Buffer.isBuffer(data) &&
80
+ data.constructor &&
81
+ typeof data.constructor.isBuffer === 'function' &&
82
+ data.constructor.isBuffer(data)
83
+ ) {
84
+ return Buffer.from(data)
85
+ }
86
+
87
+ throw new TypeError('The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView.')
88
+ }
89
+
47
90
  HashBase.prototype.update = function (data, encoding) {
48
- throwIfNotStringOrBuffer(data, 'Data')
49
91
  if (this._finalized) throw new Error('Digest already called')
50
- if (!Buffer.isBuffer(data)) data = Buffer.from(data, encoding)
92
+
93
+ data = toBuffer(data, encoding) // asserts correct input type
51
94
 
52
95
  // consume data
53
96
  var block = this._block
@@ -1,41 +1,42 @@
1
1
  {
2
- "name": "hash-base",
3
- "version": "3.0.4",
4
- "description": "abstract base class for hash-streams",
5
- "keywords": [
6
- "hash",
7
- "stream"
8
- ],
9
- "homepage": "https://github.com/crypto-browserify/hash-base",
10
- "bugs": {
11
- "url": "https://github.com/crypto-browserify/hash-base/issues"
12
- },
13
- "license": "MIT",
14
- "author": "Kirill Fomichev <fanatid@ya.ru> (https://github.com/fanatid)",
15
- "files": [
16
- "index.js"
17
- ],
18
- "main": "index.js",
19
- "repository": {
20
- "type": "git",
21
- "url": "https://github.com/crypto-browserify/hash-base.git"
22
- },
23
- "scripts": {
24
- "coverage": "nyc node test/*.js",
25
- "lint": "standard",
26
- "test": "npm run lint && npm run unit",
27
- "unit": "node test/*.js"
28
- },
29
- "dependencies": {
30
- "inherits": "^2.0.1",
31
- "safe-buffer": "^5.0.1"
32
- },
33
- "devDependencies": {
34
- "nyc": "^8.3.2",
35
- "standard": "*",
36
- "tape": "^4.2.0"
37
- },
38
- "engines": {
39
- "node": ">=4"
40
- }
2
+ "name": "hash-base",
3
+ "version": "3.0.5",
4
+ "description": "abstract base class for hash-streams",
5
+ "keywords": [
6
+ "hash",
7
+ "stream"
8
+ ],
9
+ "homepage": "https://github.com/crypto-browserify/hash-base",
10
+ "bugs": {
11
+ "url": "https://github.com/crypto-browserify/hash-base/issues"
12
+ },
13
+ "license": "MIT",
14
+ "author": "Kirill Fomichev <fanatid@ya.ru> (https://github.com/fanatid)",
15
+ "files": [
16
+ "index.js"
17
+ ],
18
+ "main": "index.js",
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "https://github.com/crypto-browserify/hash-base.git"
22
+ },
23
+ "scripts": {
24
+ "lint": "standard",
25
+ "pretest": "npm run lint",
26
+ "test": "npm run tests-only",
27
+ "tests-only": "nyc tape 'test/**/*.js'",
28
+ "posttest": "npx npm@'>=10.2' audit --production"
29
+ },
30
+ "dependencies": {
31
+ "inherits": "^2.0.4",
32
+ "safe-buffer": "^5.2.1"
33
+ },
34
+ "devDependencies": {
35
+ "nyc": "^10.3.2",
36
+ "standard": "^14.3.3",
37
+ "tape": "^5.9.0"
38
+ },
39
+ "engines": {
40
+ "node": ">= 0.10"
41
+ }
41
42
  }
@@ -33,7 +33,7 @@
33
33
  "browserify-rsa": "^4.1.0",
34
34
  "create-hash": "^1.2.0",
35
35
  "create-hmac": "^1.1.7",
36
- "elliptic": "^6.5.5",
36
+ "elliptic": "^6.6.1",
37
37
  "hash-base": "~3.0",
38
38
  "inherits": "^2.0.4",
39
39
  "parse-asn1": "^5.1.7",
@@ -452,16 +452,16 @@
452
452
  var w = this.words[i];
453
453
  var word = (((w << off) | carry) & 0xffffff).toString(16);
454
454
  carry = (w >>> (24 - off)) & 0xffffff;
455
- if (carry !== 0 || i !== this.length - 1) {
456
- out = zeros[6 - word.length] + word + out;
457
- } else {
458
- out = word + out;
459
- }
460
455
  off += 2;
461
456
  if (off >= 26) {
462
457
  off -= 26;
463
458
  i--;
464
459
  }
460
+ if (carry !== 0 || i !== this.length - 1) {
461
+ out = zeros[6 - word.length] + word + out;
462
+ } else {
463
+ out = word + out;
464
+ }
465
465
  }
466
466
  if (carry !== 0) {
467
467
  out = carry.toString(16) + out;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bn.js",
3
- "version": "4.12.0",
3
+ "version": "4.12.1",
4
4
  "description": "Big number implementation in pure javascript",
5
5
  "main": "lib/bn.js",
6
6
  "scripts": {
@@ -0,0 +1,65 @@
1
+ 'use strict';
2
+
3
+ // NOTE: This could be potentionally used to generate loop-less multiplications
4
+ function genCombMulTo (alen, blen) {
5
+ var len = alen + blen - 1;
6
+ var src = [
7
+ 'var a = self.words;',
8
+ 'var b = num.words;',
9
+ 'var o = out.words;',
10
+ 'var c = 0;',
11
+ 'var lo;',
12
+ 'var mid;',
13
+ 'var hi;'
14
+ ];
15
+ for (var i = 0; i < alen; i++) {
16
+ src.push('var a' + i + ' = a[' + i + '] | 0;');
17
+ src.push('var al' + i + ' = a' + i + ' & 0x1fff;');
18
+ src.push('var ah' + i + ' = a' + i + ' >>> 13;');
19
+ }
20
+ for (i = 0; i < blen; i++) {
21
+ src.push('var b' + i + ' = b[' + i + '] | 0;');
22
+ src.push('var bl' + i + ' = b' + i + ' & 0x1fff;');
23
+ src.push('var bh' + i + ' = b' + i + ' >>> 13;');
24
+ }
25
+ src.push('');
26
+ src.push('out.negative = self.negative ^ num.negative;');
27
+ src.push('out.length = ' + len + ';');
28
+
29
+ for (var k = 0; k < len; k++) {
30
+ var minJ = Math.max(0, k - alen + 1);
31
+ var maxJ = Math.min(k, blen - 1);
32
+
33
+ src.push('\/* k = ' + k + ' *\/');
34
+ src.push('var w' + k + ' = c;');
35
+ src.push('c = 0;');
36
+ for (var j = minJ; j <= maxJ; j++) {
37
+ i = k - j;
38
+
39
+ src.push('lo = Math.imul(al' + i + ', bl' + j + ');');
40
+ src.push('mid = Math.imul(al' + i + ', bh' + j + ');');
41
+ src.push('mid = (mid + Math.imul(ah' + i + ', bl' + j + ')) | 0;');
42
+ src.push('hi = Math.imul(ah' + i + ', bh' + j + ');');
43
+
44
+ src.push('w' + k + ' = (w' + k + ' + lo) | 0;');
45
+ src.push('w' + k + ' = (w' + k + ' + ((mid & 0x1fff) << 13)) | 0;');
46
+ src.push('c = (c + hi) | 0;');
47
+ src.push('c = (c + (mid >>> 13)) | 0;');
48
+ src.push('c = (c + (w' + k + ' >>> 26)) | 0;');
49
+ src.push('w' + k + ' &= 0x3ffffff;');
50
+ }
51
+ }
52
+ // Store in separate step for better memory access
53
+ for (k = 0; k < len; k++) {
54
+ src.push('o[' + k + '] = w' + k + ';');
55
+ }
56
+ src.push('if (c !== 0) {',
57
+ ' o[' + k + '] = c;',
58
+ ' out.length++;',
59
+ '}',
60
+ 'return out;');
61
+
62
+ return src.join('\n');
63
+ }
64
+
65
+ console.log(genCombMulTo(10, 10));
@@ -0,0 +1,65 @@
1
+ 'use strict';
2
+
3
+ function genCombMulTo (alen, blen) {
4
+ var len = alen + blen - 1;
5
+ var src = [
6
+ 'var a = self.words;',
7
+ 'var b = num.words;',
8
+ 'var o = out.words;',
9
+ 'var c = 0;',
10
+ 'var lo;',
11
+ 'var mid;',
12
+ 'var hi;'
13
+ ];
14
+ for (var i = 0; i < alen; i++) {
15
+ src.push('var a' + i + ' = a[' + i + '] | 0;');
16
+ src.push('var al' + i + ' = a' + i + ' & 0x1fff;');
17
+ src.push('var ah' + i + ' = a' + i + ' >>> 13;');
18
+ }
19
+ for (i = 0; i < blen; i++) {
20
+ src.push('var b' + i + ' = b[' + i + '] | 0;');
21
+ src.push('var bl' + i + ' = b' + i + ' & 0x1fff;');
22
+ src.push('var bh' + i + ' = b' + i + ' >>> 13;');
23
+ }
24
+ src.push('');
25
+ src.push('out.negative = self.negative ^ num.negative;');
26
+ src.push('out.length = ' + len + ';');
27
+
28
+ for (var k = 0; k < len; k++) {
29
+ var minJ = Math.max(0, k - alen + 1);
30
+ var maxJ = Math.min(k, blen - 1);
31
+
32
+ src.push('\/* k = ' + k + ' *\/');
33
+ src.push('lo = Math.imul(al' + (k - minJ) + ', bl' + minJ + ');');
34
+ src.push('mid = Math.imul(al' + (k - minJ) + ', bh' + minJ + ');');
35
+ src.push(
36
+ 'mid = (mid + Math.imul(ah' + (k - minJ) + ', bl' + minJ + ')) | 0;');
37
+ src.push('hi = Math.imul(ah' + (k - minJ) + ', bh' + minJ + ');');
38
+
39
+ for (var j = minJ + 1; j <= maxJ; j++) {
40
+ i = k - j;
41
+
42
+ src.push('lo = (lo + Math.imul(al' + i + ', bl' + j + ')) | 0;');
43
+ src.push('mid = (mid + Math.imul(al' + i + ', bh' + j + ')) | 0;');
44
+ src.push('mid = (mid + Math.imul(ah' + i + ', bl' + j + ')) | 0;');
45
+ src.push('hi = (hi + Math.imul(ah' + i + ', bh' + j + ')) | 0;');
46
+ }
47
+
48
+ src.push('var w' + k + ' = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;');
49
+ src.push('c = (((hi + (mid >>> 13)) | 0) + (w' + k + ' >>> 26)) | 0;');
50
+ src.push('w' + k + ' &= 0x3ffffff;');
51
+ }
52
+ // Store in separate step for better memory access
53
+ for (k = 0; k < len; k++) {
54
+ src.push('o[' + k + '] = w' + k + ';');
55
+ }
56
+ src.push('if (c !== 0) {',
57
+ ' o[' + k + '] = c;',
58
+ ' out.length++;',
59
+ '}',
60
+ 'return out;');
61
+
62
+ return src.join('\n');
63
+ }
64
+
65
+ console.log(genCombMulTo(10, 10));
@@ -25,7 +25,7 @@
25
25
  "homepage": "https://github.com/crypto-browserify/createECDH",
26
26
  "dependencies": {
27
27
  "bn.js": "^4.1.0",
28
- "elliptic": "^6.5.3"
28
+ "elliptic": "^6.6.1"
29
29
  },
30
30
  "devDependencies": {
31
31
  "tap-spec": "^1.0.1",
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "meteor-node-stubs",
3
3
  "author": "Ben Newman <ben@meteor.com>",
4
4
  "description": "Stub implementations of Node built-in modules, a la Browserify",
5
- "version": "1.2.13",
5
+ "version": "1.2.14",
6
6
  "main": "index.js",
7
7
  "license": "MIT",
8
8
  "homepage": "https://github.com/meteor/meteor/blob/devel/npm-packages/meteor-node-stubs/README.md",
@@ -11,7 +11,7 @@
11
11
  "prepare": "node scripts/build-deps.js"
12
12
  },
13
13
  "dependencies": {
14
- "@meteorjs/crypto-browserify": "^3.12.1",
14
+ "@meteorjs/crypto-browserify": "^3.12.2",
15
15
  "assert": "^2.1.0",
16
16
  "browserify-zlib": "^0.2.0",
17
17
  "buffer": "^5.7.1",
@@ -1,12 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="WEB_MODULE" version="4">
3
- <component name="NewModuleRootManager">
4
- <content url="file://$MODULE_DIR$">
5
- <excludeFolder url="file://$MODULE_DIR$/.tmp" />
6
- <excludeFolder url="file://$MODULE_DIR$/temp" />
7
- <excludeFolder url="file://$MODULE_DIR$/tmp" />
8
- </content>
9
- <orderEntry type="inheritedJdk" />
10
- <orderEntry type="sourceFolder" forTests="false" />
11
- </component>
12
- </module>
@@ -1,6 +0,0 @@
1
- <component name="InspectionProjectProfileManager">
2
- <profile version="1.0">
3
- <option name="myName" value="Project Default" />
4
- <inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
5
- </profile>
6
- </component>
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/crypto-browserify.iml" filepath="$PROJECT_DIR$/.idea/crypto-browserify.iml" />
6
- </modules>
7
- </component>
8
- </project>
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="" vcs="Git" />
5
- </component>
6
- </project>