Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client-browser readme is missing fallback strategies and alternatives #128

Open
juneb opened this issue Jun 27, 2019 · 6 comments
Open

Client-browser readme is missing fallback strategies and alternatives #128

juneb opened this issue Jun 27, 2019 · 6 comments

Comments

@juneb
Copy link
Contributor

juneb commented Jun 27, 2019

The fallback section of the readme for the client-browser module lists the features of the SDK that are not supported by certain browsers. However, while it mentions msrcrypto as an example of a fallback library, it doesn't recommend any fallback strategies or alternatives.

Also, the fallback section points to @aws-crypto/web-crypto-backend, but that file has very little information, and just sends readers back to the readme. Loops like this are very frustrating to users.

@khadir-syed
Copy link

Hi,

Any further information on this is really helpful, we currently have requirement where we are using AWS encryption SDK for browser using javascript and we are facing compatibility issues with safari browser on MAC and iOS devices. If any information on this will be helpful, till readme documentation is updated.

@seebees
Copy link
Contributor

seebees commented Jan 6, 2020

@khadir-syed Safari does not support Zero-Byte AES-GCM operations. So a fallback (such as msrcrypto) is needed. Even though WebCrypto is supported.

@khadir-syed
Copy link

@seebees - Thanks for your reply. As per below documentation client-browser module, I configured fallback and still seeing issue.

============================

WebCrypto availability
The WebCrypto API is not available on all browsers. A fallback can be configured. An example of a fallback library is: MSR Crypto

import { configureFallback } from '@aws-crypto/client-browser'
configureFallback(msrCrypto)

For details on configureFallback see: @aws-crypto/web-crypto-backend

============================

Mainly error is coming in configureFallback function. This is the error.

Unhandled Promise Rejection: Error: A Fallback is required for zero byte AES-GCM operations.

Do I need to do any spec \ additional changes in web-crypto-backend module? Thanks in advance.

@seebees
Copy link
Contributor

seebees commented Jan 6, 2020

If you have a public repo I could take a look.
The error you are referencing should be throw here: https://github.com/aws/aws-encryption-sdk-javascript//blob/master/modules/web-crypto-backend/src/backend-factory.ts#L55
That error suggests that the code is running on safari and that a fallback has not been configured.

Are you sure that you are not getting an error on configureFallback(msrCrypto)?

@khadir-syed
Copy link

@seebees - you can check this public code repo - https://github.com/khadir-syed/aws_sdk_encryption_js_poc

I have done changes in these files - https://github.com/khadir-syed/aws_sdk_encryption_js_poc/blob/master/node_modules/%40aws-crypto/example-browser/src/aes_simple.ts

where I added below code

import { configureFallback } from '@aws-crypto/client-browser'
configureFallback(msrCrypto)

msrCrypto is present in node_modules here - https://github.com/khadir-syed/aws_sdk_encryption_js_poc/tree/master/node_modules/%40aws-crypto/example-browser/node_modules

aes_simple_bundle.js - is created using npm run example-aes, present in https://github.com/khadir-syed/aws_sdk_encryption_js_poc/tree/master/node_modules/%40aws-crypto/example-browser/build and it is referened in aes_simple.html file which is present in this locaiton https://github.com/khadir-syed/aws_sdk_encryption_js_poc/tree/master/node_modules/%40aws-crypto/example-browser/html

msrcrypto.js - This I referenced in above html file, below is for your reference.

<script src="../node_modules/msrcrypto/msrcrypto.js"></script>
<script src="../build/aes_simple_bundle.js"></script>

Also, I am attaching screen shots from chrome and safari browers on MAC machine I am testing...
SafariError
Chrome_MAC

Any help here is much appreciated, as I am struck on this from sometime.

@seebees
Copy link
Contributor

seebees commented May 1, 2020

The fallback conversation was resolved by #239,
There is now a example illustrating this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants