Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.5.4 Exception after upload to Google Play #80

Closed
mrcsh opened this issue Jan 13, 2024 · 4 comments · Fixed by #94
Closed

0.5.4 Exception after upload to Google Play #80

mrcsh opened this issue Jan 13, 2024 · 4 comments · Fixed by #94
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@mrcsh
Copy link

mrcsh commented Jan 13, 2024

The Android version of my application is throwing the following exception after updating to 0.5.4
(ios seems to be unaffected)

Unsupported operation: package:webcrypto cannot be used from scripts or `flutter test` unless `flutter pub run webcrypto:setup` has been run for the current root project.

The error does not happen in debug mode on the simulator nor when running in release mode.
My guess is the upload process is stripping some symbols that is causing the failure?

Reverting to 0.5.3 resolved the issue for now.

Using:
Flutter (Channel stable, 3.16.7, on Fedora Linux 39 (Thirty Nine) 6.6.8-200.fc39.x86_64, locale en_US.UTF-8)
Android toolchain - develop for Android devices (Android SDK version 33.0.0)

#0      lookup.<anonymous closure> (package:webcrypto/src/boringssl/lookup/lookup.dart:69)
#1      lookup (package:webcrypto/src/boringssl/lookup/lookup.dart:75)
#2      _cachedLookup (package:webcrypto/src/boringssl/lookup/lookup.dart)
#3      ssl (package:webcrypto/src/boringssl/lookup/lookup.dart)
#4      _extension#4.createRSA (package:webcrypto/src/impl_ffi/impl_ffi.utils.dart)
#5      _generateRsaKeyPair.<anonymous closure> (package:webcrypto/src/impl_ffi/impl_ffi.rsa_common.dart:256)
#6      _Scope.sync (package:webcrypto/src/impl_ffi/impl_ffi.utils.dart:305)
#7      _generateRsaKeyPair (package:webcrypto/src/impl_ffi/impl_ffi.rsa_common.dart:254)
#8      rsaOaepPrivateKey_generateKey (package:webcrypto/src/impl_ffi/impl_ffi.rsaoaep.dart:70)
#9      RsaOaepPrivateKey.generateKey (package:webcrypto/src/webcrypto/webcrypto.rsaoaep.dart:219)
#10     WebcryptoRsa._generateRSAKeyRaw (package:common/rsa/webcrypto.dart:142)
#11     WebcryptoRsa.generateKeyPair (package:common/rsa/webcrypto.dart:82)
#12     CryptoBloc._compute (package:common/bloc/crypto/crypto_bloc.dart:249)
#13     CryptoBloc.init (package:common/bloc/crypto/crypto_bloc.dart:216) 
<asynchronous suspension>
@jonasfj jonasfj added bug Something isn't working help wanted Extra attention is needed labels Jan 18, 2024
@jonasfj
Copy link
Member

jonasfj commented Jan 18, 2024

Comes from here:

library = DynamicLibrary.open('libwebcrypto.so');

Either:

  • DynamicLibrary.open fails because libwebcrypto.so isn't found, or,
  • Symbols are stripped so that when it looks for them it throws an ArgumentError.

It's been a while since I tested how this code works. Never tried releasing it.

To be clear, I won't dive into this anytime soon. I don't have time and can't reproduce.

If you can reproduce please consider bisecting the git history between the two releases: 0.5.3...0.5.4

Or test what happens before/after: c0c3a1b maybe LTO had some impact.

You can just use a git dependency on this repository to test out a few different versions (might require you to do a dependency_override too).

@elitree
Copy link

elitree commented Feb 29, 2024

Hi, this is biting our android build as well. I'm getting the same "unsupported operation" exception in my console using v0.5.4 when we run Hash.sha1.digestBytes() (likely other webcrypto operations as well but that's the one I noticed).

It is reproducible every time for me, so easy enough to track down. I did a git bisect using dependency overrides in my project's pubspec, and the LTO commit you mentioned, c0c3a1b, is the culprit. The previous commit, 29aad7a, is fine.

As mentioned, 0.5.3 is working well, so we'll stick with that until this can be fixed. Thanks.

Edit: I forgot to mention that this exception is happening for me in debug mode as well as the simulator, which is different than @mrcsh's scenario.

@jonasfj
Copy link
Member

jonasfj commented Mar 5, 2024

Filed a PR to disable LTO on Android.

That'll probably adversely affect the binary size. But, hehe, if it was removing all symbols that might be acceptable.

@jonasfj
Copy link
Member

jonasfj commented Mar 6, 2024

Fix shipped in 0.5.6 -- https://pub.dev/packages/webcrypto

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants