jspschool / tweetnacl-dart

Port of TweetNaCl cryptographic library to Dart.
MIT License
6 stars 20 forks source link

issues running with flutter web #5

Open christian-rogobete opened 4 years ago

christian-rogobete commented 4 years ago

Hello, when running with flutter web, there are 2 issues that cause exceptions:

  1. random key generation

when trying to generate a key like this: Uint8List secret = ed25519.TweetNaclFast.randombytes(32);

there is a RangeError thrown because of this line (tweetnacl_base.dart 3150 and 3157): rnd = Int64(jrandom.nextInt(1<<32));

this can be fixed by using the range (1<<31). see also dart-lang sdk issue

however, after fixing this, the next problem appears:

  1. Unsupported operation: Int64List not supported on the web.

dart2js does not support 64-bit integers and thus does not support Int64List or Uint64List. Dart code compiled via dart2js results in a runtime exception if either of those lists is used. see this article - last line

there are multiple Int64List used in the code. Can you please fix this?

wsldoc commented 3 years ago

Unsupported operation: Int64List not supported on the web. I also met the issue, do you fix it now?

oexza commented 2 years ago

Big Issue. Any fix on the horizon? @jspschool