Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
@rqt/namecheap-web
Advanced tools
An API to namecheap.com via the web interface, with an ability to log in using 2-factor Auth and check Whois.
@rqt/namecheap-web
is an API to namecheap.com
via the web interface, with an ability to log in using 2-factor Auth and check Whois.
The web API is currently used in the Expensive package to authenticate and white-list IP addresses. This is useful for dynamic-IP holders. Because the API implemented with gzip
compression, the amount of traffic is minimized as well, helping to save data on mobile networks.
yarn add -E @rqt/namecheap-web
constructor(options?: Options): NamecheapWeb
async auth(username: string, password: string, phone?: string)
async static LOOKUP_IP(): string
async getWhitelistedIPList(username: string, password: string, phone?: string): WhitelistedIP[]
async whitelistIP(ip: string, name?: string)
async removeWhitelistedIP(name: string)
The package is available by importing its default class:
import NamecheapWeb from '@rqt/namecheap-web'
constructor(
options?: Options,
): NamecheapWeb
Create a new instance of the NamecheapWeb class. The sandbox
version can be specified in the options. To remember the session cookies on the local filesystem, the readSession
parameter can be passed. On the production version, the session expires after 20 minutes, but can be renewed after 10 minutes of using an existing session.
Options
: Options for the web client.
Name | Type | Description | Default |
---|---|---|---|
sandbox | boolean | Whether to use the sandbox version. | false |
readSession | boolean | Read and store the cookies for the session from the local file. | false |
sessionFile | string | If reading session, indicates the file where to store cookies. | .namecheap-web.json |
/* yarn example/ */
import NamecheapWeb from '@rqt/namecheap-web'
import bosom from 'bosom'
(async () => {
try {
// 0. Read stored username and password from a local file.
const { username, password } = await bosom('.auth-sandbox.json')
const nw = new NamecheapWeb({
sandbox: true,
readSession: true, // save cookies in a file.
})
// 1. Authenticate and create a session.
await nw.auth(username, password)
// 2. Read white-listed IPs.
const ips = await nw.getWhitelistedIPList()
console.log(JSON.stringify(ips, null, 2))
// 3. Whitelist a new IP.
const ip = await NamecheapWeb.LOOKUP_IP()
await nw.whitelistIP(ip, 'example')
// 4. Remove white-listed IP.
await nw.removeWhitelistedIP('example')
} catch ({ message }) {
console.error(message)
}
})()
[
{
"Name": "expensive 2018-7-23 18-13-04",
"IpAddress": "2.219.56.166",
"ModifyDate": "2018-07-23T17:13:05.200Z"
},
{
"Name": "82.132.224.85",
"IpAddress": "82.132.224.85",
"ModifyDate": "2018-06-14T10:09:21.750Z"
},
{
"Name": "expensive 2018-6-18 19-38-19",
"IpAddress": "82.132.225.170",
"ModifyDate": "2018-06-18T18:38:20.083Z"
},
{
"Name": "expensive 2018-6-22 19-17-06",
"IpAddress": "82.132.246.100",
"ModifyDate": "2018-06-22T18:17:06.770Z"
},
{
"Name": "expensive 2018-6-22 11-54-37",
"IpAddress": "82.132.247.173",
"ModifyDate": "2018-06-22T10:54:37.913Z"
}
]
async auth(
username: string,
password: string,
phone?: string,
): void
Authenticate the app and obtain the cookies. If 2-factor authentication is enabled, it will also be carried out. The phone
argument can be passed which is the last 3 digits of the phone used to receive the confirmation text. If it is not passed, a question will be asked via the CLI. The code should be then entered in the CLI as well.
async static LOOKUP_IP(): string
Get the public IP address using https://api.ipify.org.
async getWhitelistedIPList(
username: string,
password: string,
phone?: string,
): WhitelistedIP[]
Get a list of white-listed IP addresses which can make API calls. The maximum of 20 IP addresses is allowed.
WhitelistedIP
: A white-listed IP which can be used for API calls.
Name | Type | Description |
---|---|---|
Name* | string | The name of the IP. |
IpAddress* | string | The IP address. |
ModifyDate* | Date | The modification date. |
async whitelistIP(
ip: string,
name?: string,
): void
Add an IP address to the white-listed IPs. If name is not given, it is automatically generated as rqt {date}
async removeWhitelistedIP(
name: string,
): void
Remove the IP from the white-listed IPs by its name.
(c) Rqt 2018
1.0.0
@rqt/namecheap-web
with [mnp
][https://mnpjs.org]src
, test
FAQs
An API To Namecheap.com Via The Web Interface, With An Ability To Log In Using 2-Factor Auth To Whitelist IPs And Check Whois And Coupons.
The npm package @rqt/namecheap-web receives a total of 4 weekly downloads. As such, @rqt/namecheap-web popularity was classified as not popular.
We found that @rqt/namecheap-web demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.