Nodejs – using docker rest api’s calls

Is there any way in nodejs to call the github api that simulate the following:

docker login -u username -p password registry
I’ve the username password and the registry

I mean run a rest call that provide the registry username and password and get ok or error, this is to verify user successful login.

I found this reference but not sure if I can use a rest call to verify that user was connected succesfully

for example, I see in the docks something like

GET /v2/<name>/manifests/<reference>

but didnt find something with user and password

Also found this

I’ve also find this
Docker API NodeJS

But not sure how to send the username, password, registry

Source: Dockerfile Questions