From 76f14288720551f76f23a4511a41d1af35f8f249 Mon Sep 17 00:00:00 2001 From: Friedel Ziegelmayer Date: Fri, 2 Dec 2016 15:09:20 +0100 Subject: [PATCH] Updates --- index.html | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/index.html b/index.html index e58e08f..d72b6c0 100644 --- a/index.html +++ b/index.html @@ -66,11 +66,11 @@ the global namespace.

<script src="https://unpkg.com/peer-id/dist/index.min.js"></script>
 <!-- OR -->
 <script src="https://unpkg.com/peer-id/dist/index.js"></script>
-

PeerId

A Peer ID is the SHA-256 +

PeerId

A Peer ID is the SHA-256 multihash of a public key.

See

static

PeerId.create

create(opts: Object?, callback: function (Error, PeerId))

Create a new PeerId by generating a new public/private keypair.

+

static

PeerId.create

create(opts: Object?, callback: function (Error, PeerId))

Create a new PeerId by generating a new public/private keypair.

Parameters

NameDescription
opts: Object?Configuration object.
opts.bits: number? (=2048)How many bits to use for the RSA key generation.
callback: function (Error, PeerId)Node.js style callback. @@ -81,44 +81,44 @@ PeerId.create((err, idthrow err } console.log('id', JSON.stringify(id)) -})

PeerId.createFromHexString

createFromHexString(str: string): PeerId

Creates a Peer ID from hex string representing the key's multihash.

+})

PeerId.createFromHexString

createFromHexString(str: string): PeerId

Creates a Peer ID from hex string representing the key's multihash.

Parameters

NameDescription
str: stringHex encoded id

Returns

PeerId.createFromBytes

createFromBytes(buf: Buffer): PeerId

Creates a Peer ID from a buffer representing the key's multihash.

+

PeerId.createFromBytes

createFromBytes(buf: Buffer): PeerId

Creates a Peer ID from a buffer representing the key's multihash.

Parameters

NameDescription
buf: Buffer

Returns

PeerId.createFromB58String

createFromB58String(str: string): PeerId

Creates a Peer ID from a base58 string representing the +

PeerId.createFromB58String

createFromB58String(str: string): PeerId

Creates a Peer ID from a base58 string representing the key's multihash.

Parameters

NameDescription
str: stringbase58 encoded id

Returns

PeerId.createFromPubKey

createFromPubKey(key: (string | Buffer), callback: function (Error, PeerId))

Creates a Peer ID from a buffer containing a public key.

-

Parameters

NameDescription
key: (string | Buffer)
callback: function (Error, PeerId)

PeerId.createFromPrivKey

createFromPrivKey(key: (string | Buffer), callback: function (Error, PeerId))

Creates a Peer ID from a buffer containing a private key.

+

PeerId.createFromPubKey

createFromPubKey(key: (string | Buffer), callback: function (Error, PeerId))

Creates a Peer ID from a buffer containing a public key.

+

Parameters

NameDescription
key: (string | Buffer)
callback: function (Error, PeerId)

PeerId.createFromPrivKey

createFromPrivKey(key: (string | Buffer), callback: function (Error, PeerId))

Creates a Peer ID from a buffer containing a private key.

Parameters

NameDescription
key: (string | Buffer)The private key, if passed as string base64 encoding is assumed. -
callback: function (Error, PeerId)

PeerId.createFromJSON

createFromJSON(obj: PeerIdJson, callback: function (Error, PeerId))

Import a PeerId from a serialized JSON object.

-

Parameters

NameDescription
obj: PeerIdJson
callback: function (Error, PeerId)

instance

PeerId.constructor

constructor(id: Buffer, privKey: RSAPrivateKey?, pubKey: RSAPublickKey?)

Parameters

NameDescription
id: Buffer
privKey: RSAPrivateKey?
pubKey: RSAPublickKey?

PeerId.id

id: Buffer

PeerId.privKey

privKey: (RSAPrivateKey | undefined)

The private key of this id, if it exists.

-

PeerId.pubKey

pubKey: (RSAPublicKey | undefined)

The private key of this id, if it exists.

-

PeerId.marshalPubKey

marshalPubKey(): Buffer

Create the protobuf version of the public key, +

callback: function (Error, PeerId)

PeerId.createFromJSON

createFromJSON(obj: PeerIdJson, callback: function (Error, PeerId))

Import a PeerId from a serialized JSON object.

+

Parameters

NameDescription
obj: PeerIdJson
callback: function (Error, PeerId)

instance

PeerId.constructor

constructor(id: Buffer, privKey: RSAPrivateKey?, pubKey: RSAPublickKey?)

Parameters

NameDescription
id: Buffer
privKey: RSAPrivateKey?
pubKey: RSAPublickKey?

PeerId.id

id: Buffer

PeerId.privKey

privKey: (RSAPrivateKey | undefined)

The private key of this id, if it exists.

+

PeerId.pubKey

pubKey: (RSAPublicKey | undefined)

The private key of this id, if it exists.

+

PeerId.marshalPubKey

marshalPubKey(): Buffer

Create the protobuf version of the public key, matching go-ipfs formatting.

Returns

Buffer The marshalled public key

Throws

Error Failure -

PeerId.marshalPrivKey

marshalPrivKey(): Buffer

Create the protobuf version of the private key, +

PeerId.marshalPrivKey

marshalPrivKey(): Buffer

Create the protobuf version of the private key, matching go-ipfs formatting.

Returns

PeerId.toPrint

toPrint(): PeerIdJson

Alias for toJSON.

+

PeerId.toPrint

toPrint(): PeerIdJson

Alias for toJSON.

Returns

PeerIdJson -

PeerId.toJSON

toJSON(): PeerIdJson

Return the jsonified version of the key, matching the formatting +

PeerId.toJSON

toJSON(): PeerIdJson

Return the jsonified version of the key, matching the formatting of go-ipfs for its config file.

Returns

PeerIdJson -

PeerId.toHexString

toHexString(): String

Returns the Peer ID's id as a hex string.

+

PeerId.toHexString

toHexString(): String

Returns the Peer ID's id as a hex string.

Returns

String -

PeerId.toBytes

toBytes(): Buffer

Returns the Peer ID's id as a buffer.

+

PeerId.toBytes

toBytes(): Buffer

Returns the Peer ID's id as a buffer.

Returns

Buffer -

PeerId.toB58String

toB58String(): String

Returns the Peer ID's id as a base58 string.

+

PeerId.toB58String

toB58String(): String

Returns the Peer ID's id as a base58 string.

Returns

String -

PeerIdJson