mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 12:54:20 +01:00
feat(servers): harden pairing and run linked-server sessions in the UI
Replace the plaintext pairing exchange with a nonce and HMAC proof plus AES-256-GCM encrypted credentials, bumping links to v2. Track session ownership per linked server so activity, session picker, transcript, MCP and skills views work against remote servers. Share encrypted secret access, event routing and URL helpers across backend, shared and CLI.
This commit is contained in:
1 parent
c591c15743
commit
f566556fd6
77 files changed
+3170
-702
No files matched your search
@@ -2,6 +2,7 @@ import { readState } from './state.js'
|
||||
import { getToken, describeTokenStore } from './internal-token-store.js'
|
||||
import { TokenStoreError } from './token-store.js'
|
||||
import { ManagerApi } from './manager-api.js'
|
||||
import { trimUrlTrailingSlashes } from '@opencode-manager/shared/utils'
|
||||
|
||||
export type ManagerAuthFailureReason = 'no-manager' | 'token-store' | 'no-token'
|
||||
|
||||
@@ -15,15 +16,11 @@ export type ResolveManagerApiResult =
|
||||
| { ok: true; auth: ManagerAuthOk; api: ManagerApi }
|
||||
| { ok: false; message: string }
|
||||
|
||||
/** Canonical Manager URL form used as the token-store account: trimmed, without trailing slashes. */
|
||||
export function normalizeManagerUrl(url: string): string {
|
||||
return url.trim().replace(/\/+$/, '')
|
||||
}
|
||||
|
||||
/** Resolves the Manager URL and token used to authenticate CLI requests. */
|
||||
export async function resolveManagerAuth(
|
||||
rawManagerUrl: string | undefined = readState()?.managerUrl,
|
||||
): Promise<ManagerAuth> {
|
||||
const managerUrl = rawManagerUrl ? normalizeManagerUrl(rawManagerUrl) : ''
|
||||
const managerUrl = rawManagerUrl ? trimUrlTrailingSlashes(rawManagerUrl) : ''
|
||||
if (!managerUrl) {
|
||||
return {
|
||||
ok: false,
|
||||
|
||||
Reference in new issue
Block a user