From 7a02eee0f4002687a5167574744cd00cb06624c4 Mon Sep 17 00:00:00 2001 From: "opencode-agent[bot]" Date: Fri, 24 Apr 2026 21:13:00 +0000 Subject: [PATCH] chore: generate --- .../server/routes/instance/httpapi/auth.ts | 43 +++++++++++-------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/packages/opencode/src/server/routes/instance/httpapi/auth.ts b/packages/opencode/src/server/routes/instance/httpapi/auth.ts index adddcc4bed..fe72b78223 100644 --- a/packages/opencode/src/server/routes/instance/httpapi/auth.ts +++ b/packages/opencode/src/server/routes/instance/httpapi/auth.ts @@ -8,13 +8,16 @@ class Unauthorized extends Schema.TaggedErrorClass()( { httpApiStatus: 401 }, ) {} -export class Authorization extends HttpApiMiddleware.Service()("@opencode/ExperimentalHttpApiAuthorization", { - error: Unauthorized, - security: { - basic: HttpApiSecurity.basic, - authToken: HttpApiSecurity.apiKey({ in: "query", key: "auth_token" }), +export class Authorization extends HttpApiMiddleware.Service()( + "@opencode/ExperimentalHttpApiAuthorization", + { + error: Unauthorized, + security: { + basic: HttpApiSecurity.basic, + authToken: HttpApiSecurity.apiKey({ in: "query", key: "auth_token" }), + }, }, -}) {} +) {} const emptyCredential = { username: "", @@ -39,19 +42,21 @@ function validateCredential( } function decodeCredential(input: string) { - return Encoding.decodeBase64String(input).asEffect().pipe( - Effect.match({ - onFailure: () => emptyCredential, - onSuccess: (header) => { - const parts = header.split(":") - if (parts.length !== 2) return emptyCredential - return { - username: parts[0], - password: Redacted.make(parts[1]), - } - }, - }), - ) + return Encoding.decodeBase64String(input) + .asEffect() + .pipe( + Effect.match({ + onFailure: () => emptyCredential, + onSuccess: (header) => { + const parts = header.split(":") + if (parts.length !== 2) return emptyCredential + return { + username: parts[0], + password: Redacted.make(parts[1]), + } + }, + }), + ) } export const authorizationLayer = Layer.succeed(