feat: Add getVersion() to KeymasterClient#219
Merged
Conversation
Add getVersion() method to KeymasterClient that returns { version,
commit } from the server's /version endpoint. Fix GatekeeperClient
getVersion() return type from number to { version, commit }. Add
get_version() to Python SDK for parity.
Replace raw fetch('/api/v1/version') in KeymasterUI with
keymaster.getVersion(), decoupling the UI from URL details.
Closes #205
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The Keymaster core class (used by gatekeeper-client) didn't have getVersion(), only KeymasterClient did. Delegate to the gatekeeper's getVersion() with a runtime check since GatekeeperInterface doesn't include it (local Gatekeeper has no version endpoint). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The Keymaster class is a local library, not a remote client. Its getVersion() should return its own package version, not delegate to the gatekeeper. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
createRequire is Node-only and breaks when Vite bundles keymaster for browser clients. Use a simple version constant instead. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Keymaster is a library used in both Node and browser — importing package.json or using createRequire breaks Vite builds. Remove getVersion() from the Keymaster class. The UI now checks if keymaster.getVersion exists (KeymasterClient has it), falling back to a direct fetch with serverUrl for the local Keymaster case. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Show client and server version in the Settings tab, replacing the removed footer. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a first-class getVersion() call to the JS/TS Keymaster client and wires the web UIs (and Python SDK) to use it so version fetching is centralized in the client layer rather than ad-hoc fetch() calls.
Changes:
- Add
KeymasterClient.getVersion()returning{ version, commit } - Fix
GatekeeperClient.getVersion()typing to return{ version, commit }instead ofnumber - Add Python SDK
get_version()and show client/server versions in both wallet UIs
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| python/keymaster_sdk/src/keymaster_sdk/keymaster_sdk.py | Adds get_version() wrapper for /api/v1/version in the Python SDK. |
| packages/keymaster/src/keymaster-client.ts | Adds getVersion() method calling ${API}/version and returning { version, commit }. |
| packages/gatekeeper/src/gatekeeper-client.ts | Updates getVersion() return type to { version, commit } to match server response. |
| apps/keymaster-client/src/KeymasterUI.jsx | Uses keymaster.getVersion() when available and displays client/server version in Settings. |
| apps/gatekeeper-client/src/KeymasterUI.jsx | Same UI change as keymaster-client: prefers keymaster.getVersion() and displays versions. |
Comments suppressed due to low confidence (1)
packages/gatekeeper/src/gatekeeper-client.ts:165
- This return type change will break the existing Gatekeeper client test mocks (and any consumers) that still treat
/api/v1/versionas a numeric/string version. For example,tests/gatekeeper/client.test.tscurrently mocks'1'and assertstoBe(1), but the Gatekeeper server actually returns{ version, commit }. Update the tests/mocks (and any callers) to expect the object shape.
async getVersion(): Promise<{ version: string; commit: string }> {
try {
const response = await this.axios.get(`${this.API}/version`);
return response.data;
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Add getVersion() to KeymasterInterface type definition and export get_version from Python SDK __init__.py. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The Keymaster class cannot implement getVersion in browser environments (createRequire is Node-only). The method exists on KeymasterClient and GatekeeperClient but not on the interface. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
getVersion()method toKeymasterClientreturning{ version, commit }GatekeeperClient.getVersion()return type fromnumberto{ version: string, commit: string }get_version()to Python SDK for parityfetch(serverUrl + '/api/v1/version')in KeymasterUI withkeymaster.getVersion()Closes #205
Test plan
keymaster.getVersion()works from browser console🤖 Generated with Claude Code