(ctx: AuthContext)
| 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}`; |
no test coverage detected