Skip to content

Commit

Permalink
fix: add randomized pre-authorized_code, access_token and `c_nonc…
Browse files Browse the repository at this point in the history
…e` (#16)

* feat: add `pre_authorized_code` generator

* fix: fix clippy warning

* test: improve tests, add `test_create_credential_response_with_multiple_subjects`

* fix: increase `generate_random_string` size
  • Loading branch information
nanderstabel authored Jan 15, 2024
1 parent 3949d8e commit 7a50c12
Show file tree
Hide file tree
Showing 4 changed files with 327 additions and 138 deletions.
40 changes: 40 additions & 0 deletions Cargo.lock

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

13 changes: 4 additions & 9 deletions agent_api_rest/src/credential_issuer/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ mod tests {
body::Body,
http::{self, Request},
};
use serde_json::{json, Value};
use serde_json::Value;
use tower::ServiceExt;

#[tokio::test]
Expand Down Expand Up @@ -111,13 +111,8 @@ mod tests {

let body = hyper::body::to_bytes(response.into_body()).await.unwrap();
let body: Value = serde_json::from_slice(&body).unwrap();
assert_eq!(
body,
json!({
"access_token": "unsafe_access_token",
"token_type": "bearer",
"c_nonce": "unsafe_c_nonce"
})
);
assert!(body["access_token"].as_str().is_some());
assert_eq!(body["token_type"], "bearer");
assert!(body["c_nonce"].as_str().is_some());
}
}
2 changes: 2 additions & 0 deletions agent_issuance/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ derivative = "2.2"
did-key = "0.2"
jsonschema = "0.17"
jsonwebtoken = "8.2"
rand = "0.8"
serde.workspace = true
serde_json.workspace = true
thiserror.workspace = true
Expand All @@ -27,4 +28,5 @@ uuid.workspace = true

[dev-dependencies]
lazy_static.workspace = true
serial_test = "3.0"
tokio = { version = "1", features = ["full"] }
Loading

0 comments on commit 7a50c12

Please sign in to comment.