Files
Elydora-Open-Source/packages/server/src/routes/jwks.ts
T
雷电芽衣 bc6983a62e chore(oss): audit the server package and resync the SDK mirrors
Split the 657-line operation service into eor, submit, and verify
modules, add the AGENT_REVOKED and KEY_RETIRED codes the Backend already
emits, and condense every multi-line comment. Mirror Node, Python, and
Go at 2.1.0 with the deep-health 503, non-idempotent retry, rotation
grace, and path-encoding fixes. Document which routes and response
fields the self-hosted server does not provide.

Claude-Session: https://claude.ai/code/session_01Agoc9bRVE9KL7mmWtey9Vq
2026-09-03 20:48:20 -04:00

35 lines
1.0 KiB
TypeScript

/** JWKS route: public key discovery endpoint. */
import { Hono } from 'hono';
import type { Env, AppVariables } from '../types.js';
import type { JWKSResponse } from '../shared/index.js';
import { deriveEd25519PublicKey } from '../utils/crypto.js';
const jwks = new Hono<{ Bindings: Env; Variables: AppVariables }>();
// ---------------------------------------------------------------------------
// GET /.well-known/elydora/jwks.json: Retrieve the platform JWKS
// ---------------------------------------------------------------------------
jwks.get('/', async (c) => {
// Derive the public key from the server signing key
const publicKeyBase64url = await deriveEd25519PublicKey(c.env.ELYDORA_SIGNING_KEY);
const response: JWKSResponse = {
keys: [
{
kty: 'OKP',
crv: 'Ed25519',
x: publicKeyBase64url,
kid: 'elydora-server-key-v1',
use: 'sig',
alg: 'EdDSA',
},
],
};
c.header('Cache-Control', 'public, max-age=3600');
return c.json(response, 200);
});
export { jwks };