Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Json Web Token verification #72

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
ee7e60d
WIP adding JWT
lukewilliamboswell Aug 30, 2024
ede4a43
WIP strange segfault
lukewilliamboswell Aug 30, 2024
bee33df
inital working version
lukewilliamboswell Aug 30, 2024
53653f2
BUG Error in alias analysis
lukewilliamboswell Aug 30, 2024
543688d
comment out test for now
lukewilliamboswell Aug 30, 2024
163ca02
add tests for HS algorithms
lukewilliamboswell Aug 31, 2024
40077e0
add note about other algorithms
lukewilliamboswell Aug 31, 2024
408f4e1
add expect script for json example
lukewilliamboswell Sep 1, 2024
9f48e21
add todos.db back
lukewilliamboswell Sep 1, 2024
7ff49c3
copy todos db
lukewilliamboswell Sep 1, 2024
653845c
revert todos db
lukewilliamboswell Sep 1, 2024
10c24de
maybe this is the right todos.db to revert to
lukewilliamboswell Sep 1, 2024
75b9cf1
remove stale comment
lukewilliamboswell Sep 1, 2024
4446fa8
use proper impl for algorithm
lukewilliamboswell Sep 1, 2024
5ab429a
use proper error tag union for Jwt
lukewilliamboswell Sep 2, 2024
e8c5562
improve erros handling for parsing claims
lukewilliamboswell Sep 2, 2024
c051757
add support for RS variants
lukewilliamboswell Sep 2, 2024
7e7838e
BUG Error in alias analysis
lukewilliamboswell Sep 3, 2024
9767410
helpers to create jwt decoding keys
lukewilliamboswell Sep 4, 2024
eb9e3f7
WIP improved API for JWT
lukewilliamboswell Sep 4, 2024
966db3a
WIP segfault somewhere
lukewilliamboswell Sep 4, 2024
5479758
WIP still looking for segfault
lukewilliamboswell Sep 4, 2024
c2f83c3
WIP strip everything back to minimise segfault
lukewilliamboswell Sep 4, 2024
af5f1c5
use roc_std from roc-lang/roc
lukewilliamboswell Sep 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
204 changes: 202 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ members = [
"crates/roc_host",
"crates/roc_host_lib",
"crates/roc_host_bin",
"crates/json_web_token",
]

[profile.release]
Expand Down
19 changes: 19 additions & 0 deletions ci/expect_scripts/json-web-token.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/expect

# uncomment line below for debugging
# exp_internal 1

set timeout 7

set env(TARGET_URL) "http://www.example.com"

spawn $env(EXAMPLES_DIR)json-web-token

expect -exact "All tests passed\r\n" {
expect "Listening on <http://127.0.0.1:8000>\r\n" {
exit 0
}
}

puts stderr "\nError: output was different than expected."
exit 1
20 changes: 20 additions & 0 deletions crates/json_web_token/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[package]
name = "json_web_token"
version = "0.0.1"
authors = ["The Roc Contributors"]
license = "UPL-1.0"
edition = "2018"
description = "Provides a simple interface for working with JWTs"

[lib]
crate-type = ["rlib"]
name = "json_web_token"
path = "src/lib.rs"

[dependencies]
indoc = "2"
jwt = { version = "0.16.0", features = ["openssl"]}
hmac = "0.12.1"
sha2 = "0.10.8"
serde_json = "1.0.127"
openssl = {version = "0.10.66", features = ["vendored"]}
Loading
Loading