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
6
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 4.0.10 to 4.1.0-90cfd25e2

10

dist/src/index.d.ts

@@ -23,3 +23,3 @@ /**

*/
import type { PublicKey, PrivateKey, RSAPeerId, Ed25519PeerId, Secp256k1PeerId, PeerId } from '@libp2p/interface';
import type { PublicKey, PrivateKey, RSAPeerId, Ed25519PeerId, Secp256k1PeerId, KeyType } from '@libp2p/interface';
export declare const createEd25519PeerId: () => Promise<Ed25519PeerId>;

@@ -30,6 +30,6 @@ export declare const createSecp256k1PeerId: () => Promise<Secp256k1PeerId>;

}) => Promise<RSAPeerId>;
export declare function createFromPubKey(publicKey: PublicKey): Promise<PeerId>;
export declare function createFromPrivKey(privateKey: PrivateKey): Promise<PeerId>;
export declare function createFromPubKey<T extends KeyType>(publicKey: PublicKey<T>): Promise<Ed25519PeerId | Secp256k1PeerId | RSAPeerId>;
export declare function createFromPrivKey<T extends KeyType>(privateKey: PrivateKey<T>): Promise<Ed25519PeerId | Secp256k1PeerId | RSAPeerId>;
export declare function exportToProtobuf(peerId: RSAPeerId | Ed25519PeerId | Secp256k1PeerId, excludePrivateKey?: boolean): Uint8Array;
export declare function createFromProtobuf(buf: Uint8Array): Promise<PeerId>;
export declare function createFromProtobuf(buf: Uint8Array): Promise<Ed25519PeerId | Secp256k1PeerId | RSAPeerId>;
export declare function createFromJSON(obj: {

@@ -39,3 +39,3 @@ id: string;

pubKey?: string;
}): Promise<PeerId>;
}): Promise<Ed25519PeerId | Secp256k1PeerId | RSAPeerId>;
//# sourceMappingURL=index.d.ts.map
{
"name": "@libp2p/peer-id-factory",
"version": "4.0.10",
"version": "4.1.0-90cfd25e2",
"description": "Create PeerId instances",

@@ -61,5 +61,5 @@ "license": "Apache-2.0 OR MIT",

"dependencies": {
"@libp2p/crypto": "^4.0.6",
"@libp2p/interface": "^1.2.0",
"@libp2p/peer-id": "^4.0.10",
"@libp2p/crypto": "4.1.0-90cfd25e2",
"@libp2p/interface": "1.3.0-90cfd25e2",
"@libp2p/peer-id": "4.1.0-90cfd25e2",
"protons-runtime": "^5.4.0",

@@ -66,0 +66,0 @@ "uint8arraylist": "^2.4.8",

@@ -68,4 +68,4 @@ # @libp2p/peer-id-factory

- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)
- Apache 2.0, ([LICENSE-APACHE](https://github.com/libp2p/js-libp2p/blob/main/packages/peer-id-factory/LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT ([LICENSE-MIT](https://github.com/libp2p/js-libp2p/blob/main/packages/peer-id-factory/LICENSE-MIT) / <http://opensource.org/licenses/MIT>)

@@ -72,0 +72,0 @@ # Contribution

@@ -28,3 +28,3 @@ /**

import { PeerIdProto } from './proto.js'
import type { PublicKey, PrivateKey, RSAPeerId, Ed25519PeerId, Secp256k1PeerId, PeerId } from '@libp2p/interface'
import type { PublicKey, PrivateKey, RSAPeerId, Ed25519PeerId, Secp256k1PeerId, KeyType } from '@libp2p/interface'

@@ -64,7 +64,7 @@ export const createEd25519PeerId = async (): Promise<Ed25519PeerId> => {

export async function createFromPubKey (publicKey: PublicKey): Promise<PeerId> {
export async function createFromPubKey <T extends KeyType > (publicKey: PublicKey<T>): Promise<Ed25519PeerId | Secp256k1PeerId | RSAPeerId> {
return peerIdFromKeys(marshalPublicKey(publicKey))
}
export async function createFromPrivKey (privateKey: PrivateKey): Promise<PeerId> {
export async function createFromPrivKey <T extends KeyType > (privateKey: PrivateKey<T>): Promise<Ed25519PeerId | Secp256k1PeerId | RSAPeerId> {
return peerIdFromKeys(marshalPublicKey(privateKey.public), marshalPrivateKey(privateKey))

@@ -81,3 +81,3 @@ }

export async function createFromProtobuf (buf: Uint8Array): Promise<PeerId> {
export async function createFromProtobuf (buf: Uint8Array): Promise<Ed25519PeerId | Secp256k1PeerId | RSAPeerId> {
const {

@@ -96,3 +96,3 @@ id,

export async function createFromJSON (obj: { id: string, privKey?: string, pubKey?: string }): Promise<PeerId> {
export async function createFromJSON (obj: { id: string, privKey?: string, pubKey?: string }): Promise<Ed25519PeerId | Secp256k1PeerId | RSAPeerId> {
return createFromParts(

@@ -105,3 +105,3 @@ uint8ArrayFromString(obj.id, 'base58btc'),

async function createFromParts (multihash: Uint8Array, privKey?: Uint8Array, pubKey?: Uint8Array): Promise<PeerId> {
async function createFromParts (multihash: Uint8Array, privKey?: Uint8Array, pubKey?: Uint8Array): Promise<Ed25519PeerId | Secp256k1PeerId | RSAPeerId> {
if (privKey != null) {

@@ -108,0 +108,0 @@ const key = await unmarshalPrivateKey(privKey)

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