nativescript-webview-crypto
window.crypto for NativeScript via a WebView
npm i --save nativescript-webview-crypto

nativescript-webview-crypto

npm Dependency Status

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.

If you are using Angular2 with Nativescript, you should use nativescript-angular-webview-crypto.

This project is funded by Burke Software and Consulting LLC for passit. We are available for hire for any improvement and integration needs on this project. Open an issue to start a conversation or email info @ burke software dot come.

Install

This requires being setup properly with NativeScript first. Then install this as a plugin:

tns plugin add nativescript-webview-crypto

Quickstart

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