chore: generate

This commit is contained in:
opencode-agent[bot]
2026-04-24 21:13:00 +00:00
parent cf45a8d807
commit 7a02eee0f4
@@ -8,13 +8,16 @@ class Unauthorized extends Schema.TaggedErrorClass<Unauthorized>()(
{ httpApiStatus: 401 }, { httpApiStatus: 401 },
) {} ) {}
export class Authorization extends HttpApiMiddleware.Service<Authorization>()("@opencode/ExperimentalHttpApiAuthorization", { export class Authorization extends HttpApiMiddleware.Service<Authorization>()(
error: Unauthorized, "@opencode/ExperimentalHttpApiAuthorization",
security: { {
basic: HttpApiSecurity.basic, error: Unauthorized,
authToken: HttpApiSecurity.apiKey({ in: "query", key: "auth_token" }), security: {
basic: HttpApiSecurity.basic,
authToken: HttpApiSecurity.apiKey({ in: "query", key: "auth_token" }),
},
}, },
}) {} ) {}
const emptyCredential = { const emptyCredential = {
username: "", username: "",
@@ -39,19 +42,21 @@ function validateCredential<A, E, R>(
} }
function decodeCredential(input: string) { function decodeCredential(input: string) {
return Encoding.decodeBase64String(input).asEffect().pipe( return Encoding.decodeBase64String(input)
Effect.match({ .asEffect()
onFailure: () => emptyCredential, .pipe(
onSuccess: (header) => { Effect.match({
const parts = header.split(":") onFailure: () => emptyCredential,
if (parts.length !== 2) return emptyCredential onSuccess: (header) => {
return { const parts = header.split(":")
username: parts[0], if (parts.length !== 2) return emptyCredential
password: Redacted.make(parts[1]), return {
} username: parts[0],
}, password: Redacted.make(parts[1]),
}), }
) },
}),
)
} }
export const authorizationLayer = Layer.succeed( export const authorizationLayer = Layer.succeed(