NativeScript / ios-jsc

NativeScript for iOS using JavaScriptCore

Home Page:http://docs.nativescript.org/runtimes/ios

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support Web Crypto API

baryon opened this issue · comments

In the NS runtime, the code will return undefine
var crypto = global.crypto || global.msCrypto
Any plan to support Web Crypto API?

https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API

We haven't considered adding Crypto API in the Runtime for now.

In WebKit it's implemented in the WebCore framework (Crypto.h, Crypto.cpp, DOMWindow::crypto()) and it could be possible to reuse it from there, but this won't be a straightforward task and we still cannot estimate how much effort will be needed and when we can start working on it.

Depending on the demand we could raise the priority of this task and research it in some of the next releases of NativeScript.

no crypto supporting, we can’t use some npm package and features like random and hash functions directly and safety

@mbektchiev honestly i think this is a must have, big companies and governments usually require a custom implementation because the framework doesn't support it OOTB, @baryon you can checkout this repo , but i don't know if it works in its current state

@danielgek @baryon It is not entirely correct to state that there's no cryptographic implementation out-of-the-box because actually all crypto APIs provided by the iOS and Android OSes are directly accessible from NativeScript. For example all iOS Security Framework's APIs can be freely used in {N} applications.

I totally agree with you, it's there and might be not that hard to implement but requires more work than expected ;)

Yep, that's true. Maybe having a plugin similar to nativescript-crypto which provides an API similar to Web Crypto's would be a really nice thing to have.