Skip to content

Add GET /api/keys/public route for grant signature verification#91

Merged
NoahCardoza merged 2 commits intofeat/issue-49__phase-2-client-serverfrom
copilot/sub-pr-89-again
Feb 28, 2026
Merged

Add GET /api/keys/public route for grant signature verification#91
NoahCardoza merged 2 commits intofeat/issue-49__phase-2-client-serverfrom
copilot/sub-pr-89-again

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 28, 2026

GrantVerifier.fetchPublicKey() fetches the server's Ed25519 public key from GET /api/keys/public to verify JWS grant signatures, but that route didn't exist — making client-side grant verification always fail with a 404.

Changes

  • Service interface — added keys.getPublicKey(): Promise<string> returning SPKI PEM
  • LocalService — stores publicKey: KeyObject in deps; exports it as SPKI PEM via keys.getPublicKey(); resolveService now destructures both keys from loadOrGenerateKeyPair
  • RemoteService — implements keys.getPublicKey() by proxying to GET /api/keys/public
  • routes.ts — adds the missing route, auth-protected by the existing bearer middleware:
fastify.get('/api/keys/public', async () => {
  const publicKey = await service.keys.getPublicKey().catch(handleError)
  return { publicKey }
})
  • Tests — updated LocalService constructor calls in service.test.ts and client-server-flow.test.ts; added mock and route tests in routes.test.ts

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…g key

Co-authored-by: NoahCardoza <10343470+NoahCardoza@users.noreply.github.com>
Copilot AI changed the title [WIP] Update Client-Server Mode with password auth and signed grants Add GET /api/keys/public route for grant signature verification Feb 28, 2026
@NoahCardoza NoahCardoza marked this pull request as ready for review February 28, 2026 20:26
@NoahCardoza NoahCardoza merged commit 46704a4 into feat/issue-49__phase-2-client-server Feb 28, 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