npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

global-registrar

v1.0.9

Published

Easy access to multiple registrar APIs.

Downloads

19

Readme

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 NPM Snyk Vulnerabilities for npm package Website Website

Install

npm i global-registrar

Supported APIs

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.

Basic Example

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'));
})();

What is dotenv?

The line "require('dotenv').config();" gets the contents of a file called ".env" in which you should store your global and secret variables.

1. Install the module "dotenv" with

npm i dotenv

2. Create a file named ".env" in your applications root directory

.env

NAMECOM_API_TOKEN='YOUR NAMECOM API KEY'
NAMECOM_API_USERNAME='YOUR NAMECOM API USERNAME'

3. Use your secret variables

process.env.NAMECOM_API_TOKEN
process.env.NAMECOM_API_USERNAME

Create your own

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.

Need help or missing a feature?

Feel free to contact me via [email protected] in english or german

Links

NPM

Documentation

Code

Modules

Typedefs

global-registrar

global-registrar.GlobalRegistrar

Class representing the global registrar

Kind: static class of global-registrar

new module.exports.GlobalRegistrar(plugin)

Create a global registrar client

| Param | Type | Description | | --- | --- | --- | | plugin | Object | a plugin object with its name and required data |

Example

const gr = new GlobalRegistrar({
        pluginName: 'global-registrar-plugin-gandi',
        pluginData: {
            apikey: process.env.GANDI_API_KEY
        }
        });

globalRegistrar.listAvailableTLD() ⇒ Array

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()

globalRegistrar.checkAvailability(domain) ⇒ Boolean

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')

globalRegistrar.checkPrice(domain) ⇒ Number | Boolean

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')

globalRegistrar.registerDomain(domain, duration, registrant) ⇒ Boolean

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: "[email protected]",
        lastName: "Müller",
        firstName: "Karl",
        registrantType: 0,
        country: "Deutschland",
        countryCode: "DE",
        state: "Bayern",
        city: "Augsburg",
        zip: "86150",
        street: "Musterstraße",
        houseNumber: "42",
        phone: '+491234567890'
    })

globalRegistrar.renewDomain(domain, duration) ⇒ Boolean

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

globalRegistrar.getDomainInfo(domain) ⇒ Object

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')

globalRegistrar.setNameServers(domain, nameservers) ⇒ Boolean

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"])

globalRegistrar.setDNSSEC(domain, dnssec) ⇒ Boolean

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"
})

Dnssec : Object

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"
}

Registrant : Object

Object representing a registrant

Kind: global typedef
Properties

| Name | Type | Description | | --- | --- | --- | | email | 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: "[email protected]",
        lastName: "Müller",
        firstName: "Karl",
        registrantType: 0,
        country: "Deutschland",
        countryCode: "DE",
        state: "Bayern",
        city: "Augsburg",
        zip: "86150",
        street: "Musterstraße",
        houseNumber: "42",
        phone: '+491234567890'
    }