feat(verify): accept JWT from stdin#15
Merged
Merged
Conversation
token verify now reads the JWT from a positional argument or, when none is given, from stdin. This lets the token be piped in: jotsmith token mint --sub me | jotsmith token verify --aud sigstore Whitespace around a piped token is trimmed. Empty stdin or an interactive TTY with no argument is a usage error, so verify never blocks waiting on a terminal. stdout stays empty; OK and the decoded token still go to stderr. OpenCode session ID: ses_17bed81a6ffeVOy42ki4K0FSyL
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.
What
token verifynow accepts the JWT either as a positional argument (as before) or piped on stdin when no argument is given.How
readTokenhelper ininternal/cli/verify.goresolves the token from one positional arg, or reads stdin when none is given.ArgsUsagechanged<jwt>→[jwt];--helpdescription and examples document the pipe form.Invariants preserved
stdout stays empty for
token verify.OKand the decoded token still go to stderr.Tests
Added
TestReadTokencovering the argument path, the stdin-with-whitespace path, empty stdin, and too-many-args. Full suite andgo vetpass.Originally created in OpenCode session ID: ses_17bed81a6ffeVOy42ki4K0FSyL