Can I use sha256 function in Ionic?

If the iOS Safari version is sufficiently old (like <10), its implementation may be wonky. If you are using WkWebview, that may help. You could also look at webcrypto-shim.

1 Like

Thanks much appreciated!

Hi, im trying to use the WebCrypto API but im having a little difficult converting string to ArrayBuffer, do you have any hint on that?

The js-jose library has some utility functions that do that; look for arrayFromString() and stringFromArray().

i used the functions and it works now, but i still have a problem, when i use “ionic cordova run” command to debug the app, the crypto.subtle object is undefined, when i use “ionic cordova build” command, the WebCrypto works fine… it should be that way?

Gracias, me ayudó mucho tu código. Solo que en ionic 4 tuve que usar

import * as CryptoJS from 'crypto-js';

Muchas gracias.