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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@keeex/keeex-api-sdk

v5.1.0

Published

SDK to call KeeeX API

Downloads

155

Readme

@keeex/keeex-api-sdk

Bugs Code Smells Maintainability Rating Security Rating Vulnerabilities Technical Debt Coverage

Provide access to the KeeeX API for timestamping and user management.

Installation

Use npm:

npm install @keeex/keeex-api-sdk

Usage

Import the KeeexAPI class and instantiate it with the authentication info. Authentication and tokens are renewed as needed.

A crypto-provider must be set before any operation can be done.

Example:

import KeeexAPI from "@keeex/keeex-api-sdk";
import "@keeex/crypto-provider-node";

/**
 * @param {object} data
 * @param {string} [data.appId]
 * @param {string} [data.authToken] - Provide a previously obtained token to avoid the login
 *   call.
 * @param {string} [data.authType] - one of "header" or "cookie"
 * @param {AxiosInstance} [data.axios] - Axios used for generic URL call (calls to outside
 *   world, not on API server)
 * @param {object} [data.endpointOptions] - if provided, all sub property MUST be present.
 * @param {string} [data.endpointOptions.licenseSigningAddress]
 * @param {string} [data.endpointOptions.responseSigningAddress]
 * @param {string} [data.endpointOptions.signature]
 * @param {string} [data.endpointOptions.url]
 * @param {string} [data.login]
 * @param {string} [data.password]
 * @param {ProxySettings} [data.proxy]
 * @param {UnauthorizedCB} [data.unauthorizedCB] - Callback to globally handle disconnection
 */
const api = await KeeexAPI.factory({
  login: "<userlogin>",
  password: "<userpassword>",
  appId: "<app id>",
});

await api.getAuthToken(); // only needed if you provied credentials in the factory
await api.timestamp({idx: "zuzi-ntinen"});

const res = await api.getTimestampInfo({idx: "zuzi-ntinen"});

console.log(res.idx);

In the above example, the login and password are required, as well as the appId. An application can optionaly provide an authToken that was saved previously. If the token is still valid, it will be used, otherwise it will be automatically renewed.

If you do not provide credentials, you can still call the the getTimestampInfo method.

Get timestamp info

This method return timestamp information about an IDX.

You can either is authenticated or not but, beware that throttling might be applied if you are not.

/**
 * @param {object} data
 * @param {string} data.idx
 */
const timestampInfo = await api.getTimestampInfo({idx: "zuzi-ntinen"});

Get license text

This method return the license text either of the current authenticated user or the one required in the user option's parameter.

You MUST be authenticated to do this call.

/**
 * @param {object} [options]
 * @param {string} [options.userEmail] - If provided, will get the license of this user.
 *   /!\ Only works if authenticated user is from keeex
 * @param {number} [options.userId] - If provided, will get the license of this user.
 *   /!\ Only works if authenticated user is from keeex
 */
// get own license
const licenseFile = await api.getLicenseText();
// get license for another user
const licenseFile = await api.getLicenseText({user: 1});

Get remaining credits

This method return the remaining credits either for the current authenticated user or the one required in the user parameter.

You MUST be authenticated to do this call.

/**
 * @param {object} [data]
 * @param {string} [data.userEmail] - If provided, will get this user's remaining credits.
 *   /!\ Only works if authenticated user is from keeex
 * @param {number} [data.userId] - same as userEmail
 */
// get own remaining credits
const remainingCredits = await api.remainingCredits();
// get remaining credits for another user
const remainingCredits = await api.remainingCredits({userId: 1});

Verify credits

This method allow you to know if the current authenticated user or the one required in the user parameter can use 1 credit of selected types.

You MUST be authenticated to do this call.

/**
 * @param {object} data
 * @param {Array<CreditTypes>} data.credits
 * @param {string} [data.userEmail] - If provided, will get this user's remaining credits.
 *   /!\ Only works if authenticated user is from keeex
 * @param {number} [data.userId] - same as userEmail
 **/
// check if current user can do 1 keeexing
const permissions = await api.verifyCredits({credits: [CreditTypes.keeex]});
// check if another user can do 1 bitcoin anchoring
cosnt permissions = await api.checkPermission({credits: [CreditTypes.bitcoin], userId: 1});

Use credits

This method use credit either of the current authenticated user or the one required in the user parameter.

You MUST be authenticated to do this call.

/**
 * @param {object} data
 * @param {Array<UseCreditRequest>} data.credits
 * @param {string} [data.userEmail] - If provided, will get this user's remaining credits.
 *   /!\ Only works if authenticated user is from keeex
 * @param {number} [data.userId] - same as userEmail
 */
// use own credits
await api.useCredits({credits: [CreditTypes.keeex, CreditTypes.bitcoin]});
// use own credits
await api.useCredits({
  credits: [
    {type: CreditTypes.keeex, count: 1},
    {type: CreditTypes.timestamp, count: 1},
  ],
});
// use credits for another user
await api.useCredits({
  credits: [CreditTypes.keeex, CreditTypes.timestamp],
  userId: 1,
});

Timestamp an idx

This method send timestamp request and consume either current authenticated user's credits or thoses of the required user in user parameter.

Unless you really need the out, you should do this call asynchronously for performance reason.

You MUST be authenticated to do this call.

/**
 * @param {TimestampParams} data
 * @param {string} data.idx
 * @param {boolean} [data.asynchronous] - default to true
 * @param {string} [data.btcId]
 * @param {boolean} [data.countKeeexing]
 * @param {Array<CreditTypes>} [data.credits] - CAN NOT includes CreditTypes.keeex
 * @param {string} [data.userEmail] - If provided, will get this user's remaining credits.
 *   /!\ Only works if authenticated user is from keeex
 * @param {number} [data.userId] - same as userEmail
 */
// timestamp idx and consume own timestamp credit
await api.timestamp({idx: "zuzi-ntinen"});
// timestamp idx and consume another user credits, send along a btcId and do it asynchronously
await api.timestamp(
  {
    idx: "zuzi-ntinen",
    btcId: "<btcId>",
    countKeeexing: true,
    credits: [CreditTypes.bitcoin, CreditTypes.rfc3161Keeex, CreditTypes.ethereumKeeex],
  },
  1,
);

Get After string

This method return an after string containing a blockchain latest known block hash. As of writing this, it will be either ethereum or bitcoin blockchain.

You MUST be authenticated to do this call;

const afterString = await api.getAfterString();

Persistent authentication

By providing an old authToken it is possible to persist authentication across sessions. To get the new authToken obtained after the authentication process, the caller can provide a callback function that will be called everytime a new token is obtained. This callback must be provided as the newAuthTokenCB property of the options argument.

Build issue with webpack

The library tries to detect if it should use our certificate or not. When this detection fails, the module is not imported. Webpack can not know that ahead of time however, so it is necessary to add a few exclusion depending on your environment.

The following dependencies can be overloaded with nothing without issue:

  • https
  • socks-proxy-agent

Add this:

{
  resolve: {fallback: {"https": false}},
  externals: {"socks-proxy-agent": ""}
}

To webpack configuration.