Documentation
¶
Overview ¶
Package otp generates TOTP codes for GitHub 2FA automation in e2e tests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnterTOTPCode ¶
EnterTOTPCode detects a GitHub TOTP input (#app_totp) on the current page, generates a code from the given secret, and enters it via simulated keystrokes. On the 2FA login page, GitHub auto-submits after 6 digits; on sudo pages, the submit button is clicked explicitly. If the first code is rejected, it retries once after waiting for the next TOTP period. Returns true if a TOTP form was found and submitted successfully. Returns (false, nil) if no TOTP input is visible.
func GenerateCode ¶
GenerateCode produces a 6-digit TOTP code from a base32-encoded secret. If the current time is within 4 seconds of a 30-second period boundary, it sleeps until the next period to avoid generating a code that expires before the recipient can validate it.
Types ¶
This section is empty.