@libp2p/peer-id-factory
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -55,3 +55,3 @@ import { generateKeyPair, marshalPrivateKey, unmarshalPrivateKey, marshalPublicKey, unmarshalPublicKey } from '@libp2p/crypto/keys'; | ||
else if (pubKey != null) { | ||
const key = await unmarshalPublicKey(pubKey); | ||
const key = unmarshalPublicKey(pubKey); | ||
return await createFromPubKey(key); | ||
@@ -58,0 +58,0 @@ } |
{ | ||
"name": "@libp2p/peer-id-factory", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Create PeerId instances", | ||
@@ -155,3 +155,3 @@ "license": "Apache-2.0 OR MIT", | ||
"devDependencies": { | ||
"aegir": "^37.9.0", | ||
"aegir": "^38.1.0", | ||
"protons": "^6.0.0", | ||
@@ -158,0 +158,0 @@ "util": "^0.12.4" |
@@ -57,3 +57,3 @@ import { generateKeyPair, marshalPrivateKey, unmarshalPrivateKey, marshalPublicKey, unmarshalPublicKey } from '@libp2p/crypto/keys' | ||
export async function createFromProtobuf (buf: Uint8Array) { | ||
export async function createFromProtobuf (buf: Uint8Array): Promise<PeerId> { | ||
const { | ||
@@ -72,3 +72,3 @@ id, | ||
export async function createFromJSON (obj: { id: string, privKey?: string, pubKey?: string }) { | ||
export async function createFromJSON (obj: { id: string, privKey?: string, pubKey?: string }): Promise<PeerId> { | ||
return await createFromParts( | ||
@@ -81,3 +81,3 @@ uint8ArrayFromString(obj.id, 'base58btc'), | ||
async function createFromParts (multihash: Uint8Array, privKey?: Uint8Array, pubKey?: Uint8Array) { | ||
async function createFromParts (multihash: Uint8Array, privKey?: Uint8Array, pubKey?: Uint8Array): Promise<PeerId> { | ||
if (privKey != null) { | ||
@@ -88,3 +88,3 @@ const key = await unmarshalPrivateKey(privKey) | ||
} else if (pubKey != null) { | ||
const key = await unmarshalPublicKey(pubKey) | ||
const key = unmarshalPublicKey(pubKey) | ||
@@ -91,0 +91,0 @@ return await createFromPubKey(key) |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
262955
1224