MCPcopy Create free account
hub / github.com/api3dao/airnode / registerUser

Function registerUser

docker/scripts/npm.ts:41–65  ·  view source on GitHub ↗
(npmRegistryUrl: string)

Source from the content-addressed store, hash-verified

39const buildProject = () => runCommand('yarn build');
40
41const registerUser = async (npmRegistryUrl: string) => {
42 const dummyUser = randomBytes(4).toString('hex');
43 const dummyPassword = randomBytes(4).toString('hex');
44
45 const goAuthResponse = await go(() =>
46 axios.put(
47 `${npmRegistryUrl}/-/user/org.couchdb.user:${dummyUser}`,
48 {
49 name: dummyUser,
50 password: dummyPassword,
51 },
52 {
53 headers: {
54 'Content-Type': 'application/json',
55 },
56 }
57 )
58 );
59
60 if (!goAuthResponse.success) {
61 throw new Error(`Can't authenticate against NPM registry ${npmRegistryUrl}: ${goAuthResponse.error}`);
62 }
63
64 return goAuthResponse.data.data.token;
65};
66
67const authNpmRegistry = (npmRegistryUrl: string, npmAuthToken: string) => {
68 const npmrcPath = join(homedir(), '.npmrc');

Callers 1

getNpmAuthTokenFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected