Async Crypto Endeavour (#33)

* refactor: make import and creation async - This allows the use of native key generation in the browser

BREAKING CHANGE:

This changes the interface of .create, .createFromPrivKey,
.createFromPubKey, .createFromJSON
This commit is contained in:
Friedel Ziegelmayer
2016-11-03 08:51:29 +01:00
committed by David Dias
parent e08907ff94
commit 31701e236d
8 changed files with 322 additions and 164 deletions

View File

@ -4,4 +4,10 @@
const PeerId = require('./index.js')
console.log(JSON.stringify(PeerId.create().toJSON(), null, ' '))
PeerId.create((err, id) => {
if (err) {
throw err
}
console.log(JSON.stringify(id.toJSON(), null, 2))
})