@libp2p/peer-id-factory
Advanced tools
Comparing version 1.0.4 to 1.0.5
import type { PublicKey, PrivateKey } from '@libp2p/interfaces/keys'; | ||
import type { RSAPeerId, Ed25519PeerId, Secp256k1PeerId } from '@libp2p/peer-id'; | ||
import type { RSAPeerId, Ed25519PeerId, Secp256k1PeerId } from '@libp2p/interfaces/peer-id'; | ||
export declare const createEd25519PeerId: () => Promise<Ed25519PeerId>; | ||
@@ -8,6 +8,6 @@ export declare const createSecp256k1PeerId: () => Promise<Secp256k1PeerId>; | ||
} | undefined) => Promise<RSAPeerId>; | ||
export declare function createFromPubKey(publicKey: PublicKey): Promise<Ed25519PeerId | Secp256k1PeerId | RSAPeerId>; | ||
export declare function createFromPrivKey(privateKey: PrivateKey): Promise<Ed25519PeerId | Secp256k1PeerId | RSAPeerId>; | ||
export declare function createFromPubKey(publicKey: PublicKey): Promise<import("@libp2p/interfaces/peer-id").PeerId>; | ||
export declare function createFromPrivKey(privateKey: PrivateKey): Promise<import("@libp2p/interfaces/peer-id").PeerId>; | ||
export declare function exportToProtobuf(peerId: RSAPeerId | Ed25519PeerId | Secp256k1PeerId, excludePrivateKey?: boolean): Uint8Array; | ||
export declare function createFromProtobuf(buf: Uint8Array): Promise<Ed25519PeerId | Secp256k1PeerId | RSAPeerId>; | ||
export declare function createFromProtobuf(buf: Uint8Array): Promise<import("@libp2p/interfaces/peer-id").PeerId>; | ||
export declare function createFromJSON(obj: { | ||
@@ -17,3 +17,3 @@ id: string; | ||
pubKey?: string; | ||
}): Promise<Ed25519PeerId | Secp256k1PeerId | RSAPeerId>; | ||
}): Promise<import("@libp2p/interfaces/peer-id").PeerId>; | ||
//# sourceMappingURL=index.d.ts.map |
import { keys } from '@libp2p/crypto'; | ||
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string'; | ||
import { PeerId } from '@libp2p/peer-id'; | ||
import { peerIdFromKeys, peerIdFromBytes } from '@libp2p/peer-id'; | ||
import { PeerIdProto } from './proto.js'; | ||
@@ -30,6 +30,6 @@ export const createEd25519PeerId = async () => { | ||
export async function createFromPubKey(publicKey) { | ||
return await PeerId.fromKeys(keys.marshalPublicKey(publicKey)); | ||
return await peerIdFromKeys(keys.marshalPublicKey(publicKey)); | ||
} | ||
export async function createFromPrivKey(privateKey) { | ||
return await PeerId.fromKeys(keys.marshalPublicKey(privateKey.public), keys.marshalPrivateKey(privateKey)); | ||
return await peerIdFromKeys(keys.marshalPublicKey(privateKey.public), keys.marshalPrivateKey(privateKey)); | ||
} | ||
@@ -59,4 +59,4 @@ export function exportToProtobuf(peerId, excludePrivateKey) { | ||
} | ||
return PeerId.fromBytes(multihash); | ||
return peerIdFromBytes(multihash); | ||
} | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@libp2p/peer-id-factory", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "IPFS Peer Id implementation in Node.js", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0 OR MIT", |
import { keys } from '@libp2p/crypto' | ||
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' | ||
import { PeerId } from '@libp2p/peer-id' | ||
import { peerIdFromKeys, peerIdFromBytes } from '@libp2p/peer-id' | ||
import { PeerIdProto } from './proto.js' | ||
import type { PublicKey, PrivateKey } from '@libp2p/interfaces/keys' | ||
import type { RSAPeerId, Ed25519PeerId, Secp256k1PeerId } from '@libp2p/peer-id' | ||
import type { RSAPeerId, Ed25519PeerId, Secp256k1PeerId } from '@libp2p/interfaces/peer-id' | ||
@@ -42,7 +42,7 @@ export const createEd25519PeerId = async (): Promise<Ed25519PeerId> => { | ||
export async function createFromPubKey (publicKey: PublicKey) { | ||
return await PeerId.fromKeys(keys.marshalPublicKey(publicKey)) | ||
return await peerIdFromKeys(keys.marshalPublicKey(publicKey)) | ||
} | ||
export async function createFromPrivKey (privateKey: PrivateKey) { | ||
return await PeerId.fromKeys(keys.marshalPublicKey(privateKey.public), keys.marshalPrivateKey(privateKey)) | ||
return await peerIdFromKeys(keys.marshalPublicKey(privateKey.public), keys.marshalPrivateKey(privateKey)) | ||
} | ||
@@ -91,3 +91,3 @@ | ||
return PeerId.fromBytes(multihash) | ||
return peerIdFromBytes(multihash) | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40793
204