Skip to content

fix: strip stray characters from pasted API key on Windows#169

Merged
schpet merged 1 commit intoschpet:mainfrom
WhiteMinds:fix/auth-login-windows-paste
Mar 6, 2026
Merged

fix: strip stray characters from pasted API key on Windows#169
schpet merged 1 commit intoschpet:mainfrom
WhiteMinds:fix/auth-login-windows-paste

Conversation

@WhiteMinds
Copy link
Contributor

Summary

  • Fixes auth login failing with "Invalid API key" when the key is pasted interactively on Windows
  • Cliffy's Secret.prompt injects tilde (~) characters at the start and end of pasted text on Windows terminals (bracket paste mode side-effect), e.g. ~lin_api_xxx~ instead of lin_api_xxx
  • Trims whitespace and strips non-key characters ([^a-zA-Z0-9_]) from both ends of the input

Test plan

  • auth login --key <key> still works (unaffected path)
  • auth login interactive paste on Windows now succeeds
  • Verified via debug logging that Secret.prompt returns ~-wrapped value on Windows

🤖 Generated with Claude Code

Cliffy's Secret.prompt injects tilde (~) characters at the start and
end of pasted text on Windows terminals (bracket paste mode side-effect).
This causes `auth login` to always fail with "Invalid API key" when the
key is pasted interactively.

Trim whitespace and strip non-key characters from both ends of the input.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@schpet
Copy link
Owner

schpet commented Mar 6, 2026

awesome thanks! i don't have a windows machine, so appreciate you improving support for that platform 🙌🏻

@schpet schpet merged commit 7ec58b0 into schpet:main Mar 6, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants