-
-
Notifications
You must be signed in to change notification settings - Fork 30
Acme account features #100
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
469ef25
account features added to instant acme client
christianhoelzl 11139bd
typo fixed
christianhoelzl 6a629f5
changes after djc review
christianhoelzl cb63418
pebble test and clippy fixes
christianhoelzl cef3adb
readme, clippy, and review
christianhoelzl c84e9c9
review changes
christianhoelzl a478d89
fix mailto
christianhoelzl 96d34ec
revert set ready change
christianhoelzl 6109206
main branch update
christianhoelzl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -307,12 +307,73 @@ async fn account_deactivate() -> Result<(), Box<dyn StdError>> { | |
| }; | ||
|
|
||
| assert_eq!( | ||
| problem.r#type, | ||
| Some("urn:ietf:params:acme:error:unauthorized".to_string()) | ||
| problem.r#type.as_deref(), | ||
| Some("urn:ietf:params:acme:error:unauthorized") | ||
| ); | ||
| Ok(()) | ||
| } | ||
|
|
||
| #[tokio::test] | ||
| #[ignore] | ||
| async fn update_contacts() -> Result<(), Box<dyn StdError>> { | ||
| try_tracing_init(); | ||
|
|
||
| // Creat an env/initial account | ||
| let env = Environment::new(EnvironmentConfig::default()).await?; | ||
|
|
||
| // Provide empty contacts information, this is fine for pebble | ||
| env.account.update_contacts(&[]).await?; | ||
|
|
||
| // Provide an email address as contacts information | ||
| env.account | ||
| .update_contacts(&["mailto:[email protected]"]) | ||
| .await?; | ||
|
|
||
| Ok(()) | ||
| } | ||
|
|
||
| #[tokio::test] | ||
| #[ignore] | ||
| async fn change_key() -> Result<(), Box<dyn StdError>> { | ||
christianhoelzl marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| try_tracing_init(); | ||
|
|
||
| // Creat an env/initial account | ||
| let mut env = Environment::new(EnvironmentConfig::default()).await?; | ||
|
|
||
| let dir = &format!("https://{}/dir", &env.config.pebble.listen_address); | ||
|
|
||
| // Change the account key | ||
| let new_credentials = env.account.change_key(dir).await?; | ||
|
|
||
| // Using the old ACME account key should now produce malformed error. | ||
| let Err(Error::Api(problem)) = env | ||
| .account | ||
| .update_contacts(&["mailto:[email protected]"]) | ||
| .await | ||
| else { | ||
| panic!("unexpected error result"); | ||
| }; | ||
|
|
||
| assert_eq!( | ||
| problem.r#type.as_deref(), | ||
| Some("urn:ietf:params:acme:error:malformed") | ||
| ); | ||
|
|
||
| // Change the Pebble environment to use the new ACME account key. | ||
| env.account = instant_acme::Account::from_credentials_and_http( | ||
| new_credentials, | ||
| Box::new(env.client.clone()), | ||
| ) | ||
| .await?; | ||
|
|
||
| // Using the new ACME account key should not produce an error. | ||
| env.account | ||
| .update_contacts(&["mailto:[email protected]"]) | ||
| .await?; | ||
|
|
||
| Ok(()) | ||
| } | ||
|
|
||
| fn try_tracing_init() { | ||
| let _ = tracing_subscriber::registry() | ||
| .with(fmt::layer()) | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.