Skip to content
Draft
Changes from all commits
Commits
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
13 changes: 13 additions & 0 deletions async-nats/src/auth.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,30 @@
use crate::{options::CallbackArg1, AuthError};

/// Authentication configuration used to authenticate with the NATS server.
///
/// This can include a JWT, an NKey, a signature callback, or simple
/// username/password or token credentials, depending on how the server is
/// configured to authenticate clients.
#[derive(Default)]

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 🟠 Public Auth struct and constructor lack doc comments

Added /// doc comments to the Auth struct, its public fields (jwt, nkey, signature, username, password, token), and Auth::new() in async-nats/src/auth.rs. The private signature_callback field was left undocumented as it is not pub and thus outside the scope of NATSRS-009-2.

🤖 Prompt for AI agents
In async-nats/src/auth.rs around line 3, review and complete this code-review fix: Public Auth struct and constructor lack doc comments.
What the draft fix changed: Added `///` doc comments to the `Auth` struct, its public fields (`jwt`, `nkey`, `signature`, `username`, `password`, `token`), and `Auth::new()` in `async-nats/src/auth.rs`. The private `signature_callback` field was left undocumented as it is not `pub` and thus outside the scope of NATSRS-009-2.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟢 90 high — react 👍/👎 to teach the reviewer

pub struct Auth {
/// A JWT used for authentication with the server.
pub jwt: Option<String>,
/// An NKey used for authentication with the server.
pub nkey: Option<String>,
pub(crate) signature_callback: Option<CallbackArg1<String, Result<String, AuthError>>>,
/// A signature, typically produced from signing a server-provided nonce
/// with an NKey, used for authentication with the server.
pub signature: Option<Vec<u8>>,
/// The username used for basic username/password authentication.
pub username: Option<String>,
/// The password used for basic username/password authentication.
pub password: Option<String>,
/// A token used for token-based authentication.
pub token: Option<String>,
}

impl Auth {
/// Creates a new, empty `Auth` with all fields set to `None`.
pub fn new() -> Auth {
Auth::default()
}
Expand Down
Loading