0.0.26 • Published 5 years ago

securesign.js v0.0.26

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

SecureSign.js

SecureSign.js is a library developed by Knight for Library of Code's securesign API! SecureSign.js will allow you to easily manage the API. SecureSign.js provides full accessability when it comes to what it can do. Everything documented on the securesign API is included in SecureSign.js. SecureSign.js is still being constantly updated.

Installation

To install SecureSign.js, just run npm i securesign.js in your terminal.

Getting Started

To get started with SecureSign.js, you need to initialize your client. Do this this, simply do:

const secureSign = require('securesign.js');
const Client = new secureSign.Client('yourHash');

Your hash can be found under "Account Details" at the Securesign website.

Once you have this, it is highly recommended you run the ready event. The callback function inside the ready event will fire when the client has been fully initialized. Without the use of the ready event, you could run into errors due to the client not being quite ready yet. To run the ready event, simply do:

Client.on('ready', (info) => {
  //Your callback function goes here.
  console.log(`${info.username} is ready!`);
});

The parameter for the callback, info, is literally the exact same thing as Client... It's your choice whether to use it or not.

Documentation

Information attached to client

NameDescriptionExample
hashWill return the hash you used to initialize the clientClient.hash
usernameWill return the username of your securesign accountClient.username
idWill return the ID of your securesign accountClient.id
emailWill return the email of your securesign accountClient.email
classWill return the class of your securesign accountClient.class
totalWill return the total amount of certificates created under your accountClient.total
allowedWill return the total amount of certificates allowed to be issued under your accountClient.allowed
promoWill return a boolean whether or not you have promo's activated...(I think)Client.promo
usedPromoKeysWill return an array of all the used promo keys under your accountClient.usedPromoKeys

Functions attached to client

generateKey()

This function will generate a new ECC/RSA private key.

Returns String

ParametersDescriptionType
typeECC or RSAString
infoFor a ECC key, specify the curve name. RSA specify the modulus.String or Number

Example

Client.generateKey('ECC', 'prime256v1').then(r => console.log(r)).catch(e => console.error(e));

listCurves()

This function provides a list of available ECC named curves.

Returns String

No parameters.

Example

Client.listCurves().then(r => console.log(r)).catch(e => console.error(e));

listCerts()

This function provides an array of objects, in each object is certificate information for each certificate you have created.

Returns Array

No parameters

Example

Client.listCerts().then(r => console.log(r)).catch(e => console.error(e));

createCert()

This is currently the most complex function. This function creates a new certificate.

Returns unknown

ParametersDescriptionType
classNumThe class used to make the certificate. Class 1-2 are supported on ECC, all classes are supported with RSA.Number
cnThe Common Name of the certificate.String
mdThe Hashing Algorithm to use for the certificate, can be SHA256, SHA384, or SHA512.String
typeThe CA key type to use, can be ECC or RSA.String
csrThe PEM-encoded CSR.Path to CSR

Example

Client.createCert(2, 'matthew@cloud.libraryofcode.us', 'SHA512', 'ECC', fs.readFileSync('/path/to/my.csr', {encoding: 'utf8'})).then(r => console.log(r)).catch(e => console.error(e));
0.0.26

5 years ago

0.0.25

5 years ago

0.0.24

5 years ago

0.0.23

5 years ago

0.0.22

5 years ago

0.0.21

5 years ago

0.0.20

5 years ago

0.0.19

5 years ago

0.0.18

5 years ago

0.0.17

5 years ago

0.0.16

5 years ago

0.0.15

5 years ago

0.0.14

5 years ago

0.0.13

5 years ago

0.0.12

5 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago