File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -314,9 +314,8 @@ config =
314314 # with a couple of fixes.
315315 ' ./src/cloud/social/shim/net.js:net'
316316 ' ./src/cloud/social/shim/dns.js:dns'
317- # Subset of ssh2-streams (all except SFTP) which works well in
318- # the browser.
319- ' ./src/cloud/social/alias/ssh2-streams.js:ssh2-streams'
317+ # Alternative that works for freedomjs modules.
318+ ' ./src/cloud/social/alias/brorand.js:brorand'
320319 # Fallback for crypto-browserify's randombytes, for Firefox.
321320 ' ./src/cloud/social/alias/randombytes.js:randombytes'
322321 ]
@@ -327,9 +326,8 @@ config =
327326 # with a couple of fixes.
328327 ' ./src/cloud/social/shim/net.js:net'
329328 ' ./src/cloud/social/shim/dns.js:dns'
330- # Subset of ssh2-streams (all except SFTP) which works well in
331- # the browser.
332- ' ./src/cloud/social/alias/ssh2-streams.js:ssh2-streams'
329+ # Alternative that works for freedomjs modules.
330+ ' ./src/cloud/social/alias/brorand.js:brorand'
333331 # Fallback for crypto-browserify's randombytes, for Firefox.
334332 ' ./src/cloud/social/alias/randombytes.js:randombytes'
335333 ]
Original file line number Diff line number Diff line change 6060 "lodash" : " ^3.10.1" ,
6161 "request" : " ^2.53.0" ,
6262 "socks5-http-client" : " ^1.0.2" ,
63- "ssh2" : " 0.4.12" ,
64- "ssh2-streams" : " 0.0.18" ,
63+ "ssh2" : " 0.5.0" ,
6564 "tslint" : " ^3.3.0" ,
6665 "typescript" : " ~1.8.2" ,
6766 "typings" : " ^0.7.12" ,
Original file line number Diff line number Diff line change 11/// <reference path='../../../../third_party/typings/browser.d.ts' />
22
3+ require ( '../social/monkey/process' ) ;
4+
35import arraybuffers = require( '../../arraybuffers/arraybuffers' ) ;
46import linefeeder = require( '../../net/linefeeder' ) ;
57import logging = require( '../../logging/logging' ) ;
Original file line number Diff line number Diff line change 1+ // brorand alias which works in a freedomjs module context.
2+ // Uses randombytes, for which we have an alias which works
3+ // for Firefox.
4+
5+ const randombytes = require ( 'randombytes' ) ;
6+
7+ module . exports = function rand ( len ) {
8+ return randombytes ( len ) ;
9+ } ;
10+
11+ function Rand ( fallback ) {
12+ // no-op: always use randombytes
13+ }
14+ module . exports . Rand = Rand ;
15+
16+ Rand . prototype . generate = function generate ( len ) {
17+ return randombytes ( len ) ;
18+ } ;
Original file line number Diff line number Diff line change 1414 cryptoAvailable = false ;
1515}
1616
17- module . exports = function ( size ) {
17+ module . exports = function ( size , cb ) {
1818 var buffer = new Buffer ( size ) ;
1919 if ( cryptoAvailable ) {
2020 // Although this looks weird, it's how crypto-browserify does it too:
@@ -25,5 +25,9 @@ module.exports = function(size) {
2525 buffer [ i ] = Math . floor ( Math . random ( ) * 256 ) ;
2626 }
2727 }
28- return buffer ;
28+ if ( cb ) {
29+ cb ( undefined , buffer ) ;
30+ } else {
31+ return buffer ;
32+ }
2933}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ // Monkey patch for browserify's process shim, for ssh2-streams.
2+
3+ // Node.js 4.2 is an LTS release and, very roughly, is what the
4+ // browserify shims, e.g. Buffer, provide.
5+ process . version = '4.2.0' ;
6+
7+ process . binding = function ( ) {
8+ return { } ;
9+ } ;
Original file line number Diff line number Diff line change 11/// <reference path='../../../../third_party/typings/browser.d.ts' />
22
3+ require ( '../social/monkey/process' ) ;
4+
35import arraybuffers = require( '../../arraybuffers/arraybuffers' ) ;
46import linefeeder = require( '../../net/linefeeder' ) ;
57import logging = require( '../../logging/logging' ) ;
You can’t perform that action at this time.
0 commit comments