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.8 to 1.0.9

src/proto.ts

2

dist/src/index.js

@@ -40,3 +40,3 @@ import { keys } from '@libp2p/crypto';

privKey: excludePrivateKey === true || peerId.privateKey == null ? undefined : peerId.privateKey
}).finish();
});
}

@@ -43,0 +43,0 @@ export async function createFromProtobuf(buf) {

@@ -1,116 +0,11 @@

/**
* Properties of a PeerIdProto.
* @exports IPeerIdProto
* @interface IPeerIdProto
* @property {Uint8Array} id PeerIdProto id
* @property {Uint8Array|null} [pubKey] PeerIdProto pubKey
* @property {Uint8Array|null} [privKey] PeerIdProto privKey
*/
/**
* Constructs a new PeerIdProto.
* @exports PeerIdProto
* @classdesc Represents a PeerIdProto.
* @implements IPeerIdProto
* @constructor
* @param {IPeerIdProto=} [p] Properties to set
*/
export function PeerIdProto(p?: any | undefined): void;
export class PeerIdProto {
/**
* Properties of a PeerIdProto.
* @exports IPeerIdProto
* @interface IPeerIdProto
* @property {Uint8Array} id PeerIdProto id
* @property {Uint8Array|null} [pubKey] PeerIdProto pubKey
* @property {Uint8Array|null} [privKey] PeerIdProto privKey
*/
/**
* Constructs a new PeerIdProto.
* @exports PeerIdProto
* @classdesc Represents a PeerIdProto.
* @implements IPeerIdProto
* @constructor
* @param {IPeerIdProto=} [p] Properties to set
*/
constructor(p?: any | undefined);
/**
* PeerIdProto id.
* @member {Uint8Array} id
* @memberof PeerIdProto
* @instance
*/
id: Uint8Array | $protobuf.Buffer;
/**
* PeerIdProto pubKey.
* @member {Uint8Array} pubKey
* @memberof PeerIdProto
* @instance
*/
pubKey: Uint8Array | $protobuf.Buffer;
/**
* PeerIdProto privKey.
* @member {Uint8Array} privKey
* @memberof PeerIdProto
* @instance
*/
privKey: Uint8Array | $protobuf.Buffer;
/**
* Converts this PeerIdProto to JSON.
* @function toJSON
* @memberof PeerIdProto
* @instance
* @returns {Object.<string,*>} JSON object
*/
toJSON(): {
[x: string]: any;
};
export interface PeerIdProto {
id: Uint8Array;
pubKey?: Uint8Array;
privKey?: Uint8Array;
}
export namespace PeerIdProto {
/**
* Encodes the specified PeerIdProto message. Does not implicitly {@link PeerIdProto.verify|verify} messages.
* @function encode
* @memberof PeerIdProto
* @static
* @param {IPeerIdProto} m PeerIdProto message or plain object to encode
* @param {$protobuf.Writer} [w] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
function encode(m: any, w?: $protobuf.Writer | undefined): $protobuf.Writer;
/**
* Decodes a PeerIdProto message from the specified reader or buffer.
* @function decode
* @memberof PeerIdProto
* @static
* @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from
* @param {number} [l] Message length if known beforehand
* @returns {PeerIdProto} PeerIdProto
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
function decode(r: Uint8Array | $protobuf.Reader, l?: number | undefined): PeerIdProto;
/**
* Creates a PeerIdProto message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof PeerIdProto
* @static
* @param {Object.<string,*>} d Plain object
* @returns {PeerIdProto} PeerIdProto
*/
function fromObject(d: {
[x: string]: any;
}): PeerIdProto;
/**
* Creates a plain object from a PeerIdProto message. Also converts values to other types if specified.
* @function toObject
* @memberof PeerIdProto
* @static
* @param {PeerIdProto} m PeerIdProto
* @param {$protobuf.IConversionOptions} [o] Conversion options
* @returns {Object.<string,*>} Plain object
*/
function toObject(m: PeerIdProto, o?: $protobuf.IConversionOptions | undefined): {
[x: string]: any;
};
export declare namespace PeerIdProto {
const codec: () => import("protons-runtime/dist/src/codecs/codec").Codec<PeerIdProto>;
const encode: (obj: PeerIdProto) => Uint8Array;
const decode: (buf: Uint8Array) => PeerIdProto;
}
import $protobuf from "protobufjs/minimal.js";
//# sourceMappingURL=proto.d.ts.map

@@ -1,195 +0,20 @@

// @ts-nocheck
/*eslint-disable*/
import $protobuf from "protobufjs/minimal.js";
// Common aliases
const $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
// Exported root namespace
const $root = $protobuf.roots["libp2p-peer-id"] || ($protobuf.roots["libp2p-peer-id"] = {});
/**
* Properties of a PeerIdProto.
* @exports IPeerIdProto
* @interface IPeerIdProto
* @property {Uint8Array} id PeerIdProto id
* @property {Uint8Array|null} [pubKey] PeerIdProto pubKey
* @property {Uint8Array|null} [privKey] PeerIdProto privKey
*/
/**
* Constructs a new PeerIdProto.
* @exports PeerIdProto
* @classdesc Represents a PeerIdProto.
* @implements IPeerIdProto
* @constructor
* @param {IPeerIdProto=} [p] Properties to set
*/
export function PeerIdProto(p) {
if (p)
for (var ks = Object.keys(p), i = 0; i < ks.length; ++i)
if (p[ks[i]] != null)
this[ks[i]] = p[ks[i]];
}
/**
* PeerIdProto id.
* @member {Uint8Array} id
* @memberof PeerIdProto
* @instance
*/
PeerIdProto.prototype.id = $util.newBuffer([]);
/**
* PeerIdProto pubKey.
* @member {Uint8Array} pubKey
* @memberof PeerIdProto
* @instance
*/
PeerIdProto.prototype.pubKey = $util.newBuffer([]);
/**
* PeerIdProto privKey.
* @member {Uint8Array} privKey
* @memberof PeerIdProto
* @instance
*/
PeerIdProto.prototype.privKey = $util.newBuffer([]);
/**
* Encodes the specified PeerIdProto message. Does not implicitly {@link PeerIdProto.verify|verify} messages.
* @function encode
* @memberof PeerIdProto
* @static
* @param {IPeerIdProto} m PeerIdProto message or plain object to encode
* @param {$protobuf.Writer} [w] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
PeerIdProto.encode = function encode(m, w) {
if (!w)
w = $Writer.create();
w.uint32(10).bytes(m.id);
if (m.pubKey != null && Object.hasOwnProperty.call(m, "pubKey"))
w.uint32(18).bytes(m.pubKey);
if (m.privKey != null && Object.hasOwnProperty.call(m, "privKey"))
w.uint32(26).bytes(m.privKey);
return w;
};
/**
* Decodes a PeerIdProto message from the specified reader or buffer.
* @function decode
* @memberof PeerIdProto
* @static
* @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from
* @param {number} [l] Message length if known beforehand
* @returns {PeerIdProto} PeerIdProto
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
PeerIdProto.decode = function decode(r, l) {
if (!(r instanceof $Reader))
r = $Reader.create(r);
var c = l === undefined ? r.len : r.pos + l, m = new PeerIdProto();
while (r.pos < c) {
var t = r.uint32();
switch (t >>> 3) {
case 1:
m.id = r.bytes();
break;
case 2:
m.pubKey = r.bytes();
break;
case 3:
m.privKey = r.bytes();
break;
default:
r.skipType(t & 7);
break;
}
}
if (!m.hasOwnProperty("id"))
throw $util.ProtocolError("missing required 'id'", { instance: m });
return m;
};
/**
* Creates a PeerIdProto message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof PeerIdProto
* @static
* @param {Object.<string,*>} d Plain object
* @returns {PeerIdProto} PeerIdProto
*/
PeerIdProto.fromObject = function fromObject(d) {
if (d instanceof PeerIdProto)
return d;
var m = new PeerIdProto();
if (d.id != null) {
if (typeof d.id === "string")
$util.base64.decode(d.id, m.id = $util.newBuffer($util.base64.length(d.id)), 0);
else if (d.id.length)
m.id = d.id;
}
if (d.pubKey != null) {
if (typeof d.pubKey === "string")
$util.base64.decode(d.pubKey, m.pubKey = $util.newBuffer($util.base64.length(d.pubKey)), 0);
else if (d.pubKey.length)
m.pubKey = d.pubKey;
}
if (d.privKey != null) {
if (typeof d.privKey === "string")
$util.base64.decode(d.privKey, m.privKey = $util.newBuffer($util.base64.length(d.privKey)), 0);
else if (d.privKey.length)
m.privKey = d.privKey;
}
return m;
};
/**
* Creates a plain object from a PeerIdProto message. Also converts values to other types if specified.
* @function toObject
* @memberof PeerIdProto
* @static
* @param {PeerIdProto} m PeerIdProto
* @param {$protobuf.IConversionOptions} [o] Conversion options
* @returns {Object.<string,*>} Plain object
*/
PeerIdProto.toObject = function toObject(m, o) {
if (!o)
o = {};
var d = {};
if (o.defaults) {
if (o.bytes === String)
d.id = "";
else {
d.id = [];
if (o.bytes !== Array)
d.id = $util.newBuffer(d.id);
}
if (o.bytes === String)
d.pubKey = "";
else {
d.pubKey = [];
if (o.bytes !== Array)
d.pubKey = $util.newBuffer(d.pubKey);
}
if (o.bytes === String)
d.privKey = "";
else {
d.privKey = [];
if (o.bytes !== Array)
d.privKey = $util.newBuffer(d.privKey);
}
}
if (m.id != null && m.hasOwnProperty("id")) {
d.id = o.bytes === String ? $util.base64.encode(m.id, 0, m.id.length) : o.bytes === Array ? Array.prototype.slice.call(m.id) : m.id;
}
if (m.pubKey != null && m.hasOwnProperty("pubKey")) {
d.pubKey = o.bytes === String ? $util.base64.encode(m.pubKey, 0, m.pubKey.length) : o.bytes === Array ? Array.prototype.slice.call(m.pubKey) : m.pubKey;
}
if (m.privKey != null && m.hasOwnProperty("privKey")) {
d.privKey = o.bytes === String ? $util.base64.encode(m.privKey, 0, m.privKey.length) : o.bytes === Array ? Array.prototype.slice.call(m.privKey) : m.privKey;
}
return d;
};
/**
* Converts this PeerIdProto to JSON.
* @function toJSON
* @memberof PeerIdProto
* @instance
* @returns {Object.<string,*>} JSON object
*/
PeerIdProto.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/* eslint-disable import/export */
/* eslint-disable @typescript-eslint/no-namespace */
import { encodeMessage, decodeMessage, message, bytes } from 'protons-runtime';
export var PeerIdProto;
(function (PeerIdProto) {
PeerIdProto.codec = () => {
return message({
1: { name: 'id', codec: bytes },
2: { name: 'pubKey', codec: bytes, optional: true },
3: { name: 'privKey', codec: bytes, optional: true }
});
};
PeerIdProto.encode = (obj) => {
return encodeMessage(obj, PeerIdProto.codec());
};
PeerIdProto.decode = (buf) => {
return decodeMessage(buf, PeerIdProto.codec());
};
})(PeerIdProto || (PeerIdProto = {}));
//# sourceMappingURL=proto.js.map
{
"name": "@libp2p/peer-id-factory",
"version": "1.0.8",
"version": "1.0.9",
"description": "IPFS Peer Id implementation in Node.js",

@@ -126,16 +126,14 @@ "license": "Apache-2.0 OR MIT",

"scripts": {
"clean": "aegir clean",
"lint": "aegir lint",
"dep-check": "aegir dep-check dist/src/**/*.js dist/test/**/*.js",
"build": "tsc",
"pretest": "npm run build",
"test": "aegir test -f ./dist/test/*.js -f ./dist/test/**/*.js",
"test:chrome": "npm run test -- -t browser",
"test:chrome-webworker": "npm run test -- -t webworker",
"test:firefox": "npm run test -- -t browser -- --browser firefox",
"test:firefox-webworker": "npm run test -- -t webworker -- --browser firefox",
"test:node": "npm run test -- -t node --cov",
"test:electron-main": "npm run test -- -t electron-main",
"build:proto": "npm run build:proto:js && npm run build:proto:types",
"build:proto:js": "pbjs -t static-module -w es6 --es6 -r libp2p-peer-id --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o src/proto.js ./src/proto.proto",
"build:proto:types": "pbts -o src/proto.d.ts src/proto.js"
"dep-check": "aegir dep-check",
"build": "aegir build",
"test": "aegir test",
"test:chrome": "aegir test -t browser --cov",
"test:chrome-webworker": "aegir test -t webworker",
"test:firefox": "aegir test -t browser -- --browser firefox",
"test:firefox-webworker": "aegir test -t webworker -- --browser firefox",
"test:node": "aegir test -t node --cov",
"test:electron-main": "aegir test -t electron-main",
"release": "aegir release"
},

@@ -147,9 +145,10 @@ "dependencies": {

"multiformats": "^9.6.3",
"protobufjs": "^6.11.2",
"protons-runtime": "^1.0.2",
"uint8arrays": "^3.0.0"
},
"devDependencies": {
"aegir": "^36.1.3",
"aegir": "^37.0.7",
"protons": "^3.0.2",
"util": "^0.12.4"
}
}

@@ -54,3 +54,3 @@ import { keys } from '@libp2p/crypto'

privKey: excludePrivateKey === true || peerId.privateKey == null ? undefined : peerId.privateKey
}).finish()
})
}

@@ -57,0 +57,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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