This is a mirror of git.y.gy/firstdorsal/global-registrar
The goal of global-registrar is to create an easy reusable interface for multiple registrar APIs as most registrar APIs are poorly documented and/or difficult to access. The plugins for the different APIs shall recreate the same effects with the same functions. Look at the plugins pages to see what data needs to be provided.
npm i global-registrar
name.com - global-registrar-plugin-namecom
- Missing
- listAvailableTLD() Not supported by name.com
- Provide following plugin data:
- apiToken
- apiUsername
Gandi - global-registrar-plugin-gandi
- Missing
- setDNSSEC() Not supported by Gandi
- Provide following plugin data:
- apikey
Godaddy - global-registrar-plugin-godaddy
- Missing
- registerDomain() Not implemented: overcomplicated
- setDNSSEC() Not supported by Godaddy
- Provide following plugin data:
- apikey
- apisecret
Feel free to create your own and get it listed here!
You can also search for "global-registrar-plugin" on npm or click here.
test.js
(async () => {
//get global variables
require('dotenv').config();
//import the module
const {
GlobalRegistrar
} = require('global-registrar');
//create a registrar using the name.com plugin
const gr = new GlobalRegistrar({
pluginName: 'global-registrar-plugin-namecom',
pluginData: {
apiToken: process.env.NAMECOM_API_TOKEN,
apiUsername: process.env.NAMECOM_API_USERNAME,
}
});
//check if a domain is available for registration at name.com
console.log(await gr.checkAvailability('example.com'));
})();
The line "require('dotenv').config();" gets the contents of a file called ".env" in which you should store your global and secret variables.
npm i dotenv
.env
NAMECOM_API_TOKEN='YOUR NAMECOM API KEY'
NAMECOM_API_USERNAME='YOUR NAMECOM API USERNAME'
process.env.NAMECOM_API_TOKEN
process.env.NAMECOM_API_USERNAME
You can use this template: global-registrar-plugin
1 - To get started create a folder named 'global-registrar-plugin-YOUR SERVICE NAME' and navigate inside it
2 - Clone the repository by using this command (WITH THE DOT AT THE END)
git clone http://git.y.gy/firstdorsal/global-registrar-plugin.git .
3 - If you have bash installed run:
bash initGlobalRegistrarPlugin.sh
If not: replace the string PLUGINNAME manually with the name of your service in the README.md and package.json
4 - Replace the author field with your name
4.1 - Replace the repository url with your own git repository url
5 - Create your plugin
6 - To get you plugin listed here
Check if all functions produce the effects required by the documentation.
Adapt your README accordingly.
Contact me.
Feel free to contact me via xl9jthv_7bvgakv9o9wg0jabn2ylm91xxrzzgt0e@y.gy in english or german
- Dnssec :
Object
Object representing the dnssec data
- Registrant :
Object
Object representing a registrant
- global-registrar
- .GlobalRegistrar
- new module.exports.GlobalRegistrar(plugin)
- .listAvailableTLD() ⇒
Array
- .checkAvailability(domain) ⇒
Boolean
- .checkPrice(domain) ⇒
Number
|Boolean
- .registerDomain(domain, duration, registrant) ⇒
Boolean
- .renewDomain(domain, duration) ⇒
Boolean
- .getDomainInfo(domain) ⇒
Object
- .setNameServers(domain, nameservers) ⇒
Boolean
- .setDNSSEC(domain, dnssec) ⇒
Boolean
- .GlobalRegistrar
Class representing the global registrar
Kind: static class of global-registrar
- .GlobalRegistrar
- new module.exports.GlobalRegistrar(plugin)
- .listAvailableTLD() ⇒
Array
- .checkAvailability(domain) ⇒
Boolean
- .checkPrice(domain) ⇒
Number
|Boolean
- .registerDomain(domain, duration, registrant) ⇒
Boolean
- .renewDomain(domain, duration) ⇒
Boolean
- .getDomainInfo(domain) ⇒
Object
- .setNameServers(domain, nameservers) ⇒
Boolean
- .setDNSSEC(domain, dnssec) ⇒
Boolean
Create a global registrar client
Param | Type | Description |
---|---|---|
plugin | Object |
a plugin object with its name and required data |
Example
(async () => {
//get global variables
require('dotenv').config();
const {
GlobalRegistrar
} = require('global-registrar');
const gr = new GlobalRegistrar({
pluginName: 'global-registrar-plugin-gandi',
pluginData: {
apikey: process.env.GANDI_API_KEY
}
});
console.log(await gr.listAvailableTLD());
})();
Retrieves list of available tld names. Must return array with all available tld endings and nothing else.
Kind: instance method of GlobalRegistrar
Returns: Array
- Array of top level domains
Example
await gr.listAvailableTLD()
Checks if domain is publicly available for registration at the registrar. Takes domain name as string. Has to return true if domain is available and false if not. Null will be returned if the check couldnt be performed or an error occurs.
Kind: instance method of GlobalRegistrar
Returns: Boolean
- True if domain is available for registration
Param | Type | Description |
---|---|---|
domain | String |
The domain you want to check for |
Example
await gr.checkAvailability('example.com')
Checks if domain is publicly available for registration at the registrar. Takes domain name as string. Returns the pricing information from the registrar or false if domain is not available for registration
Kind: instance method of GlobalRegistrar
Returns: Number
| Boolean
- price in USD for one year without taxes, false or null
Param | Type | Description |
---|---|---|
domain | String |
The domain you want to check for |
Example
await gr.checkPrice('paulisttoll.eu')
Registers a domain
Kind: instance method of GlobalRegistrar
Param | Type | Description |
---|---|---|
domain | String |
The domain you want to register |
duration | Number |
The duration to register the domain for in years. |
registrant | Registrant |
A Registrant object with information about the registrant must be provided |
Example
await gr.registerDomain("paulisttoll.eu", 1, {
email: "mail@example.com",
lastName: "Müller",
firstName: "Karl",
registrantType: 0,
country: "Deutschland",
countryCode: "DE",
state: "Bayern",
city: "Augsburg",
zip: "86150",
street: "Musterstraße",
houseNumber: "42",
phone: '+491234567890'
})
Renews a domain.
Kind: instance method of GlobalRegistrar
Param | Type | Description |
---|---|---|
domain | String |
The domain you want to renew |
duration | Number |
The duration to renew the domain for in years. |
Example
await gr.renewDomain("paulisttoll.eu", 2)
//will prolong the registration of the domain paulisttoll.eu by 2 years
Gives back information about the registration of a domain
Kind: instance method of GlobalRegistrar
Returns: Object
- information about the domain
Param | Type | Description |
---|---|---|
domain | String |
The domain you want to get information about |
Example
await gr.getDomainInfo('paulisttoll.eu')
Sets the nameservers for a domain
Kind: instance method of GlobalRegistrar
Returns: Boolean
- true on success
Param | Type | Description |
---|---|---|
domain | String |
The domain you want to set the nameservers for |
nameservers | Array |
Array with the domain names of all nameservers |
Example
await gr.setNameServers('paulisttoll.eu',["tick.y.gy","trick.y.gy","track.y.gy"])
Sets the dnssec parameters for a domain at the registrar
Kind: instance method of GlobalRegistrar
Returns: Boolean
- true on success
Param | Type | Description |
---|---|---|
domain | String |
The domain you want to set the nameservers for |
dnssec | Dnssec |
Dnssec object with the dnssec parameters |
Example
await gr.setNameServers('paulisttoll.eu',{
"keyTag": 30909,
"algorithm": 8,
"digestType": 2,
"digest": "E2D3C916F6DEEAC73294E8268FB5885044A833FC5459588F4A9184CFC41A5766"
})
Object representing the dnssec data
Kind: global typedef
Properties
Name | Type |
---|---|
keyTag | Number |
algorithm | Number |
digestType | Number |
digest | String |
Example
{
"keyTag": 30909,
"algorithm": 8,
"digestType": 2,
"digest": "E2D3C916F6DEEAC73294E8268FB5885044A833FC5459588F4A9184CFC41A5766"
}
Object representing a registrant
Kind: global typedef
Properties
Name | Type | Description |
---|---|---|
String |
The email address of the registrant | |
lastName | String |
The last name/"family name" of the registrant |
firstName | String |
The first name/"given name" of the registrant |
registrantType | 0 | 1 | 2 | 3 | 4 |
the type of the registrant: 0=person, 1=company, 2=association, 3=public body, 4=reseller |
country | String |
The country the registrant is coming from |
countryCode | String |
The country the registrant is coming from provided as ISO-3166 country code |
state | String |
The province/state the registrant is coming from |
city | String |
The city the registrant is coming from |
zip | String |
The zip code the registrant is coming from |
street | String |
The street the registrant is coming from |
houseNumber | String |
The house number the registrant is coming from |
phone | String |
The registrants phone number |
Example
{
email: "mail@example.com",
lastName: "Müller",
firstName: "Karl",
registrantType: 0,
country: "Deutschland",
countryCode: "DE",
state: "Bayern",
city: "Augsburg",
zip: "86150",
street: "Musterstraße",
houseNumber: "42",
phone: '+491234567890'
}