Native support for JWT
What are you building with SQLPage ?
A proof of concept for use as a general purpose engine for declarative apps
What is your problem ? A description of the problem, not the solution you are proposing.
I would like to manage sessions for users with a stateless solution
What are you currently doing ? Since your solution is not implemented in SQLPage currently, what are you doing instead ?
JWT or PHP sessions
Describe the solution you'd like
Provide two built-in functions (like in this project https://github.com/michelp/pgjwt):
sqlpage_jwt_sign(payload: json_str, secret: str) -> strprovides a JWT signed using the provided secretsqlpage_jwt_verify(jwt_token: str, secret: str) -> |header: json_str|payload: json_str|valid: bool|verifies that the provided JWT and gives the payload and the header
Describe alternatives you've considered
Using https://github.com/michelp/pgjwt
Additional context
Hello, and thank you for getting in touch ! This sounds very interesting ! Could you open a pull request ?
Hello, I'm glad you find this interesting. I would be pleased to open a pull request. I have never programmed in Rust but if you give me some time I could try to draft something. Could you give me some pointers of which parts of the program to modify to add functions?
Sure ! We have a contribution guide here : Don't hesitate to ping me if anything sounds unclear or too complex, I'll be happy to help !
For this particular issue, I think what you will be the most interested in is: https://github.com/sqlpage/SQLPage/blob/main/examples/official-site/functions.sql. You can declare new sqlpage functions entirely from that file.
For manipulating the jwt themselves, you can add https://crates.io/crates/jwt-simple to the dependencies