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

sqld: libsql-wal simulator #1764

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
209 changes: 201 additions & 8 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions libsql-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ priority-queue = "1.3"
prost = "0.12"
rand = "0.8"
regex = "1.7.0"
reqwest = { version = "0.11.16", features = ["json", "rustls-tls"], default-features = false }
reqwest = { version = "0.12", features = ["json", "rustls-tls"], default-features = false }
rusqlite = { workspace = true }
rustls = "0.21.7"
rustls-pemfile = "1.0.3"
Expand Down Expand Up @@ -99,7 +99,6 @@ dialoguer = { version = "0.11.0", features = ["history"] }
indicatif = "0.17.8"

[dev-dependencies]
arbitrary = { version = "1.3.0", features = ["derive_arbitrary"] }
env_logger = "0.10"
hyper = { workspace = true, features = ["client"] }
insta = { version = "1.26.0", features = ["json"] }
Expand All @@ -108,14 +107,15 @@ libsql-client = { version = "0.6.5", default-features = false, features = ["reqw
proptest = "1.0.0"
rand = "0.8.5"
tempfile = "3.7.0"
turmoil = "0.6.0"
turmoil = "0.6.3"
url = "2.3"
metrics-util = "0.15"
s3s = "0.8.1"
s3s-fs = "0.8.1"
ring = { version = "0.17.8", features = ["std"] }
tonic-build = "0.11"
prost-build = "0.12"
rand_chacha = { version = "0.3.1", features = ["simd"] }

[build-dependencies]
vergen = { version = "8", features = ["build", "git", "gitcl"] }
Expand Down
19 changes: 13 additions & 6 deletions libsql-server/tests/auth/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#![allow(deprecated)]

use futures::SinkExt as _;
use jsonwebtoken::EncodingKey;
use libsql::Database;
use libsql_server::{
auth::{
Expand Down Expand Up @@ -41,15 +42,21 @@ async fn make_standalone_server(auth_strategy: Auth) -> Result<(), Box<dyn std::
Ok(())
}

fn gen_test_jwt_auth() -> (Auth, String) {
let (encoding_key, decoding_key) = key_pair();
let jwt_keys = vec![jsonwebtoken::DecodingKey::from_ed_components(&decoding_key).unwrap()];

let auth = Auth::new(user_auth_strategies::Jwt::new(jwt_keys));
pub fn make_auth(decoding: &str) -> Auth {
let jwt_keys = vec![jsonwebtoken::DecodingKey::from_ed_components(decoding).unwrap()];
Auth::new(user_auth_strategies::Jwt::new(jwt_keys))
}

pub fn make_default_token(encoding: &EncodingKey) -> String {
let claims = Token::default();
let token = encode(&claims, &encoding);
token
}

let token = encode(&claims, &encoding_key);
fn gen_test_jwt_auth() -> (Auth, String) {
let (encoding_key, decoding_key) = key_pair();
let auth = make_auth(&decoding_key);
let token =make_default_token(&encoding_key);

(auth, token)
}
Expand Down
Loading
Loading