Closed knvpk closed 5 years ago
The client does allow you to set these parameters, see the iot_core example. the client basically allows you to set parameters from the standard Dart security context class. There's nothing special provided for flutter as far as I know.
I have seen the IOT core example, there you have mentioned the path from currentDir/examples/pem
folder, but in the flutter context there are assets folder so when i give the code like below it is not saying anyerror about file path but connection timed out error is coming
client.trustedCertPath = "assets/aws/AmazonRootCA1.pem";
client.certificateChainPath = "assets/aws/b05caaaxxx-certificate.pem.crt";
client.privateKeyFilePath = "assets/aws/b05caaaxxx-private.pem.key";
OK, are you sure the client cwd is where you think its, could you use full paths rather than relative ones to see if it makes a difference, also logging may help.
I tried the relative paths also but didnt worked.
No, file path will not work, because flutter bundles all the asset and make a flutter_asset.blob
file, in dart code we can get the content by the path of asset but this path can't be used by this plugin, I think when app is started i need to get these blob data and place it in applicationDocumentDirectory and give these path to client properties. applicationDocumentDirectory
is provided by path provider
I don't use flutter so I'm not really sure what all the above means, however, the real problem to solve is how to use the Dart security context class in flutter. This is supplied by the SDK so there must be a way to set it up in flutter somehow, maybe ask the flutter devs how they do this.
I tried a few different things, but the one that works and I'm currently sticking is providing the bytes directly instead of the path. You'll need to change the String paths to Lists of integers. @shamblett maybe can add an option when you set the certs to provide either by the path or the bytes? Cheers
Yes, I'll update the client to support bytes and paths as you suggest.
That will be helpful @shamblett . Thanks
Client re-published at 5.0.0, you now have full access to the SecurityContext class
I know that the idea was to use private keys, but you can also use websockets with Cognito instead.
I wrote a wrapper library around mqtt to make it easier: https://pub.dartlang.org/packages/aws_iot_device
If you can use Cognito like this, you don't need the private key stuff.
Hi, I'm trying to implement the AWS IOT connection with this plugin but the aws iot authorizes via private certificate and key. There is an option to provide them in normal dart usage but not working with flutter, im trying to add the files in assets where pubspec.yaml process the asset files , so how to give the path for the trusted certificate, certificate toolchain and private key in flutter context.
I know there is a way to avoid the certificate path and give the URL using the AWS pre-signed concept, but I need to know if it is possible without presign concept.