@holochain/lair-client
v0.1.2
Published
Javascript implementation of client for Lair Keystore
Downloads
20
Maintainers
Keywords
Readme
Lair Client for Node.js
Javascript implementation of client for Lair Keystore.
Overview
This module provides APIs for
- connecting to Lair
- receiving and responding to messages
- sending requests and awaiting response
- constructing messages using wire type structs
Basic Usage
const { structs, ...lair } = require("@holochain/lair-client");
(async () {
const client = lair.connect( <path to a Lair unix domain socket> );
client.on('UnlockPassphrase', req => {
req.reply( "Passw0rd!" );
});
let resp = await client.request( new structs.TLS.CreateCert.Request( 512 ) );
resp[0]; // LairType -> LairKeystoreIndex<Uint8Array>
resp.get(0); // number -> <LairType>.value()
resp[1]; // LairType -> LairCertSNI<Uint8Array>
resp.get(1); // Buffer -> <LairType>.value()
resp[2]; // LairType -> LairDigest<Uint8Array>
resp.get(2); // Buffer -> <LairType>.value()
})();
API Reference
See docs/API.md
Contributing
See CONTRIBUTING.md