docs: document auth.BcryptCost, DefaultRefreshTokenTTL, PasskeyCredentialDTO, GenerateTOTPCode#37
Merged
Conversation
…tialDTO, GenerateTOTPCode - Add auth.BcryptCost constant to Crypto utilities section so callers know the exported name when hashing passwords themselves - Reference handler.DefaultRefreshTokenTTL by name in the AuthHandler snippet comment instead of just the numeric literal - Document handler.PasskeyCredentialDTO response type (returned by FinishRegistration and ListCredentials) with its JSON field names - Add auth.GenerateTOTPCode to the TOTP section with a note that it is intended for testing/tooling rather than production validation Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the README to document previously undocumented exported/public API symbols so integrators can rely on stable names and response shapes without digging into source.
Changes:
- Document
auth.BcryptCostusage in the crypto utilities section. - Add a README example for
auth.GenerateTOTPCode(testing/tooling use). - Document
handler.PasskeyCredentialDTOresponse shape and referencehandler.DefaultRefreshTokenTTLin the AuthHandler snippet.
Show a summary per file
| File | Description |
|---|---|
| README.md | Adds missing documentation/examples for exported auth/handler symbols and passkey DTO response shape. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 3
…e with main Rename `hash` to `tokenHash`/`passwordHash` in the crypto utilities snippet to avoid shadowing and invalid Go when both variables appear in the same block. Also merge origin/main: pick up GenerateTOTPCode comment wording and PasskeyCredentialDTO response-type section improvements.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR fills four small but meaningful documentation gaps in the README — exported symbols that were undocumented despite being part of the public API.
Changes
auth.BcryptCost(Crypto utilities section)The constant was used internally and its value mentioned in prose ("Bcrypt cost 12"), but the exported name was never shown. Callers that hash passwords outside of
AuthHandler(e.g. seeding a database) should useauth.BcryptCostto stay consistent with the rest of the library.handler.DefaultRefreshTokenTTL(AuthHandler snippet)The
AuthHandler.RefreshTokenTTLgodoc referencesDefaultRefreshTokenTTLby name but the README only showed the numeric literal7 * 24 * time.Hour. Updated the comment to name the constant so readers know they can reference it directly.handler.PasskeyCredentialDTO(PasskeyHandler section)FinishRegistration(201) andListCredentials(200) return this type, but it was never mentioned in the docs. Added the struct definition with JSON field names so integrators know the response shape without digging into source.auth.GenerateTOTPCode(TOTP / MFA section)This function is public and useful for integration tests and CLI tooling. Added a one-liner example with a note that
ValidateTOTPshould be used in production code.Testing
Documentation-only change — no behaviour altered. Existing tests remain unaffected.
Warning
The following domain was blocked by the firewall during workflow execution:
proxy.golang.orgTo allow these domains, add them to the
network.allowedlist in your workflow frontmatter:See Network Configuration for more information.
Greptile Summary
This documentation-only PR adds README coverage for four public API symbols —
auth.BcryptCost,handler.DefaultRefreshTokenTTL,handler.PasskeyCredentialDTO, andauth.GenerateTOTPCode— all of which were verified accurate against the source. Two snippets (MagicLinkHandlerand Quick start) still use the bare numeric literal7 * 24 * time.Hourrather than the newly-referencedhandler.DefaultRefreshTokenTTLconstant, leaving minor inconsistencies in the documentation.Confidence Score: 5/5
Safe to merge — documentation-only change with no behavioural impact.
All findings are P2 style suggestions. The documented content is accurate against the source code. No code correctness, security, or data-integrity issues are introduced.
No files require special attention beyond the two minor DefaultRefreshTokenTTL literal inconsistencies in README.md.
Important Files Changed
Sequence Diagram
sequenceDiagram participant Client participant AuthHandler participant PasskeyHandler participant TOTPHandler Note over Client,TOTPHandler: Flows newly documented in this PR Client->>AuthHandler: POST /auth/signup or /auth/login AuthHandler-->>Client: token + refresh_token (handler.DefaultRefreshTokenTTL) Client->>PasskeyHandler: POST /auth/passkey/register/finish PasskeyHandler-->>Client: PasskeyCredentialDTO {id, name, aaguid, created_at} (201) Client->>PasskeyHandler: GET /auth/passkey/credentials PasskeyHandler-->>Client: []PasskeyCredentialDTO (200) Note over Client,TOTPHandler: TOTP testing/tooling helper Client->>TOTPHandler: auth.GenerateTOTPCode(secret, time.Now()) TOTPHandler-->>Client: 6-digit code (use ValidateTOTP in production)Comments Outside Diff (1)
README.md, line 650 (link)DefaultRefreshTokenTTLreference inMagicLinkHandlersnippetThe
AuthHandlersnippet on line 472 was updated to add// defaults to handler.DefaultRefreshTokenTTL (7 days) when Sessions is set, making the constant discoverable. TheMagicLinkHandlerstruct exposes the sameRefreshTokenTTLfield with the same default behaviour (as seen inhandler/magiclink.goline 32), but this snippet still shows only the bare numeric literal with no mention ofDefaultRefreshTokenTTL.Prompt To Fix With AI
Prompt To Fix All With AI
Reviews (2): Last reviewed commit: "docs: fix code variable collision in TOT..." | Re-trigger Greptile