question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

crypto.subtle is undefined on React Native

See original GitHub issue

crypto.subtle is undefined here (and everywhere else even later on) on both iOS and Android.

I’m running react-native@0.53.3 and it was created with react-native init. Tried looking around to find some culprit but haven’t managed to find anything.

Found the culprit, seems that it doesn’t work while remotely debugging. Might have something to do with the code being executed in Chrome.

It seems that msrcrypto runs in a web worker while in remote debugging which causes this to be set to true, which in turn causes this (msrcryptoSubtle) not to be instantiated, ergo undefined everywhere while remotely debugging.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
kevlenedcommented, Mar 24, 2018

Good find. It’s interesting that remote debugging React Native will run the app’s code in the context of a Web Worker.

An MSRCRYPTO_FORCE_SYNC global variable that serves as an alternative to using forceSync seems reasonable, and it minimizes the changes needed to msrCrypto.

0reactions
kevlenedcommented, Sep 9, 2019

Unfortunately anything not listed in @bunea’s msrCrypto list above isn’t supported. The AES-KW algorithms are listed in the legend, but haven’t been tested. The support grid below above the legend shows everything that’s tested.

The original issue seems to be fixed, but comment if this is still an issue. Closing for now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use SubtleCrypto in chrome (window.crypto.subtle is ...
According to the spec (via Github issues) a la this Google page for WebCrypto: crypto.subtle is supposed to be undefined in insecure ...
Read more >
SubtleCrypto API not supported/bro… | Apple Developer Forums
generateKey throws an error undefined is not an object (evaluating ... We've been using SubtleCrypto library in our React-Native app on an iPhone...
Read more >
react-native-webview-crypto - npm
Start using react-native-webview-crypto in your project by running `npm i react-native-webview-crypto`. There are 2 other projects in the ...
Read more >
Crypto.subtle - Web APIs - MDN Web Docs
Chrome Edge subtle Full support. Chrome37. Toggle history Full support. Edge12. Togg... Secure context required Full support. Chrome60. Toggle history Full support. Edge79. Togg...
Read more >
Crypto - Expo Documentation
expo-crypto enables you to hash data in an equivalent manner to the Node.js ... If you're installing this in a bare React Native...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found