Has anyone ever been able to get OpenPGP working o...
# suitescript
s
Has anyone ever been able to get OpenPGP working on server-side scripts? Or otherwise do PGP encryption via suitescript?
a
I'm literally working on openpgp right now, but its client side not server-side, cos it has to be. 😂
s
Can you explain why it has to be client side? I'm assuming you tried it server side- which is what I would do as well and hoping to not waste time on that if there's a specific [insurmountable] reason it didn't work server side?
or is your use case one that needs to be client side due to business requirements?
a
the openpgp library that's most compatible with NS is the one that's used on webpages
s
not a technical limitation of server-side?
a
it makes use of some webApis, those aren't available serverside
its a 40k loc file, I don't want to start messing with it trying to re-engineer it 😄
s
Ah, ok I'm weird enough to be willing to adjust things a bit if needed, but thanks as it sounds like likely a no-go
a
oh you'll HAVE to mess with it to get it to load as a module still
but its minor tweaking
not polyfiling entire webapis
s
do you recall any specific web apis missing? Is it something that could be handled by cryptojs?
a
hmm I don't, there's
window
references in lots of the code... it wasn't crypto stuff it does that itself, it was other helper functionality
223 to be exact
and 95 references to webCrypto
like i said, not worth messing with imo 🙂
looks like it either wants web or node per that comment... so client context gets me what I need, I guess you can try to get all the various node modules it would require and add those? That's generally not fun in my expereince
b
you can make it work if you polyfill the things it looks for
i believe more moderm versions have removed support for amd, so you also have to use a require configuration
s
@battk do you know of anyone that's got this working?
start there to see
the responses slightly change over time as the library changes
s
I often forget that forum exists 😕
ah, reading through that thread it looks like @Watz perhaps successfully encrypted a 'hello world' plaintext? It wasn't clear to me that was confirmed, but would give me hope!
Also, SS2.1 gives me hope vs other attempts to do this in much earlier JS versions.
m
s
thanks @michoel - looks like this has been discussed many times! I'm a bit concerned about the slow execution speed - hope we don't end up with instruction count overflows (governance)