Skip to content

feat: add custom templates and automatic browser open for better interactive flow#48

Merged
wolfv merged 10 commits intoprefix-dev:mainfrom
wolfv:interactive-flow
Feb 6, 2026
Merged

feat: add custom templates and automatic browser open for better interactive flow#48
wolfv merged 10 commits intoprefix-dev:mainfrom
wolfv:interactive-flow

Conversation

@wolfv
Copy link
Member

@wolfv wolfv commented Jan 28, 2026

This adds some custom HTML and automatic browser opening for a better interactive flow.

@jku
Copy link
Contributor

jku commented Jan 28, 2026

Nice! Quick initial comment: I did not expect to have two separate interactive flows the application can initiate (available only based on feature flags):

  • I don't think device flow is needed at this point: the authorization code flow seems to be strictly better UX in every case (whether browser can be opened or not) and less code seems better than more code
  • a code comment says this is because maybe the redirect server can't be started... but I'm not sure I follow the logic?
  • currently the authorization code flow is behind the feature flag but it doesn't need to be IMO: only the browser open should be the feature flagged part

@jku
Copy link
Contributor

jku commented Jan 29, 2026

a code comment says this is because maybe the redirect server can't be started... but I'm not sure I follow the logic?

I think it's actually about the web browser: if this is e.g. a remote machine where we can't open a browser, then we need a manual way to provide the verification code -- sigstore-python does have a code path for for this out-of-band case that seems reasonable: https://github.com/sigstore/sigstore-python/blob/main/sigstore/oidc.py#L296-L322

wolfv added 5 commits February 4, 2026 12:14
Based on PR prefix-dev#48 feedback: the device code flow is unnecessary since
the authorization code flow with PKCE can handle all cases:

- Browser available: opens browser, receives code via redirect server
- Browser unavailable: OOB mode prompts user to enter code manually

Changes:
- Remove DeviceCodeResponse, start_device_flow(), poll_for_token()
- Add OOB fallback using urn:ietf:wg:oauth:2.0:oob redirect URI
- Unify API to single get_identity_token() that auto-selects mode
- Rename InteractiveCallback → AuthCallback, add prompt_for_code()
Copy link
Contributor

@jku jku left a comment

Choose a reason for hiding this comment

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

Some of this is outside my ability to competently review in Rust but the flow looks great and works like I expected.

//! Sign a file (opens browser, or prompts for code if browser unavailable):
//! ```sh
//! cargo run -p sigstore-sign --example sign_blob -- artifact.txt -o artifact.sigstore.json
//! cargo run -p sigstore-sign --features browser --example sign_blob -- artifact.txt -o artifact.sigstore.json
Copy link
Contributor

Choose a reason for hiding this comment

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

could update this example in main README as well

@wolfv wolfv merged commit 37d79d7 into prefix-dev:main Feb 6, 2026
12 checks passed
This was referenced Feb 6, 2026
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