1.0.2 • Published 6 years ago

lockr-client v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
6 years ago

lockr-client

Lockr API Client for Node.js

Usage Overview

/*
A certPath is the path to a PEM-encoded x509 certificate provided by Lockr.

A partnerName is the name of the partner to authenticate, usually 'custom'
for certificates provided directly by Lockr.

A region indicates where to store keys (either 'us' or 'eu').
*/

const certPath = '/path/to/lockr/client/cert.pem';
const partnerName = 'lockr partner name';
const region = 'us';

/*
A partner is the authentication unit for Lockr and is instatitiated by 
providing a certPath, partnerName, and region to the Partner constructor.

A Lockr client is then instantiated by providing a partner instance 
to the Lockr constructor 
*/

const partner = new Partner(certPath, partnerName, region);
const client = new Lockr(partner);

/*
The SiteClient constructor enables operations on a site.
*/

const siteClient = new SiteClient(client);
const status = siteClient.exists();

/*
The KeyClient constructor allow for opertions with keys.
*/
const keyClient = new KeyClient(client);
keyClient.set('myKeyName', 'secretKeyValue', 'My Key Label')
const keyValue = keyClient.get('myKeyName')