Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@libp2p/peer-id-factory

Package Overview
Dependencies
Maintainers
4
Versions
448
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@libp2p/peer-id-factory - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

10

dist/src/index.d.ts
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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc