kiki
Wrappers for DSA, EC, Bitcoin and other keys to provide a common API for signing/verifying/importing/exporting
this module is used by Tradle
Usage
var kiki = ;var Keys = kikiKeys // load ec public keyvar ecPubKey = pub: '022ee9fefd1b275d4ee1e7c41157cd4753ad4cbd0cbfdc76eef85ebae230bf27ee' // load ec private keyvar ecPrivKey = priv: '01762d59097688a1f1cd241aadee4cb1bd3d37017f71501b28e85ecdab5349c2' // new ec private keyvar newECKey = KeysEC // new bitcoin keyvar btcKey = KeysBitcoin // new dsa keyvar dsaKey = KeysDSA // keys with metadatabtcKey = KeysBitcoin
sync API (may not be supported for some keys)
var sig = ecKey var verified = ecKey
async API (supported for all keys)
ecKey
export
var pub = ecKeyvar priv = ecKey
pub
priv
import
// recover to typed instance (ECKey/DSAKey/etc.)var ecKey = kiki
Key API
(static) gen(options)
Generate a new key. Different keys may have different required properties (this asymmetry can't be avoided.)
hasDeterministicSig()
Some keys have deterministic signatures - same outputs for the same inputs. Some don't.
parsePub(pubKeyString)
parsePriv(privKeyString)
fingerprint()
pubKeyString()
exportPublic()
exportPrivate()
mock "secure element" API
Simple mock for a "secure element" type API, where you don't have access to the private keys. Give it a public key, an operation and data, and it will perform signing, decrypting, etc.
var kiki = kikivar secureEl = // setup the mock secure elementsecureElsecureEl