Julien-cpsn / ATAC

A simple API client (postman like) in your terminal
https://atac.julien-cpsn.com/
MIT License
1.86k stars 81 forks source link

scripting-support: add generate_signed_jwt JS-native method to script… #106

Open anussel5559 opened 1 month ago

anussel5559 commented 1 month ago

… env

Currently, it's not possible to generate a signed JWT token to use for authrozation, either through native rust functionality in the ATAC app, or through the JS scripting environment.

This PR generates a new rust-native method (so can be shared for more rust-native JWT features) to generate a signed JWT. It then creates a boa_engine compatible wrapper around that rust method to inject it in to the available scope for the JS scripts users may write.

Testing: using the function with a PEM key works - image

using the function with a secret/shared key works - image