@@ -7,12 +7,12 @@ import { RegistryAuthProtocolTokenPayload } from "../src/auth";
77import { registries } from "../src/registry/registry" ;
88import type { ReferrerDescriptor } from "../src/registry/registry" ;
99import { isDockerDotIO , RegistryHTTPClient } from "../src/registry/http" ;
10- import { encode } from "@cfworker/base64url" ;
1110import { ManifestSchema } from "../src/manifest" ;
1211import { limit } from "../src/chunk" ;
1312import worker from "../index" ;
1413import { env } from "cloudflare:workers" ;
1514import { createExecutionContext , reset , waitOnExecutionContext } from "cloudflare:test" ;
15+ import { base64UrlEncode } from "../src/utils" ;
1616
1717afterEach ( async ( ) => {
1818 await reset ( ) ;
@@ -149,14 +149,14 @@ describe("v2", () => {
149149 test ( "Username password authenticatiom fails gracefully when wrong format" , async ( ) => {
150150 const res = await fetchUnauth (
151151 createRequest ( "GET" , `/v2/` , null , {
152- Authorization : `Basic ${ encode ( "hello" ) } :${ encode ( "t" ) } ` ,
152+ Authorization : `Basic ${ base64UrlEncode ( "hello" ) } :${ base64UrlEncode ( "t" ) } ` ,
153153 } ) ,
154154 ) ;
155155 expect ( res . status ) . toBe ( 401 ) ;
156156 } ) ;
157157
158158 test ( "Username password authenticatiom fails gracefully when password is wrong" , async ( ) => {
159- const cred = encode ( `hello:t` ) ;
159+ const cred = base64UrlEncode ( `hello:t` ) ;
160160 const res = await fetchUnauth (
161161 createRequest ( "GET" , `/v2/` , null , {
162162 Authorization : `Basic ${ cred } ` ,
@@ -166,7 +166,7 @@ describe("v2", () => {
166166 } ) ;
167167
168168 test ( "Simple username password authenticatiom fails gracefully when password is wrong" , async ( ) => {
169- const cred = encode ( `hello:t` ) ;
169+ const cred = base64UrlEncode ( `hello:t` ) ;
170170 const res = await fetchUnauth (
171171 createRequest ( "GET" , `/v2/` , null , {
172172 Authorization : `Basic ${ cred } ` ,
@@ -176,7 +176,7 @@ describe("v2", () => {
176176 } ) ;
177177
178178 test ( "Simple username password authenticatiom fails gracefully when username is wrong" , async ( ) => {
179- const cred = encode ( `hell0:world` ) ;
179+ const cred = base64UrlEncode ( `hell0:world` ) ;
180180 const res = await fetchUnauth (
181181 createRequest ( "GET" , `/v2/` , null , {
182182 Authorization : `Basic ${ cred } ` ,
0 commit comments