Skip to content

docs(NODE-4990): comment about serverNonce format #3547

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 2 commits into from
Jan 31, 2023

Conversation

nbbeeken
Copy link
Contributor

Description

What is changing?

Add a comment for a confusing bit of code

Double check the following

  • Ran npm run check:lint script
  • Self-review completed using the steps outlined here
  • PR title follows the correct format: type(NODE-xxxx)[!]: description
    • Example: feat(NODE-1234)!: rewriting everything in coffeescript
  • Changes are covered by tests
  • New TODOs have a related JIRA ticket

Sorry, something went wrong.

Verified

This commit was signed with the committer’s verified signature.
nbbeeken Neal Beeken
if (!ByteUtils.equals(serverNonce.subarray(0, nonce.byteLength), nonce)) {
// The serverNonce's leading 32 bytes must equal the client nonce's 32 bytes
Copy link
Contributor

Choose a reason for hiding this comment

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

should this comment be above this block? and also, I thought you were going to at least mention the spec in case someone else is wondering where this comes from

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I usually prefer to put comments inside the if, just a habit, trying to make the code read like "if X is true, do Y" so if I'm following my own practice I should write something more like: // throw because the server's nonce must begin with... kinda like how mocha test the "it" is supposed to imply "the function under test should..."

will add a link to the spec

Copy link
Contributor Author

Choose a reason for hiding this comment

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

https://github.com/mongodb/specifications/blob/875446db44aade414011731840831f38a6c668df/source/auth/auth.rst#id11

I used the latest commit hash incase a future version changes the header link

@dariakp dariakp added the Primary Review In Review with primary reviewer, not yet ready for team's eyes label Jan 30, 2023

Verified

This commit was signed with the committer’s verified signature.
nbbeeken Neal Beeken
@nbbeeken nbbeeken requested a review from dariakp January 30, 2023 23:45
@dariakp dariakp merged commit 13c6072 into main Jan 31, 2023
@dariakp dariakp deleted the NODE-4990-docs-serverNonce branch January 31, 2023 00:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Primary Review In Review with primary reviewer, not yet ready for team's eyes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants