jonasroussel / dart_jsonwebtoken

A dart implementation of the famous javascript library 'jsonwebtoken'
MIT License
87 stars 29 forks source link

Pointycastle dependence fails on web #14

Closed othenos closed 3 years ago

othenos commented 3 years ago

Attempting to build web version of mobile app. Using dart_jsonwebtoken: ^2.3.0. Getting build errors for pointycastle. Will you be upgrading your dependency when pointycastle finalizes their fix? Thanks for the work on your package!

Waiting for connection from debug service on Chrome... ../../flutter/.pub-cache/hosted/pub.dartlang.org/pointycastle-3.1.3/lib/key_derivators/argon2.dart:42:27: Error: The integer literal 0xFFFFFFFFFFFFFFFF can't be represented exactly in JavaScript. Try changing the literal to something that can be represented in Javascript. In Javascript 0x10000000000000000 is the nearest value that can be represented exactly. static const int M32L = 0xFFFFFFFFFFFFFFFF; ^^^^^^^^^^^^^^^^^^ ../../flutter/.pub-cache/hosted/pub.dartlang.org/pointycastle-3.1.3/lib/src/utils.dart:313:9: Error: The integer literal 0xFFFFFFFFFFFFFFFF can't be represented exactly in JavaScript. Try changing the literal to something that can be represented in Javascript. In Javascript 0x10000000000000000 is the nearest value that can be represented exactly. ((0xFFFFFFFFFFFFFFFF) ^ ((1 << (64 - count)) - 1)); ^^^^^^^^^^^^^^^^^^ ../../flutter/.pub-cache/hosted/pub.dartlang.org/pointycastle-3.1.3/lib/src/platform_check/platform_check.dart:6:35: Error: Method not found: 'getPlatform'. static Platform get instance => getPlatform(); ^^^^^^^^^^^ Failed to compile application.

`/Users/mrobinson/flutter/bin/flutter doctor --verbose [✓] Flutter (Channel stable, 2.2.3, on macOS 11.4 20F71 darwin-x64, locale en-US) • Flutter version 2.2.3 at /Users/mrobinson/flutter • Framework revision f4abaa0735 (2 weeks ago), 2021-07-01 12:46:11 -0700 • Engine revision 241c87ad80 • Dart version 2.13.4

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at /Users/mrobinson/Library/Android/sdk • Platform android-30, build-tools 30.0.3 • ANDROID_HOME = /Users/mrobinson/Library/Android/sdk • ANDROID_SDK_ROOT = /Users/mrobinson/Library/Android/sdk • Java binary at: /Users/mrobinson/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/202.7486908/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264) • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 12.5.1, Build version 12E507 • CocoaPods version 1.10.1

[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.2) • Android Studio at /Users/mrobinson/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/202.7486908/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)

[✓] IntelliJ IDEA Ultimate Edition (version 2021.1.3) • IntelliJ at /Users/mrobinson/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app • Flutter plugin version 58.0.3 • Dart plugin version 211.7665

[✓] Connected device (1 available) • Chrome (web) • chrome • web-javascript • Google Chrome 91.0.4472.114

• No issues found! Process finished with exit code 0`

jonasroussel commented 3 years ago

Yes, it come from pointycastle:3.1.3 that added recently the Argon2 function for hashing (Incompatible with dart2js). I will publish a fix today that will use version 3.1.2 instead.

jonasroussel commented 3 years ago

Published! (https://pub.dev/packages/dart_jsonwebtoken/versions/2.3.1)

othenos commented 3 years ago

Awesome. Thanks for the quick fix.