AWS Signer support for Flutter

1k views Asked by At

We are building a mobile app using Flutter that connects to WebSocket (AWS). The user will SignUp / SignIn to the app using AWS Amplify Auth. After authentication is successful the app will establish a connection to WebSocket on AWS. In order to make our connection to WebSocket secure, we want to use AWS Signer v4 to sign the URL. But we couldn't find any support on AWS Signer v4 for Flutter. Kindly provide us help so that we can use Signer v4 using Flutter something like plugin etc.

Thank You

3

There are 3 answers

1
chunhunghan On

You can use package https://pub.dev/packages/sigv4
A Dart library for signing AWS requests with Signature Version 4.
code snippet

final client = Sigv4Client(
  keyId: 'your_access_key_id',
  accessKey: 'your_access_key',
  region: 'eu-west-1',.
  serviceName: 'execute-api',
);
2
Mohammed Noureldin On

I have almost exactly the same use case you have. I have written and released a simple library that can do what you want, creating a presigned URL to connect to AWS WebSocket API Gateway secured by IAM:

https://github.com/MohammedNoureldin/aws_url_signer

Basically you will get your signed URL just like this:

String getSignedWebSocketUrl(
    {String apiId,
    String region,
    String stage,
    String accessKey,
    String secretKey,
    String sessionToken})
0
Emre Onay On

I have been looking for the same thing: an AWS Signer (v4) for sending API calls from my Flutter app to AWS services.

I found this package lately, tested it and think it does the job well https://pub.dev/packages/aws_signature_v4.