New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@libp2p/peer-record

Package Overview
Dependencies
Maintainers
6
Versions
615
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@libp2p/peer-record - npm Package Compare versions

Comparing version 4.0.3 to 4.0.4

src/peer-record/consts.ts

56

dist/src/envelope/envelope.js
/* eslint-disable import/export */
/* eslint-disable complexity */
/* eslint-disable @typescript-eslint/no-namespace */
/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */
import { encodeMessage, decodeMessage, message } from 'protons-runtime';

@@ -9,36 +11,24 @@ export var Envelope;

if (_codec == null) {
_codec = message((obj, writer, opts = {}) => {
_codec = message((obj, w, opts = {}) => {
if (opts.lengthDelimited !== false) {
writer.fork();
w.fork();
}
if (obj.publicKey != null) {
writer.uint32(10);
writer.bytes(obj.publicKey);
if (opts.writeDefaults === true || (obj.publicKey != null && obj.publicKey.byteLength > 0)) {
w.uint32(10);
w.bytes(obj.publicKey);
}
else {
throw new Error('Protocol error: required field "publicKey" was not found in object');
if (opts.writeDefaults === true || (obj.payloadType != null && obj.payloadType.byteLength > 0)) {
w.uint32(18);
w.bytes(obj.payloadType);
}
if (obj.payloadType != null) {
writer.uint32(18);
writer.bytes(obj.payloadType);
if (opts.writeDefaults === true || (obj.payload != null && obj.payload.byteLength > 0)) {
w.uint32(26);
w.bytes(obj.payload);
}
else {
throw new Error('Protocol error: required field "payloadType" was not found in object');
if (opts.writeDefaults === true || (obj.signature != null && obj.signature.byteLength > 0)) {
w.uint32(42);
w.bytes(obj.signature);
}
if (obj.payload != null) {
writer.uint32(26);
writer.bytes(obj.payload);
}
else {
throw new Error('Protocol error: required field "payload" was not found in object');
}
if (obj.signature != null) {
writer.uint32(42);
writer.bytes(obj.signature);
}
else {
throw new Error('Protocol error: required field "signature" was not found in object');
}
if (opts.lengthDelimited !== false) {
writer.ldelim();
w.ldelim();
}

@@ -73,14 +63,2 @@ }, (reader, length) => {

}
if (obj.publicKey == null) {
throw new Error('Protocol error: value for required field "publicKey" was not found in protobuf');
}
if (obj.payloadType == null) {
throw new Error('Protocol error: value for required field "payloadType" was not found in protobuf');
}
if (obj.payload == null) {
throw new Error('Protocol error: value for required field "payload" was not found in protobuf');
}
if (obj.signature == null) {
throw new Error('Protocol error: value for required field "signature" was not found in protobuf');
}
return obj;

@@ -87,0 +65,0 @@ });

@@ -1,3 +0,3 @@

export const ENVELOPE_DOMAIN_PEER_RECORD: "libp2p-peer-record";
export const ENVELOPE_PAYLOAD_TYPE_PEER_RECORD: Uint8Array;
export declare const ENVELOPE_DOMAIN_PEER_RECORD = "libp2p-peer-record";
export declare const ENVELOPE_PAYLOAD_TYPE_PEER_RECORD: Uint8Array;
//# sourceMappingURL=consts.d.ts.map
/* eslint-disable import/export */
/* eslint-disable complexity */
/* eslint-disable @typescript-eslint/no-namespace */
/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */
import { encodeMessage, decodeMessage, message } from 'protons-runtime';

@@ -11,15 +13,12 @@ export var PeerRecord;

if (_codec == null) {
_codec = message((obj, writer, opts = {}) => {
_codec = message((obj, w, opts = {}) => {
if (opts.lengthDelimited !== false) {
writer.fork();
w.fork();
}
if (obj.multiaddr != null) {
writer.uint32(10);
writer.bytes(obj.multiaddr);
if (opts.writeDefaults === true || (obj.multiaddr != null && obj.multiaddr.byteLength > 0)) {
w.uint32(10);
w.bytes(obj.multiaddr);
}
else {
throw new Error('Protocol error: required field "multiaddr" was not found in object');
}
if (opts.lengthDelimited !== false) {
writer.ldelim();
w.ldelim();
}

@@ -42,5 +41,2 @@ }, (reader, length) => {

}
if (obj.multiaddr == null) {
throw new Error('Protocol error: value for required field "multiaddr" was not found in protobuf');
}
return obj;

@@ -61,31 +57,24 @@ });

if (_codec == null) {
_codec = message((obj, writer, opts = {}) => {
_codec = message((obj, w, opts = {}) => {
if (opts.lengthDelimited !== false) {
writer.fork();
w.fork();
}
if (obj.peerId != null) {
writer.uint32(10);
writer.bytes(obj.peerId);
if (opts.writeDefaults === true || (obj.peerId != null && obj.peerId.byteLength > 0)) {
w.uint32(10);
w.bytes(obj.peerId);
}
else {
throw new Error('Protocol error: required field "peerId" was not found in object');
if (opts.writeDefaults === true || obj.seq !== 0n) {
w.uint32(16);
w.uint64(obj.seq);
}
if (obj.seq != null) {
writer.uint32(16);
writer.uint64(obj.seq);
}
else {
throw new Error('Protocol error: required field "seq" was not found in object');
}
if (obj.addresses != null) {
for (const value of obj.addresses) {
writer.uint32(26);
PeerRecord.AddressInfo.codec().encode(value, writer);
w.uint32(26);
PeerRecord.AddressInfo.codec().encode(value, w, {
writeDefaults: true
});
}
}
else {
throw new Error('Protocol error: required field "addresses" was not found in object');
}
if (opts.lengthDelimited !== false) {
writer.ldelim();
w.ldelim();
}

@@ -116,8 +105,2 @@ }, (reader, length) => {

}
if (obj.peerId == null) {
throw new Error('Protocol error: value for required field "peerId" was not found in protobuf');
}
if (obj.seq == null) {
throw new Error('Protocol error: value for required field "seq" was not found in protobuf');
}
return obj;

@@ -124,0 +107,0 @@ });

{
"name": "@libp2p/peer-record",
"version": "4.0.3",
"version": "4.0.4",
"description": "Used to transfer signed peer data across the network",

@@ -162,7 +162,7 @@ "license": "Apache-2.0 OR MIT",

"it-pipe": "^2.0.3",
"multiformats": "^9.6.3",
"protons-runtime": "^3.1.0",
"multiformats": "^10.0.0",
"protons-runtime": "^4.0.1",
"uint8-varint": "^1.0.2",
"uint8arraylist": "^2.1.0",
"uint8arrays": "^3.0.0",
"uint8arrays": "^4.0.2",
"varint": "^6.0.0"

@@ -175,5 +175,5 @@ },

"aegir": "^37.3.0",
"protons": "^5.1.0",
"protons": "^6.0.0",
"sinon": "^14.0.0"
}
}
/* eslint-disable import/export */
/* eslint-disable complexity */
/* eslint-disable @typescript-eslint/no-namespace */
/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */

@@ -20,37 +22,29 @@ import { encodeMessage, decodeMessage, message } from 'protons-runtime'

if (_codec == null) {
_codec = message<Envelope>((obj, writer, opts = {}) => {
_codec = message<Envelope>((obj, w, opts = {}) => {
if (opts.lengthDelimited !== false) {
writer.fork()
w.fork()
}
if (obj.publicKey != null) {
writer.uint32(10)
writer.bytes(obj.publicKey)
} else {
throw new Error('Protocol error: required field "publicKey" was not found in object')
if (opts.writeDefaults === true || (obj.publicKey != null && obj.publicKey.byteLength > 0)) {
w.uint32(10)
w.bytes(obj.publicKey)
}
if (obj.payloadType != null) {
writer.uint32(18)
writer.bytes(obj.payloadType)
} else {
throw new Error('Protocol error: required field "payloadType" was not found in object')
if (opts.writeDefaults === true || (obj.payloadType != null && obj.payloadType.byteLength > 0)) {
w.uint32(18)
w.bytes(obj.payloadType)
}
if (obj.payload != null) {
writer.uint32(26)
writer.bytes(obj.payload)
} else {
throw new Error('Protocol error: required field "payload" was not found in object')
if (opts.writeDefaults === true || (obj.payload != null && obj.payload.byteLength > 0)) {
w.uint32(26)
w.bytes(obj.payload)
}
if (obj.signature != null) {
writer.uint32(42)
writer.bytes(obj.signature)
} else {
throw new Error('Protocol error: required field "signature" was not found in object')
if (opts.writeDefaults === true || (obj.signature != null && obj.signature.byteLength > 0)) {
w.uint32(42)
w.bytes(obj.signature)
}
if (opts.lengthDelimited !== false) {
writer.ldelim()
w.ldelim()
}

@@ -89,18 +83,2 @@ }, (reader, length) => {

if (obj.publicKey == null) {
throw new Error('Protocol error: value for required field "publicKey" was not found in protobuf')
}
if (obj.payloadType == null) {
throw new Error('Protocol error: value for required field "payloadType" was not found in protobuf')
}
if (obj.payload == null) {
throw new Error('Protocol error: value for required field "payload" was not found in protobuf')
}
if (obj.signature == null) {
throw new Error('Protocol error: value for required field "signature" was not found in protobuf')
}
return obj

@@ -107,0 +85,0 @@ })

/* eslint-disable import/export */
/* eslint-disable complexity */
/* eslint-disable @typescript-eslint/no-namespace */
/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */

@@ -24,16 +26,14 @@ import { encodeMessage, decodeMessage, message } from 'protons-runtime'

if (_codec == null) {
_codec = message<AddressInfo>((obj, writer, opts = {}) => {
_codec = message<AddressInfo>((obj, w, opts = {}) => {
if (opts.lengthDelimited !== false) {
writer.fork()
w.fork()
}
if (obj.multiaddr != null) {
writer.uint32(10)
writer.bytes(obj.multiaddr)
} else {
throw new Error('Protocol error: required field "multiaddr" was not found in object')
if (opts.writeDefaults === true || (obj.multiaddr != null && obj.multiaddr.byteLength > 0)) {
w.uint32(10)
w.bytes(obj.multiaddr)
}
if (opts.lengthDelimited !== false) {
writer.ldelim()
w.ldelim()
}

@@ -60,6 +60,2 @@ }, (reader, length) => {

if (obj.multiaddr == null) {
throw new Error('Protocol error: value for required field "multiaddr" was not found in protobuf')
}
return obj

@@ -85,19 +81,15 @@ })

if (_codec == null) {
_codec = message<PeerRecord>((obj, writer, opts = {}) => {
_codec = message<PeerRecord>((obj, w, opts = {}) => {
if (opts.lengthDelimited !== false) {
writer.fork()
w.fork()
}
if (obj.peerId != null) {
writer.uint32(10)
writer.bytes(obj.peerId)
} else {
throw new Error('Protocol error: required field "peerId" was not found in object')
if (opts.writeDefaults === true || (obj.peerId != null && obj.peerId.byteLength > 0)) {
w.uint32(10)
w.bytes(obj.peerId)
}
if (obj.seq != null) {
writer.uint32(16)
writer.uint64(obj.seq)
} else {
throw new Error('Protocol error: required field "seq" was not found in object')
if (opts.writeDefaults === true || obj.seq !== 0n) {
w.uint32(16)
w.uint64(obj.seq)
}

@@ -107,11 +99,11 @@

for (const value of obj.addresses) {
writer.uint32(26)
PeerRecord.AddressInfo.codec().encode(value, writer)
w.uint32(26)
PeerRecord.AddressInfo.codec().encode(value, w, {
writeDefaults: true
})
}
} else {
throw new Error('Protocol error: required field "addresses" was not found in object')
}
if (opts.lengthDelimited !== false) {
writer.ldelim()
w.ldelim()
}

@@ -146,10 +138,2 @@ }, (reader, length) => {

if (obj.peerId == null) {
throw new Error('Protocol error: value for required field "peerId" was not found in protobuf')
}
if (obj.seq == null) {
throw new Error('Protocol error: value for required field "seq" was not found in protobuf')
}
return obj

@@ -156,0 +140,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

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