Repository navigation
feat(server): accept the app's client keys next to the server key - #98
Merged
Merged
Conversation
Add PUT /atomic/v1/server/client-keys {"keys": string[]}: it replaces an
in-memory list of extra keys (at most 200, each 20-256 characters of
[A-Za-z0-9._~-], else 400 INVALID_ARGUMENT) and answers {"count": n}.
The public listener reads the list per request and accepts
[api_key, ...clientKeys] only while it has its own non-empty api_key and
the host keeps no keyring; a keyless listener stays open and an embedder
keyring still wins. requires_api_key, serverHasApiKey and the start
comparison keep reading the server's own key. Keys never appear in a
response, snapshot, server state, file, log or telemetry.
Used by account remote access in the app: one key per paired device.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # docs/decisions/INDEX.md
Vect0rM
added a commit
to AtomicBot-ai/Atomic-Chat
that referenced
this pull request
Nov 12, 2026
Core v0.23.0 adds `PUT /atomic/v1/server/client-keys` (AtomicBot-ai/atomic-chat-core#98): the public listener accepts the keys a sharing computer hands its paired devices, next to its own API key. Without it, remote access through the account answers those devices with 401. Co-Authored-By: Claude Opus 5.5 <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
Account remote access in the desktop app (AtomicBot-ai/Atomic-Chat#410) gives every paired device its own key for the public
/v1API. The app's Rust owns pairing, crypto and key minting. The core only needs to accept those keys on the listener it owns.The existing host keyring (
AtomicCoreOptions.publicApiKeys) does not fit here. Only an embedder can set it, not the app daemon. It also replaces the server'sapi_keyand would close a keyless server. This PR adds a thin, replaceable, in-memory list of extra keys instead.Control route
PUT /atomic/v1/server/client-keys{"keys": string[]}. It replaces the whole list.200 {"count": n}. A key is never echoed, and there is noGET.keysmust be an array of at most 200 strings, each 20–256 characters of[A-Za-z0-9._~-]. Anything else gets400 INVALID_ARGUMENT, and the stored list stays as it was.CoreClient.setServerClientKeys(keys).Gate behaviour (
src/server/public/index.ts,acceptedKeys)The list is read on every request:
publicApiKeys) answers a list, it wins and the extra keys are ignored. No change from today.api_key, it accepts[api_key, ...clientKeys]. A removed key gets 401 on its next request.requires_api_key,serverHasApiKey/endpoint().hasApiKeyandpublicOptionsCompatiblestill depend only on the server's own key.Keys never appear in a response, the snapshot,
GET /server,LocalApiServerState, the state files, logs or telemetry.Docs
docs/decisions/2026-11-12-accept-app-client-keys-next-to-the-server-key.md, plus its line in the index.docs/contracts.md.Tests
src/server/control/routes/public-server.test.ts:{count}answersrc/server/public/index.test.ts:x-api-keysrc/core/public-server-client-keys.test.ts(real core, through the control API):requires_api_keyandserverHasApiKeyfalsepublicApiKeyswinssrc/client/control-client.test.ts:setServerClientKeys.Gates run locally on macOS arm64:
lint,typecheck,format:checkon the changed files,test:coverage(floors passed) andbuild:bin.🤖 Generated with Claude Code