Do you use cryptography_flutter directly? #174
-
I am building a crypto library for an application I intend to release on iOS, macOS, Web, Android, Windows and Linux. The overview says: "This is a Flutter plugin that enables pub.dev/packages/cryptography to use native APIs of Android, iOS, and Mac OS X." The FlutterCryptography class has the following
This implies that you add it to your project, along with the cryptography library, enable it with FlutterCryptography.enable(), but do not use the other classes in crypography_flutter directly. That they will be used by the cryptography library, as appropriate and depending on the runtime platform. If that is the case, then that is great as I only need to concern myself with the cryptography API. The alternative is that I need to use the cryptography_flutter classes, where available, and provide fallback objects in case they are not supported on the runtime platform. That wouldn't be so great, but is how I have approached coding so far - hence the question. Which does lead me to a 2nd question. If the answer to the above question is that we add and enable the cryptography_flutter package but do not use the classes in it directly, then would the following make sense: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Through testing:
Both the above setups result in FlutterChachaPoly1305 being used,
So in summary, no you do not need to use the classes in cryptography_flutter directly. Just add cryptography_flutter as a dependency to your app, or to your flutter package, and the Flutter classes will be used on supported platforms. Bad news is, encrypting/decrypting a 1GB file: This was on a M1 Mac mini. Disappointing :( |
Beta Was this translation helpful? Give feedback.
Through testing:
Both the above setups result in FlutterChachaPoly1305 being used,
So in summary, no you do not need to use the classes in cryptography_flutter directly. Just add cryptography_flutter as a dependency to your app, or to your flutter package, and the Flutter classes will be used on supported pla…