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

feat: add claims and scope support #18

Merged
merged 29 commits into from
Jun 2, 2023
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
32c5679
Add support for Request by reference
nanderstabel Apr 14, 2023
2bf62f8
Improve struct field serde
nanderstabel Apr 17, 2023
92b67d0
fix: remove custom serde
nanderstabel Apr 19, 2023
9fdc872
Add claims and scope parameters
nanderstabel Apr 19, 2023
274fb01
Add Storage and RelyingParty test improvement
nanderstabel Apr 19, 2023
c7cd934
Update README example
nanderstabel Apr 19, 2023
f601506
fix: Add standard_claims to test IdToken
nanderstabel Apr 19, 2023
1b8cb5b
Move Storage trait to test_utils
nanderstabel Apr 19, 2023
1782356
Remove storage.rs
nanderstabel Apr 19, 2023
cb9151a
docs: adjust comments for fn generate_response
nanderstabel Apr 24, 2023
2ee67da
fix: loosen serde version
nanderstabel Apr 24, 2023
1efe636
fix: loosen serde dependency versions
nanderstabel Apr 24, 2023
358ab96
fix: fix dev-dependencies
nanderstabel Apr 24, 2023
f6a6e66
fix: fex rebase to dev
nanderstabel Apr 25, 2023
e84f57a
fix: fix rebase to dev
nanderstabel Apr 25, 2023
6f13b7c
feat: add rust-tls feature flag
nanderstabel Apr 25, 2023
b0f640d
fix: remove skeptic crate
nanderstabel Apr 25, 2023
ad893af
docs: add todo comment
nanderstabel May 4, 2023
03ba308
fix: adjust TODO comment
nanderstabel May 11, 2023
8fc4887
feat: add Claim trait with associated types
nanderstabel May 12, 2023
ca022ea
fix: Remove Deref derive for Scope
nanderstabel May 12, 2023
73854a8
fix: fix mutable id_token
nanderstabel May 12, 2023
e18e956
style: consistent use of to_string over to_owned
nanderstabel May 12, 2023
96372f5
fix: use derive_more::Display for ScopeValue
nanderstabel May 12, 2023
1458170
fix: fix rust-analyzer complaint
nanderstabel May 12, 2023
ad71edf
fix: build
nanderstabel May 23, 2023
1e8e818
fix: remove build.rs and change crate name in doc tests
nanderstabel May 24, 2023
40dce93
feat: refactor claims.rs
nanderstabel May 30, 2023
df50347
style: restyle StandardClaims serde bounds
nanderstabel May 31, 2023
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
12 changes: 4 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ homepage = "https://www.impierce.com/"
keywords = ["openid4vc", "siopv2", "openid4vp", "openid4vci", "OpenID Connect"]
license = "Apache-2.0"
repository = "https://github.com/impierce/openid4vc"
build = "build.rs"

[dependencies]
tokio = { version = "1.26.0", features = ["rt", "macros", "rt-multi-thread"] }
serde = { version = "1.0.154", features = ["derive"]}
serde_json = "1.0.94"
serde = { version = "1.0", features = ["derive"]}
serde_json = "1.0"
serde_with = "2.3"
anyhow = "1.0.70"
chrono = "0.4.24"
getset = "0.1.2"
jsonwebtoken = "8.2.0"
reqwest = { version = "0.11.14", features = ["json"] }
reqwest = { version = "0.11.14", default-features = false, features = ["json", "rustls-tls"] }
base64-url = "2.0.0"
async-trait = "0.1.68"
did_url = "0.1.0"
Expand All @@ -31,8 +31,4 @@ ed25519-dalek = "1.0.1"
rand = "0.7"
lazy_static = "1.4.0"
derivative = "2.2.0"
skeptic = "0.13"
wiremock = "0.5.18"

[build-dependencies]
skeptic = "0.13"
29 changes: 20 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ use ed25519_dalek::{Keypair, Signature, Signer};
use lazy_static::lazy_static;
use rand::rngs::OsRng;
use siopv2::{
request::ResponseType, IdToken, Provider, Registration, RelyingParty, RequestUrl, SiopRequest, SiopResponse,
Subject, Validator,
claims::{Claim, ClaimRequests},
request::ResponseType, StandardClaim,
IdToken, Provider, Registration, RelyingParty, RequestUrl, Scope, SiopRequest, SiopResponse, Subject, Validator,
};
use wiremock::{
http::Method,
Expand Down Expand Up @@ -103,17 +104,24 @@ async fn main() {
// Create a new RequestUrl with response mode `post` for cross-device communication.
let request: SiopRequest = RequestUrl::builder()
.response_type(ResponseType::IdToken)
.client_id("did:mymethod:relyingparty".to_owned())
.scope("openid".to_owned())
.client_id("did:mymethod:relyingparty".to_string())
.scope(Scope::openid())
.redirect_uri(format!("{server_url}/redirect_uri"))
.response_mode("post".to_owned())
.response_mode("post".to_string())
.registration(
Registration::default()
.with_subject_syntax_types_supported(vec!["did:mymethod".to_owned()])
.with_id_token_signing_alg_values_supported(vec!["EdDSA".to_owned()]),
.with_subject_syntax_types_supported(vec!["did:mymethod".to_string()])
.with_id_token_signing_alg_values_supported(vec!["EdDSA".to_string()]),
)
.claims(ClaimRequests {
id_token: Some(StandardClaim {
name: Some(Claim::default()),
..Default::default()
}),
..Default::default()
})
.exp((Utc::now() + Duration::minutes(10)).timestamp())
.nonce("n-0S6_WzA2Mj".to_owned())
.nonce("n-0S6_WzA2Mj".to_string())
.build()
.and_then(TryInto::try_into)
.unwrap();
Expand Down Expand Up @@ -156,7 +164,10 @@ async fn main() {

// Let the provider generate a response based on the validated request. The response is an `IdToken` which is
// encoded as a JWT.
let response = provider.generate_response(request).await.unwrap();
let response = provider
.generate_response(request, StandardClaim::default())
.await
.unwrap();

// The provider sends it's response to the mock server's `redirect_uri` endpoint.
provider.send_response(response).await.unwrap();
Expand Down
4 changes: 0 additions & 4 deletions build.rs

This file was deleted.

Loading