This brings window.Crypto to your Native Script application. It does this by communicating with a hidden WebView, which performs the actual computation.
Refer to the webview-crypto repo for most of the code and some cavaets.
This requires being setup properly with NativeScript first. Then install this as a plugin:
tns plugin add nativescript-webview-cryptoRendering the PolyfillCrypto components will start up a WebView to transparently proxy all the crypto calls to. It will also set the crypto global variable.
<Page xmlns="http://schemas.nativescript.org/tns.xsd" xmlns:WebViewCrypto="nativescript-webview-crypto"> <WebViewCrypto:WebViewCrypto /> ... </Page>Now, in any of your code, you can access window.Crypto, just like you would in a browser.
You can look at an example repo running this example for symmetric encryption in NativeScript.