Client-browser readme is missing fallback strategies and alternatives · Issue #128 · aws/aws-encryption-sdk-javascript · GitHub
Skip to content

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

Open

Description

@juneb

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.

Activity

  1. khadir-syed commented on Jan 6, 2020

    @khadir-syed

    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.

  2. seebees commented on Jan 6, 2020

    @seebees
    Contributor

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

  3. khadir-syed commented on Jan 6, 2020

    @khadir-syed

    @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.

  4. seebees commented on Jan 6, 2020

    @seebees
    Contributor

    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)?

  5. khadir-syed commented on Jan 7, 2020

    @khadir-syed

    @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.

  6. seebees commented on May 1, 2020

    @seebees
    Contributor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions