MCPcopy Create free account
hub / github.com/NomicFoundation/hardhat / writeAuthFiles

Function writeAuthFiles

scripts/verdaccio/start.ts:109–124  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

107}
108
109function writeAuthFiles(): void {
110 // Pre-seed htpasswd with a known user so verdaccio accepts publishes
111 // without any interactive login. Format: username:{SHA}base64(sha1(password))
112 const passwordHash =
113 "{SHA}" + createHash("sha1").update("test").digest("base64");
114
115 writeFileSync(VERDACCIO_HTPASSWD, `test:${passwordHash}\n`);
116
117 // Write .npmrc with basic auth (base64 of "test:test") scoped to the registry
118 const basicAuth = Buffer.from("test:test").toString("base64");
119
120 writeFileSync(
121 VERDACCIO_NPMRC,
122 `//${VERDACCIO_HOST}:${VERDACCIO_PORT}/:_auth=${basicAuth}\n`,
123 );
124}
125
126function startVerdaccio(background: boolean): void {
127 logStep("Starting Verdaccio");

Callers 1

startFunction · 0.85

Calls 1

toStringMethod · 0.45

Tested by

no test coverage detected