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



This brings window.Crypto to your Angular2 NativeScript application. It does this by communicating with a hidden WebView, which performs the actual computation.

It extends nativescript-webview-crypto, which in turn extends 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.


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

tns plugin add nativescript-angular-webview-crypto


Rendering the polyfill-crypto component will start up a WebView to transparently proxy all the crypto calls to. crypto is a global variable, to match the Web Cryptography API. To register the polyfill-crypto component, just import this package.

import 'nativescript-angular-webview-crypto';

selector: 'simple-view-container',
template: `

export class SimpleViewContainer implements OnInit {
ngOnInit() {

The component will be hidden, but needs to be rendered for crypto to work.

You can look at an example repo running this example for symmetric encryption in NativeScript.