Skip to content

Canonical SignerSession envelope and v0.5.0 (drop legacy exchange fields)#39

Merged
eliteprox merged 5 commits into
mainfrom
refactor/route-cleanup
Jun 26, 2026
Merged

Canonical SignerSession envelope and v0.5.0 (drop legacy exchange fields)#39
eliteprox merged 5 commits into
mainfrom
refactor/route-cleanup

Conversation

@eliteprox

@eliteprox eliteprox commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features

    • API key sign-in now supports a more direct signer-session exchange flow.
    • Signer routing responses now use a standardized signer_url field.
  • Bug Fixes

    • Improved compatibility with older signer-session flows by falling back when the direct path isn’t available.
    • Tightened response handling to reject incomplete exchange payloads earlier.
  • Documentation

    • Updated examples and guidance to match the latest API field names and routing behavior.
    • Removed outdated references to deprecated credit-related and proxy-route behavior.

- Added validation to reject M2M client secrets in API key exchange requests.
- Introduced `mintSignerSessionFromApiKeyDirect` for direct signer session creation using API keys.
- Updated response handling to normalize signer URL and access token extraction.
- Refactored tests to align with new response structure and ensure proper validation of signer URLs.

This update improves the API key exchange process and enhances the integration with direct signer sessions, ensuring better error handling and response consistency.
- Bump version to 0.5.0 in package.json.
- Update README to reflect changes in signer URL naming convention from `signerUrl` to `signer_url`.
- Refactor codebase to consistently use `signer_url` across all relevant files and interfaces.
- Remove deprecated user credits functions and related types to streamline the API.

This release enhances consistency in the API and improves clarity in documentation.
@eliteprox eliteprox changed the title Enhance API key exchange and signer session handling Canonical SignerSession envelope and v0.5.0 (drop legacy exchange fields) Jun 26, 2026
Remove unused GrantSource import and extract deviceExchangeResponseFromSignerSessionBody
so api-key direct and facade exchange paths share one parser. Add publish-rc workflow
for downstream PR consumption before 0.5.0 ships on latest.
Use a quoted heredoc and placeholder substitution so @Version tokens do not
trip workflow validation on workflow_dispatch.
@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 2da95db2-8f73-47d9-9ca7-66e3c30c0f65

📥 Commits

Reviewing files that changed from the base of the PR and between 883e3ce and a1945d8.

📒 Files selected for processing (15)
  • README.md
  • package.json
  • src/client.ts
  • src/index.ts
  • src/signer/api-key-exchange.ts
  • src/signer/device-exchange.ts
  • src/signer/direct-signer.ts
  • src/signer/types.ts
  • src/tokens.ts
  • src/types.ts
  • src/usage.ts
  • test/signer/api-key-exchange.test.ts
  • test/signer/device-exchange.test.ts
  • test/signer/direct-signer.test.ts
  • test/signer/gateway-token.test.ts

📝 Walkthrough

Walkthrough

The PR standardizes signer exchange responses on signer_url, adds a direct API-key signer-session minting path with fallback handling, and removes deprecated credits, usage, and routing aliases from the public surface and docs.

Changes

Signer exchange and public API cleanup

Layer / File(s) Summary
Signer response contracts and docs
README.md, src/client.ts, src/types.ts, src/signer/types.ts, src/signer/direct-signer.ts, test/signer/direct-signer.test.ts
TokenExchangeResponse and DeviceExchangeResponse switch to signer_url, signerUrlFromExchangeResponse reads the snake_case field, and the README and direct-signer test follow the updated shape.
Device exchange normalization
src/signer/device-exchange.ts, test/signer/device-exchange.test.ts
Device-exchange helpers now require top-level access_token, normalize signer-session payloads into signer_url and issued_token_type, and the tests assert the updated canonical response.
Direct API-key signer-session flow
src/signer/api-key-exchange.ts, test/signer/api-key-exchange.test.ts, test/signer/gateway-token.test.ts
API-key exchange rejects pmth_cs_ keys, adds mintSignerSessionFromApiKeyDirect, falls back on 404, and updates handler and tests to the /auth/api-key/signer-session flow.
Deprecated public aliases removed
package.json, src/client.ts, src/index.ts, src/types.ts, src/usage.ts, README.md
Deprecated credits, usage, token, and routing aliases are removed from client exports and docs, and the package version bumps to 0.5.0.

Sequence Diagram(s)

sequenceDiagram
  participant createApiKeyExchangeHandler
  participant mintSignerSessionFromApiKeyDirect
  participant IssuerSignerSessionEndpoint as "/api/v1/apps/{publicClientId}/auth/api-key/signer-session"
  participant deviceExchangeResponseFromSignerSessionBody

  createApiKeyExchangeHandler->>mintSignerSessionFromApiKeyDirect: request direct signer-session mint
  mintSignerSessionFromApiKeyDirect->>IssuerSignerSessionEndpoint: Authorization: Bearer apiKey
  IssuerSignerSessionEndpoint-->>mintSignerSessionFromApiKeyDirect: signer-session JSON
  mintSignerSessionFromApiKeyDirect->>deviceExchangeResponseFromSignerSessionBody: normalize access_token and signer_url
  deviceExchangeResponseFromSignerSessionBody-->>createApiKeyExchangeHandler: DeviceExchangeResponse
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • pymthouse/builder-sdk#33: Introduced the direct signer DMZ/API-key exchange path that this PR continues by switching to signer_url and the signer-session endpoint.

Poem

Hop hop, the signer_url path now gleams,
I nibbled old aliases out of the streams.
Direct to the DMZ, I dash with a thump,
New tokens sparkle—carrot-bright and plump. 🐰

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/route-cleanup

Comment @coderabbitai help to get the list of available commands.

Remove the PR RC publish workflow and RELEASING.md section for now; we can
reintroduce manual or automated RC publishing in a follow-up PR.
@eliteprox
eliteprox merged commit 4964a01 into main Jun 26, 2026
4 of 5 checks passed
@sonarqubecloud

Copy link
Copy Markdown

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.

1 participant