An easy-to-host PDS on the ATProtocol, iPhone and MacOS. Maintain control of your keys and data, always.
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: resolve Phase 2 review issues (needless_borrow, formatting, doc comment)

- Remove needless borrow: change &relay to relay at oauth.rs:470
* relay is already &RelayClient from state.relay_client()
* Passing &relay created &&RelayClient, now corrected

- Fix formatting violations in lib.rs and oauth.rs
* cargo fmt corrects line breaks in oauth.rs:44-46
* cargo fmt corrects line breaks in lib.rs:339-346
* cargo fmt corrects line breaks in lib.rs:556-559
* cargo fmt corrects line breaks in lib.rs:605-608

- Update check_handle_resolution doc comment (lib.rs)
* Previous doc said "Never rejects" but return type is Result<bool, String>
* Updated to clarify: "Returns Result for Tauri IPC compatibility, but never returns Err"
* Matches actual behavior where network errors return false, not Err

authored by

Malpercio and committed by
Tangled
ad8ac963 479aa9bd

+20 -16
+18 -13
apps/identity-wallet/src-tauri/src/lib.rs
··· 339 339 })?; 340 340 341 341 // Step 2: Fetch the relay's active signing key (public, no auth required). 342 - let resp = 343 - state 344 - .relay_client() 345 - .get("/v1/relay/keys") 346 - .await 347 - .map_err(|e| DIDCeremonyError::NetworkError { 348 - message: e.to_string(), 349 - })?; 342 + let resp = state 343 + .relay_client() 344 + .get("/v1/relay/keys") 345 + .await 346 + .map_err(|e| DIDCeremonyError::NetworkError { 347 + message: e.to_string(), 348 + })?; 350 349 351 350 let status = resp.status(); 352 351 if status.as_u16() == 503 { ··· 555 554 match status.as_u16() { 556 555 400 => { 557 556 let envelope: RelayErrorEnvelope = 558 - resp.json().await.map_err(|e| RegisterHandleError::Unknown { 559 - message: e.to_string(), 560 - })?; 557 + resp.json() 558 + .await 559 + .map_err(|e| RegisterHandleError::Unknown { 560 + message: e.to_string(), 561 + })?; 561 562 if envelope.error.code == "INVALID_HANDLE" { 562 563 Err(RegisterHandleError::InvalidHandle) 563 564 } else { ··· 583 584 /// 584 585 /// Returns `true` when the relay resolves the handle to the expected DID (HTTP 200 + matching 585 586 /// `did` field). Returns `false` for any other response (handle not yet propagated, relay 586 - /// unreachable, DID mismatch). Never rejects — callers can safely poll on an interval. 587 + /// unreachable, DID mismatch). Returns `Result<bool, String>` for Tauri IPC compatibility, but 588 + /// never returns `Err` — callers can safely poll on an interval. 587 589 #[tauri::command] 588 590 async fn check_handle_resolution( 589 591 handle: String, ··· 602 604 }; 603 605 604 606 if !resp.status().is_success() { 605 - tracing::debug!(status = resp.status().as_u16(), "check_handle_resolution: non-success response, returning false"); 607 + tracing::debug!( 608 + status = resp.status().as_u16(), 609 + "check_handle_resolution: non-success response, returning false" 610 + ); 606 611 return Ok(false); 607 612 } 608 613
+2 -3
apps/identity-wallet/src-tauri/src/oauth.rs
··· 42 42 /// Returns the configured relay client, or initializes with the compile-time 43 43 /// default URL if none has been set yet. 44 44 pub fn relay_client(&self) -> &crate::http::RelayClient { 45 - self.relay_client 46 - .get_or_init(crate::http::RelayClient::new) 45 + self.relay_client.get_or_init(crate::http::RelayClient::new) 47 46 } 48 47 49 48 /// Set the relay client from a runtime URL. Silently ignored if already set ··· 467 466 // 7. Token exchange. 468 467 let token_htu = format!("{}/oauth/token", state.relay_client().base_url_str()); 469 468 let (token_resp, initial_nonce) = 470 - exchange_code_with_retry(&relay, &dpop, &callback.code, &pkce_verifier, &token_htu).await?; 469 + exchange_code_with_retry(relay, &dpop, &callback.code, &pkce_verifier, &token_htu).await?; 471 470 472 471 // 8. Store tokens in Keychain. 473 472 crate::keychain::store_oauth_tokens(&token_resp.access_token, &token_resp.refresh_token)