basic-webserver icon indicating copy to clipboard operation
basic-webserver copied to clipboard

Add support for Json Web Token verification

Open lukewilliamboswell opened this issue 1 year ago • 1 comments

Based on builtin-task so most of these commits should merge (hopefully) and disappear.

lukewilliamboswell avatar Aug 30 '24 04:08 lukewilliamboswell

Implementation is good to go with 3/12 algorithms implemented and the example working ok. It's mostly a matter of copy-paste to include the other algorithms, but we can do this later.

There is a lurking Error in alias analysis issue which I think blocks this PR as it's too easy to hit.

test case

# Test Hs256 algorithm
result = Jwt.verify! {
    secret: "shhh_very_secret",
    algorithm: Hs256,
    token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.joReqPNNkWQ8zQCW3UQnhc_5NMrSZEOQYpk6sDS6Y-o",
}

demo

Screenshot 2024-08-30 at 16 59 11

lukewilliamboswell avatar Aug 30 '24 07:08 lukewilliamboswell

Closing as this has gone very stale, and I am not planning on adding/fixing/completing this any time soon.

lukewilliamboswell avatar Jan 08 '25 05:01 lukewilliamboswell