Skip to content

Commit 44d6cb1

Browse files
committed
Drop the crypto dependency.
[email protected] Review URL: https://codereview.chromium.org//1829533002 .
1 parent cb4c51c commit 44d6cb1

File tree

3 files changed

+3
-7
lines changed

3 files changed

+3
-7
lines changed

lib/src/runner/browser/platform.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class BrowserPlatform extends PlatformPlugin {
4949
///
5050
/// This is used to ensure that other users on the same system can't snoop
5151
/// on data being served through this server.
52-
final _secret = randomBase64(24, urlSafe: true);
52+
final _secret = Uri.encodeComponent(randomBase64(24));
5353

5454
/// The URL for this server.
5555
Uri get url => _server.url.resolve(_secret + "/");

lib/src/utils.dart

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import 'dart:convert';
77
import 'dart:math' as math;
88

99
import 'package:async/async.dart' hide StreamQueue;
10-
import 'package:crypto/crypto.dart';
1110
import 'package:path/path.dart' as p;
1211
import 'package:shelf/shelf.dart' as shelf;
1312
import 'package:stack_trace/stack_trace.dart';
@@ -428,15 +427,13 @@ void invoke(fn()) {
428427
///
429428
/// [seed] is passed to [math.Random]; [urlSafe] and [addLineSeparator] are
430429
/// passed to [CryptoUtils.bytesToBase64].
431-
String randomBase64(int bytes, {int seed, bool urlSafe: false,
432-
bool addLineSeparator: false}) {
430+
String randomBase64(int bytes, {int seed}) {
433431
var random = new math.Random(seed);
434432
var data = [];
435433
for (var i = 0; i < bytes; i++) {
436434
data.add(random.nextInt(256));
437435
}
438-
return CryptoUtils.bytesToBase64(data,
439-
urlSafe: urlSafe, addLineSeparator: addLineSeparator);
436+
return BASE64.encode(data);
440437
}
441438

442439
/// Returns middleware that nests all requests beneath the URL prefix [beneath].

pubspec.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ dependencies:
1212
barback: '>=0.14.0 <0.16.0'
1313
boolean_selector: '^1.0.0'
1414
collection: '^1.1.0'
15-
crypto: '^0.9.0'
1615
glob: '^1.0.0'
1716
http_multi_server: '>=1.0.0 <3.0.0'
1817
path: '^1.2.0'

0 commit comments

Comments
 (0)