Highlighted section

The public key is a base64 encoded string of a protobuf containing an RSA DER buffer. This uses a node buffer to pass the base64 encoded public key protobuf to the multihash for ID generation.

var PeerId = require('peer-id')

PeerId.create({ bits: 1024 }, (err, id) => {
  console.log(JSON.stringify(id.toJSON(), null, 2)
})
{
  "id": "Qma9T5YraSnpRDZqRR4krcSJabThc8nwZuJV3LercPHufi",
  "privKey": "CAAS4AQwggJcAgEAAoGBAMBgbIqyOL26oV3nGPBYrdpbv..",
  "pubKey": "CAASogEwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMBgbIqyOL26oV3nGPBYrdpbvzCY..."
}

Klass

Creates a new Klass

new Klass(foo: any)

Extends Stream.Writable

Parameters
foo (any)
Static Members
▸ isClass(other, also)
▸ isWeird(other)
▸ isBuffer(buf, size)
▸ isArrayOfBuffers(buffers)
▸ MAGIC_NUMBER
Instance Members
▸ getFoo()
▸ withOptions(options, otherOptions)
Events
▸ event

CustomError

a typedef with nested properties

CustomError(other: any, also: any)
Parameters
other (any)
also (any)
Properties
error (object) : An error
  • error.code string

    The error's code

  • error.description string

    The error's description

bar

Get an instance of Klass. Will make a klass instance multiword, like a klass

bar(): Klass
Returns
Klass: that class

bar

Rest property function

bar(toys: ...Number): undefined
Parameters
toys (...Number)
Returns
undefined: nothing

bar

Get an instance of Klass. Will make a klass instance multiword, like a klass. This needs a number input.

bar(): undefined
Returns
undefined: nothing

Foo

This is Foo

new Foo()
Instance Members
▸ bar

customStreams

I am the container of stream types

customStreams
Static Members
▸ new passthrough()