- Version: 0.0.6
- GitHub: https://github.com/saulshanabrook/nativescript-webview-crypto
- NPM: https://www.npmjs.com/package/nativescript-angular-webview-crypto
- Downloads:
- Last Day: 0
- Last Week: 0
- Last Month: 0
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.
Install
This requires being setup properly with NativeScript first. Then install this as a plugin:
tns plugin add nativescript-angular-webview-crypto
Usage
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';
@Component({
selector: 'simple-view-container',
template: `
<polyfill-crypto></polyfill-crypto>
`
})
export class SimpleViewContainer implements OnInit {
ngOnInit() {
console.log(crypto.getRandomValues());
}
}
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.