bcgit / pc-dart

Pointy Castle - Dart Derived Bouncy Castle APIs
MIT License
233 stars 122 forks source link

Importing Platform #161

Open sebastianbuechler opened 2 years ago

sebastianbuechler commented 2 years ago

I tested the example here: https://github.com/bcgit/pc-dart/blob/master/tutorials/rsa.md#generating-rsa-key-pairs for generating rsa key pairs. For the entropy source I imported import 'package:pointycastle/src/platform_check/platform_check.dart' show Platform; and then used Platform.instance.platformEntropySource().getBytes(32) as key parameter for initiating the KeyParameter.

Now the dart compiler complains: "Don't import implementation files from another package." and hints to this https://dart-lang.github.io/linter/lints/implementation_imports.html

Is there a proper way to use this via the public API instead of direct importing the file from src?

ww-daniel-mora commented 1 year ago

I saw this in the docs for FortunaRandom but I was not able to find the referenced package.

[seed](https://pub.dev/documentation/pointycastle/latest/impl.secure_random.fortuna_random/FortunaRandom/seed.html)(covariant [KeyParameter](https://pub.dev/documentation/pointycastle/latest/api/KeyParameter-class.html) param) → void
Seed the RNG with some entropy (look at package cipher_entropy providing entropy sources).

If this use of Platform entropy is intended perhaps it could just be added to the public API to squelch this error. If this is not the intention, should we update the examples to use a difference source for entropy?