Did anyone get recently added crypto polyfill to work?
I tried to import a function to generate key pairs but it never worked (Object is not a function)
import { generateKeyPairSync } from 'crypto'
Also, tried crypto.subtle.generateKeys
and a few other ways but always hit the wall.
Any guidance on how to use crypto from Forge runtime?
2 Likes
The crypto
polyfill used in the Forge runtime is crypto-browserify
. It only supports a subset of the Node.js crypto
module and, unfortunately, generateKeyPairSync
isn’t one of the supported functions.
1 Like
Thanks for your reply and saving the day!
Since it includes publicEncrypt/privateDecrypt (rsa)
, according to the description on NPM it would mainly do the trick.
2 Likes