add keyboot sign-in to your website
For extra security, consider serving your web application with hyperboot.
var keyboot = require('keyboot');
var kbui = require('keyboot-ui');
var boot = kbui(keyboot, {
permissions: [ 'fingerprint', 'sign', 'publicKey' ]
});
document.body.appendChild(boot.element);
boot.on('approve', function () {
boot.sign('wow!', function (err, res) {
document.body.innerHTML += Buffer(res).toString('base64');
});
});
Check out the example directory and view an example in action.
var kbui = require('keyboot-ui')
var keyboot = require('keyboot')
Create a keyboot ui
instance given a keyboot
rpc function.
Optionally provide:
opts.permissions
- array of string permissions to requestopts.storage
- storage mechanism, default: localStorage. Turn off persistence by passing infalse
.opts.defaultURL
- default URL to show, for example'https://keyboot.org'
cb(boot)
sets up a listener for the 'keyboot'
event.
cb(err, id)
fires with the hash of the public key id
Sign a message msg
. The result cb(err, res)
fires with the Uint8Array
digest res
.
Read the public key with cb(err, publicKey)
.
Close the RPC bridge and destroy the current session.
Root DOM element you can append to your web page
When the request is pending approval, this event fires.
When a request is approved on the remote end, this event fires.
When access is rejected on the remote end, this event fires.
When previously approved access is revoked, this event fires.
When the user clicks "sign out", this event fires.
Fires with the underlying keyboot rpc object when the rpc channel is established
With npm do:
npm install keyboot-ui
or fetch a UMD bundle from browserify-cdn:
http://wzrd.in/standalone/keyboot-ui@latest
MIT