Use BASE64 from package:convert. Closes dart-lang/web_socket_channel#4 R=kevmoo@google.com Review URL: https://codereview.chromium.org//1834343003 .
diff --git a/pkgs/web_socket_channel/CHANGELOG.md b/pkgs/web_socket_channel/CHANGELOG.md index a74290e..b9e1db0 100644 --- a/pkgs/web_socket_channel/CHANGELOG.md +++ b/pkgs/web_socket_channel/CHANGELOG.md
@@ -1,3 +1,7 @@ +## 1.0.2 + +* Properly use `BASE64` from `dart:convert` rather than `crypto`. + ## 1.0.1 * Add support for `crypto` 1.0.0.
diff --git a/pkgs/web_socket_channel/lib/src/channel.dart b/pkgs/web_socket_channel/lib/src/channel.dart index 3d1d492..9c82c68 100644 --- a/pkgs/web_socket_channel/lib/src/channel.dart +++ b/pkgs/web_socket_channel/lib/src/channel.dart
@@ -3,6 +3,7 @@ // BSD-style license that can be found in the LICENSE file. import 'dart:async'; +import 'dart:convert' as convert; import 'package:async/async.dart'; import 'package:crypto/crypto.dart'; @@ -64,7 +65,8 @@ static String signKey(String key) { // We use [codeUnits] here rather than UTF-8-decoding the string because // [key] is expected to be base64 encoded, and so will be pure ASCII. - return BASE64.encode(sha1.convert((key + webSocketGUID).codeUnits).bytes); + return convert.BASE64.encode( + sha1.convert((key + webSocketGUID).codeUnits).bytes); } /// Creates a new WebSocket handling messaging across an existing [channel].
diff --git a/pkgs/web_socket_channel/pubspec.yaml b/pkgs/web_socket_channel/pubspec.yaml index a4853c9..b7bd90e 100644 --- a/pkgs/web_socket_channel/pubspec.yaml +++ b/pkgs/web_socket_channel/pubspec.yaml
@@ -1,11 +1,11 @@ name: web_socket_channel -version: 1.0.1 +version: 1.0.2 description: StreamChannel wrappers for WebSockets. author: Dart Team <misc@dartlang.org> homepage: https://github.com/dart-lang/web_socket_channel environment: - sdk: '>=1.8.0 <2.0.0' + sdk: '>=1.13.0 <2.0.0' dependencies: async: '^1.3.0'