MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / decodeBasic

Function decodeBasic

packages/core/test-servers/src/worker.ts:46–54  ·  view source on GitHub ↗
(
  header: string | null,
)

Source from the content-addressed store, hash-verified

44const redirect = (location: string) => new Response(null, { status: 302, headers: { location } });
45
46const decodeBasic = (
47 header: string | null,
48): { readonly username: string; readonly password: string } | null => {
49 if (!header?.startsWith("Basic ")) return null;
50 const decoded = atob(header.slice("Basic ".length));
51 const separator = decoded.indexOf(":");
52 if (separator < 0) return null;
53 return { username: decoded.slice(0, separator), password: decoded.slice(separator + 1) };
54};
55
56const base64url = (buffer: ArrayBuffer): string => {
57 const bytes = new Uint8Array(buffer);

Callers 2

handleLoginFunction · 0.85
handleTokenFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected