From b127db0e71f684db9fc454cf9d32452b71a319a5 Mon Sep 17 00:00:00 2001 From: Friedel Ziegelmayer Date: Fri, 2 Dec 2016 16:43:04 +0100 Subject: [PATCH] Updates --- index.html | 52 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 21 deletions(-) diff --git a/index.html b/index.html index 3f78382..31ca5fd 100644 --- a/index.html +++ b/index.html @@ -5,7 +5,7 @@ color: #000; font-family: Roboto, sans-serif; font-weight: 300; line-height: 26px; -font-size: 17px;}
peer-id
0.8.0
peer-id
0.8.0

Introduction

Generate, import, and export PeerIDs, for use with IPFS.

+border-radius: 4px;}.hljs{display: block; +overflow-x: auto;}.hljs-comment, .hljs-quote{color: #998; +font-style: italic;}.hljs-keyword, .hljs-selector-tag, .hljs-subst{color: #333; +font-weight: bold;}.hljs-number, .hljs-literal, .hljs-variable, .hljs-template-variable, .hljs-tag .hljs-attr{color: #008080;}.hljs-string, .hljs-doctag{color: #d14;}.hljs-title, .hljs-section, .hljs-selector-id{color: #900; +font-weight: bold;}.hljs-subst{font-weight: normal;}.hljs-type, .hljs-class .hljs-title{color: #458; +font-weight: bold;}.hljs-tag, .hljs-name, .hljs-attribute{color: #000080; +font-weight: normal;}.hljs-regexp, .hljs-link{color: #009926;}.hljs-symbol, .hljs-bullet{color: #990073;}.hljs-built_in, .hljs-builtin-name{color: #0086b3;}.hljs-meta{color: #999; +font-weight: bold;}.hljs-deletion{background: #fdd;}.hljs-addition{background: #dfd;}.hljs-emphasis{font-style: italic;}.hljs-strong{font-weight: bold;}

Introduction

Generate, import, and export PeerIDs, for use with IPFS.

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

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.

@@ -75,11 +82,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.

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. @@ -90,44 +97,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

constructor

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

Parameters

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

PeerId.prototype.id

id: Buffer

PeerId.prototype.privKey

privKey: (RSAPrivateKey | undefined)

The private key of this id, if it exists.

-

PeerId.prototype.pubKey

pubKey: (RSAPublicKey | undefined)

The private key of this id, if it exists.

-

PeerId.prototype.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

constructor

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

Parameters

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

PeerId.prototype.id

id: Buffer

PeerId.prototype.privKey

privKey: (RSAPrivateKey | undefined)

The private key of this id, if it exists.

+

PeerId.prototype.pubKey

pubKey: (RSAPublicKey | undefined)

The private key of this id, if it exists.

+

PeerId.prototype.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.prototype.marshalPrivKey

marshalPrivKey(): Buffer

Create the protobuf version of the private key, +

PeerId.prototype.marshalPrivKey

marshalPrivKey(): Buffer

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

Returns

PeerId.prototype.toPrint

toPrint(): PeerIdJson

Alias for toJSON.

+

PeerId.prototype.toPrint

toPrint(): PeerIdJson

Alias for toJSON.

Returns

PeerId.prototype.toJSON

toJSON(): PeerIdJson

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

PeerId.prototype.toJSON

toJSON(): PeerIdJson

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

Returns

PeerId.prototype.toHexString

toHexString(): String

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

+

PeerId.prototype.toHexString

toHexString(): String

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

Returns

PeerId.prototype.toBytes

toBytes(): Buffer

Returns the Peer ID's id as a buffer.

+

PeerId.prototype.toBytes

toBytes(): Buffer

Returns the Peer ID's id as a buffer.

Returns

PeerId.prototype.toB58String

toB58String(): String

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

+

PeerId.prototype.toB58String

toB58String(): String

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

Returns

PeerIdJson

Parameters

NameDescription
id: stringBase58 +

PeerIdJson

Parameters

NameDescription
id: stringBase58 encoded peer id
privKey: string?The RSA private key in protobuf format, encoded in base64 @@ -146,8 +153,11 @@ of go-ipfs for its config file.

@media (min-width: 480px) and (max-width: 767px){ .rmq-904c8dae{display: none !important;}} @media (min-width: 992px) { .rmq-f731e6bb{width: 25.00000% !important;}} @media (min-width: 768px) { .rmq-e2f71b90{width: 25.00000% !important;}} +@media (min-width: 1200px) { .rmq-34ee8e6a{width: 25.00000% !important;}} @media (min-width: 480px) { .rmq-53cec4a3{width: 100.00000% !important;}} @media (min-width: 992px) { .rmq-6e94b3b{width: 66.66667% !important;}} @media (min-width: 992px) { .rmq-31473902{left: 33.33333% !important;}} @media (min-width: 768px) { .rmq-f2ae8010{width: 66.66667% !important;}} -@media (min-width: 768px) { .rmq-932fbda9{left: 33.33333% !important;}} \ No newline at end of file +@media (min-width: 768px) { .rmq-932fbda9{left: 33.33333% !important;}} +@media (min-width: 1200px) { .rmq-3b9282ea{width: 66.66667% !important;}} +@media (min-width: 1200px) { .rmq-ad95cc33{left: 33.33333% !important;}} \ No newline at end of file