Skip to content

Commit 361bfb0

Browse files
committed
implement all wallet tests
1 parent e4433c9 commit 361bfb0

11 files changed

Lines changed: 960 additions & 71 deletions

File tree

.mise.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ _.file = ['.env', '.env.local']
1515
# You can set these values here, or in a .env.local file that mise will load.
1616
# PRIVY_APP_ID = ""
1717
# PRIVY_APP_SECRET = ""
18-
# PRIVY_WALLET_ID = ""
19-
# PRIVY_PUBLIC_KEY = ""
2018

2119
[tasks.pull-openapi]
2220
description = "Pull the latest OpenAPI spec from the Privy API repo and apply our overlay"

Cargo.lock

Lines changed: 208 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,23 @@ der = { version = "0.7", features = ["std", "alloc"] }
3030
const-oid = { version = "0.10.1", features = ["db"] }
3131
regress = "0.10.4"
3232
uuid = { version = "1.0", features = ["serde"] }
33+
tracing-test = { version = "0.2.5", features = ["no-env-filter"] }
3334

3435
[dev-dependencies]
3536
anyhow = "1.0"
3637
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
3738
dotenv = "0.15"
3839
uuid = { version = "1.0", features = ["v4"] }
40+
chrono = { version = "0.4", features = ["serde"] }
3941
test-case = "3.3.1"
4042
tracing-test = "0.2.5"
4143
tempfile = "3.0"
4244

4345
# used for deterministic key generation under testing
4446
rand_chacha = "0.9.0"
4547
hex = "0.4"
48+
# used to generate JWT tokens for testing
49+
jsonwebtoken = "9.3.1"
4650

4751
[[example]]
4852
doc-scrape-examples = true

examples/delete_user.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,11 @@ async fn main() -> Result<()> {
3232
let app_id = std::env::var("PRIVY_APP_ID").expect("PRIVY_APP_ID environment variable not set");
3333
let app_secret =
3434
std::env::var("PRIVY_APP_SECRET").expect("PRIVY_APP_SECRET environment variable not set");
35-
let wallet_id =
36-
std::env::var("PRIVY_WALLET_ID").expect("PRIVY_WALLET_ID environment variable not set");
37-
let public_key =
38-
std::env::var("PRIVY_PUBLIC_KEY").expect("PRIVY_PUBLIC_KEY environment variable not set");
3935

4036
tracing::info!(
41-
"initializing privy with app_id: {}, app_secret: {}, wallet_id: {}, public_key: {}",
37+
"initializing privy with app_id: {}, app_secret: {}",
4238
app_id,
43-
app_secret,
44-
wallet_id,
45-
public_key
39+
app_secret
4640
);
4741

4842
let client = PrivyClient::new(app_id, app_secret)?;

examples/update_wallet.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
//! - `PRIVY_APP_ID`: Your Privy app ID
1212
//! - `PRIVY_APP_SECRET`: Your Privy app secret
1313
//! - `PRIVY_WALLET_ID`: The wallet ID to update
14-
//! - `PRIVY_PRIVATE_KEY_PATH`: Path to the private key file for authorization
1514
//!
1615
//! ## Usage
1716
//! ```bash
@@ -53,7 +52,7 @@ async fn main() -> Result<()> {
5352
let client = PrivyClient::new(app_id.clone(), app_secret)?;
5453

5554
let ctx = AuthorizationContext::new();
56-
ctx.push(PrivateKeyFromFile("private_key.pem".into()));
55+
ctx.push(key);
5756
ctx.push(JwtUser(client.clone(), "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhbGV4QGFybHlvbi5kZXYiLCJpYXQiOjEwMDAwMDAwMDAwMH0.IpNgavH95CFZPjkzQW4eyxMIfJ-O_5cIaDyu_6KRXffykjYDRwxTgFJuYq0F6d8wSXf4de-vzfBRWSKMISM3rJdlhximYINGJB14mJFCD87VMLFbTpHIXcv7hc1AAYMPGhOsRkYfYXuvVopKszMvhupmQYJ1npSvKWNeBniIyOHYv4xebZD8L0RVlPvuEKTXTu-CDfs2rMwvD9g_wiBznS3uMF3v_KPaY6x0sx9zeCSxAH9zvhMMtct_Ad9kuoUncGpRzNhEk6JlVccN2Leb1JzbldxSywyS2AApD05u-GFAgFDN3P39V3qgRTGDuuUfUvKQ9S4rbu5El9Qq1CJTeA".to_string()));
5857

5958
let wallets_client = client.wallets();

0 commit comments

Comments
 (0)