MCPcopy Create free account
hub / github.com/cloudflare/serverless-registry / authenticateBasic

Method authenticateBasic

src/registry/http.ts:403–419  ·  view source on GitHub ↗
(ctx: AuthContext)

Source from the content-addressed store, hash-verified

401 }
402
403 async authenticateBasic(ctx: AuthContext): Promise<HTTPContext> {
404 const res = await fetch(ctx.realm, {
405 headers: {
406 Authorization: "Basic " + this.authBase64(),
407 },
408 });
409
410 if (!res.ok) {
411 throw new Error(`couldn't authenticate with registry ${ctx.realm}: ${JSON.stringify(await res.json())}`);
412 }
413
414 return {
415 authContext: ctx,
416 accessToken: this.authBase64(),
417 repository: this.url.pathname.slice(1),
418 };
419 }
420
421 async manifestExists(name: string, tag: string): Promise<CheckManifestResponse | RegistryError> {
422 const namespace = name.includes("/") || !isDockerDotIO(this.url) ? name : `library/${name}`;

Callers 1

authenticateMethod · 0.95

Calls 2

authBase64Method · 0.95
fetchFunction · 0.50

Tested by

no test coverage detected