objectbox-dart icon indicating copy to clipboard operation
objectbox-dart copied to clipboard

[objectbox_generator] Upgrade cryptography

Open ziadsarour opened this issue 1 year ago • 7 comments

Is there an existing issue?

Use case

Because cryptography >=2.0.0 <2.1.0 depends on js ^0.6.3 and cryptography >=2.1.0 <2.6.0 depends on js ^0.6.2, cryptography >=2.0.0 <2.6.0 requires js ^0.6.2. And because cryptography >=2.6.0 depends on js ^0.6.7, cryptography >=2.0.0 requires js ^0.6.2. And because objectbox_generator 4.0.0 depends on cryptography ^2.0.5 and mixpanel_flutter >=2.3.0 depends on js ^0.7.1, objectbox_generator 4.0.0 is incompatible with mixpanel_flutter >=2.3.0. So, because app depends on both mixpanel_flutter 2.3.1 and objectbox_generator 4.0.0, version solving failed.

Proposed solution

Upgrade cryptography that is using a newer version of js

Describe alternatives you've considered

Downgrading Mixpanel to 2.2.0 for now

Additional context

cryptopgrahy is used by objectbox_generator

ziadsarour avatar May 25 '24 03:05 ziadsarour

Thanks! However, the current version constraint does allow the latest version of cryptography (currently 2.7.0). No?

https://github.com/objectbox/objectbox-dart/blob/045460fe170e6b808d6523c662a97886ec873c66/generator/pubspec.yaml#L23

Maybe try to use flutter pub upgrade instead of editing versions in pubspec manually?

greenrobot-team avatar May 27 '24 06:05 greenrobot-team

I've made a PR https://github.com/dint-dev/cryptography/pull/181 for that over a month ago, but it's not been merged yet. Until it's merged you can either reference the PR directly or just use dependency overrides, i.e.

dependency_overrides:
  js: ^0.7.1

techouse avatar May 27 '24 08:05 techouse

@techouse Thanks! So this is nothing that can be fixed by this library. Closing then.

greenrobot-team avatar May 28 '24 05:05 greenrobot-team

@greenrobot-team sadly https://github.com/dint-dev/cryptography looks abandoned. Maybe think of a drop-in replacement?

techouse avatar May 28 '24 11:05 techouse

@techouse Thanks for the hint! Last update in September 2023, so would not go that far. Anyhow, had a quick look and I don't really see any good alternatives. Suggestions are welcome!

greenrobot-team avatar Jun 03 '24 05:06 greenrobot-team

Reopened because we should do something about this as js is apparently commonly used (#643).

Internal issue: objectbox/objectbox-dart#112

The current workaround is to add a dependency override.

greenrobot-team avatar Jun 05 '24 06:06 greenrobot-team

@greenrobot-team FYI package:js has been deprecated in favour of package:js_interop so the dependency override won't work indefinitely. 🙈

techouse avatar Jun 05 '24 08:06 techouse

Release 4.0.3 has switched to the pointycastle crypto library. It allows recent versions of js, so the any dependency override can be removed. It also has migrated to js_interop internally already, so will likely drop the js dependency with a future release.

To update to this release, for a Flutter project run flutter pub upgrade or for a Dart Native project dart pub upgrade.

greenrobot-team avatar Oct 22 '24 11:10 greenrobot-team