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

Fix for race condition when using sha256 on IE11 #252

Merged
merged 5 commits into from
Oct 25, 2019

Conversation

stevehobbsdev
Copy link
Contributor

Description

This PR fixes an issue with resolving SHA256 operations in IE11.

msCrypto (IE11) uses the old spec, which is not Promise based. Instead of returning a promise, it returns a CryptoOperation
with a result property in it.

As a result, the various events need to be handled in the event that we're working in IE11 (hence the msCrypto check). These events just call resolve or reject depending on the handler.

The sha256 function essentially now has two clear paths depending on IE11 vs. not-IE11 - either return the promise from the browser's crypto API, or return a new promise which is resolved or rejected based on the events raised by msCrypto.

References

CryptoOperation reference: https://msdn.microsoft.com/en-us/expression/dn904640(v=vs.71)

Testing

  • This change adds test coverage for new/changed/fixed functionality

Checklist

  • I have added documentation for new/changed functionality in this PR or in auth0.com/docs
  • All active GitHub checks for tests, formatting, and security are passing
  • The correct base branch is being used, if not master

@stevehobbsdev stevehobbsdev changed the title Fix/ie11 crypto promise Fix for race condition when using sha256 on IE11 Oct 25, 2019
@stevehobbsdev stevehobbsdev requested a review from a team October 25, 2019 11:43
src/utils.ts Outdated Show resolved Hide resolved
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

Successfully merging this pull request may close these issues.

3 participants