MCPcopy Index your code
hub / github.com/anomalyco/opencode / decodeCredential

Function decodeCredential

packages/server/src/middleware/authorization.ts:16–27  ·  view source on GitHub ↗
(input: string)

Source from the content-addressed store, hash-verified

14}
15
16function decodeCredential(input: string) {
17 return Effect.fromResult(Encoding.decodeBase64String(input)).pipe(
18 Effect.match({
19 onFailure: emptyCredential,
20 onSuccess: (header) => {
21 const separator = header.indexOf(":")
22 if (separator === -1) return emptyCredential()
23 return { username: header.slice(0, separator), password: Redacted.make(header.slice(separator + 1)) }
24 },
25 }),
26 )
27}
28
29function credentialFromRequest(request: HttpServerRequest.HttpServerRequest) {
30 const url = new URL(request.url, "http://localhost")

Callers 1

credentialFromRequestFunction · 0.70

Calls 2

emptyCredentialFunction · 0.70
makeMethod · 0.45

Tested by

no test coverage detected