DEV Community

Discussion on: Cryptographically protecting your SPA

 
matpk profile image
Matheus Adorni Dardenne

Cool. JWS seems to work like what I did. Could've saved me some time, but I still enjoyed building this as I learned a lot.

JWE I suppose the front would need to have the secret, so it wouldn't really help. But I guess it can be good for server to server communication?

Thanks for the info.

Thread Thread
 
sgtwilko profile image
sgtwilko

Both JWS and JWE can work either with PSK or public private keys.

It depends on the crypto chosen.

Using RSA or Eliptic curve would work with public private keys, just as your solution did. With these the front end would only need the public key to (decode JWEs &) verify the JWT.

Nothing about JWTs is limited to backend, it's just as applicable to frontend.