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

@relaycorp/relaynet-core

Package Overview
Dependencies
Maintainers
2
Versions
293
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@relaycorp/relaynet-core - npm Package Compare versions

Comparing version 1.25.0 to 1.25.1

9

build/main/lib/messages/ParcelCollectionAck.d.ts

@@ -1,13 +0,10 @@

export interface ParcelCollectionAck {
export declare class ParcelCollectionAck {
readonly senderEndpointPrivateAddress: string;
readonly recipientEndpointAddress: string;
readonly parcelId: string;
}
export declare class ParcelCollectionAckSet {
readonly ackSet: ReadonlySet<ParcelCollectionAck>;
static readonly FORMAT_SIGNATURE: Uint8Array;
static deserialize(pcaSerialized: ArrayBuffer): ParcelCollectionAckSet;
static deserialize(pcaSerialized: ArrayBuffer): ParcelCollectionAck;
private static readonly SCHEMA;
constructor(ackSet: ReadonlySet<ParcelCollectionAck>);
constructor(senderEndpointPrivateAddress: string, recipientEndpointAddress: string, parcelId: string);
serialize(): ArrayBuffer;
}

@@ -16,64 +16,47 @@ "use strict";

const InvalidMessageError_1 = __importDefault(require("./InvalidMessageError"));
class ParcelCollectionAckSet {
constructor(ackSet) {
this.ackSet = ackSet;
class ParcelCollectionAck {
constructor(senderEndpointPrivateAddress, recipientEndpointAddress, parcelId) {
this.senderEndpointPrivateAddress = senderEndpointPrivateAddress;
this.recipientEndpointAddress = recipientEndpointAddress;
this.parcelId = parcelId;
}
static deserialize(pcaSerialized) {
var _a;
const formatSignature = Buffer.from(pcaSerialized.slice(0, ParcelCollectionAckSet.FORMAT_SIGNATURE.byteLength));
if (!formatSignature.equals(ParcelCollectionAckSet.FORMAT_SIGNATURE)) {
throw new InvalidMessageError_1.default('Format signature should be that of a PCA set');
const formatSignature = Buffer.from(pcaSerialized.slice(0, ParcelCollectionAck.FORMAT_SIGNATURE.byteLength));
if (!formatSignature.equals(ParcelCollectionAck.FORMAT_SIGNATURE)) {
throw new InvalidMessageError_1.default('Format signature should be that of a PCA');
}
const pcaSetSerialized = pcaSerialized.slice(10);
const result = asn1js.verifySchema(pcaSetSerialized, ParcelCollectionAckSet.SCHEMA);
const pcaSequenceSerialized = pcaSerialized.slice(10);
const result = asn1js.verifySchema(pcaSequenceSerialized, ParcelCollectionAck.SCHEMA);
if (!result.verified) {
throw new InvalidMessageError_1.default('PCA set did not meet required structure');
throw new InvalidMessageError_1.default('PCA did not meet required structure');
}
const ackBlocks = (_a = result.result.ack_set) !== null && _a !== void 0 ? _a : [];
const acks = ackBlocks.map(ackBlock => ({
parcelId: ackBlock.valueBlock.value[2].valueBlock.value,
recipientEndpointAddress: ackBlock.valueBlock.value[1].valueBlock
.value,
senderEndpointPrivateAddress: ackBlock.valueBlock.value[0]
.valueBlock.value,
}));
return new ParcelCollectionAckSet(new Set(acks));
const pcaBlock = result.result.ParcelCollectionAck;
return new ParcelCollectionAck(pcaBlock.senderEndpointPrivateAddress.valueBlock.value, pcaBlock.recipientEndpointAddress.valueBlock.value, pcaBlock.parcelId.valueBlock.value);
}
serialize() {
const ackSequences = [...this.ackSet].map(ack => new asn1js.Sequence({
const ackBlock = new asn1js.Sequence({
value: [
new asn1js.VisibleString({ value: ack.senderEndpointPrivateAddress }),
new asn1js.VisibleString({ value: ack.recipientEndpointAddress }),
new asn1js.VisibleString({ value: ack.parcelId }),
new asn1js.VisibleString({ value: this.senderEndpointPrivateAddress }),
new asn1js.VisibleString({ value: this.recipientEndpointAddress }),
new asn1js.VisibleString({ value: this.parcelId }),
],
}));
const ackSetSerialized = new asn1js.Set({ value: ackSequences }).toBER(false);
const serialization = new ArrayBuffer(ParcelCollectionAckSet.FORMAT_SIGNATURE.byteLength + ackSetSerialized.byteLength);
});
const ackSerialized = ackBlock.toBER(false);
const serialization = new ArrayBuffer(ParcelCollectionAck.FORMAT_SIGNATURE.byteLength + ackSerialized.byteLength);
const serializationView = new Uint8Array(serialization);
serializationView.set(ParcelCollectionAckSet.FORMAT_SIGNATURE, 0);
serializationView.set(new Uint8Array(ackSetSerialized), ParcelCollectionAckSet.FORMAT_SIGNATURE.byteLength);
serializationView.set(ParcelCollectionAck.FORMAT_SIGNATURE, 0);
serializationView.set(new Uint8Array(ackSerialized), ParcelCollectionAck.FORMAT_SIGNATURE.byteLength);
return serialization;
}
}
exports.ParcelCollectionAckSet = ParcelCollectionAckSet;
ParcelCollectionAckSet.FORMAT_SIGNATURE = formatSignature_1.generateFormatSignature(0x51, 0);
ParcelCollectionAckSet.SCHEMA = new asn1js.Set({
name: 'ParcelCollectionAckSet',
exports.ParcelCollectionAck = ParcelCollectionAck;
ParcelCollectionAck.FORMAT_SIGNATURE = formatSignature_1.generateFormatSignature(0x51, 0);
ParcelCollectionAck.SCHEMA = new asn1js.Sequence({
name: 'ParcelCollectionAck',
value: [
new asn1js.Repeated({
name: 'ack_set',
value: new asn1js.Sequence({
name: 'ack',
value: [
new asn1js.VisibleString({
name: 'senderEndpointPrivateAddress',
optional: false,
}),
new asn1js.VisibleString({ name: 'recipientEndpointAddress', optional: false }),
new asn1js.VisibleString({ name: 'parcelId', optional: false }),
],
}),
}),
new asn1js.VisibleString({ name: 'senderEndpointPrivateAddress', optional: false }),
new asn1js.VisibleString({ name: 'recipientEndpointAddress', optional: false }),
new asn1js.VisibleString({ name: 'parcelId', optional: false }),
],
});
//# sourceMappingURL=ParcelCollectionAck.js.map

@@ -1,13 +0,10 @@

export interface ParcelCollectionAck {
export declare class ParcelCollectionAck {
readonly senderEndpointPrivateAddress: string;
readonly recipientEndpointAddress: string;
readonly parcelId: string;
}
export declare class ParcelCollectionAckSet {
readonly ackSet: ReadonlySet<ParcelCollectionAck>;
static readonly FORMAT_SIGNATURE: Uint8Array;
static deserialize(pcaSerialized: ArrayBuffer): ParcelCollectionAckSet;
static deserialize(pcaSerialized: ArrayBuffer): ParcelCollectionAck;
private static readonly SCHEMA;
constructor(ackSet: ReadonlySet<ParcelCollectionAck>);
constructor(senderEndpointPrivateAddress: string, recipientEndpointAddress: string, parcelId: string);
serialize(): ArrayBuffer;
}
import * as asn1js from 'asn1js';
import { generateFormatSignature } from './formatSignature';
import InvalidMessageError from './InvalidMessageError';
export class ParcelCollectionAckSet {
constructor(ackSet) {
this.ackSet = ackSet;
export class ParcelCollectionAck {
constructor(senderEndpointPrivateAddress, recipientEndpointAddress, parcelId) {
this.senderEndpointPrivateAddress = senderEndpointPrivateAddress;
this.recipientEndpointAddress = recipientEndpointAddress;
this.parcelId = parcelId;
}
static deserialize(pcaSerialized) {
const formatSignature = Buffer.from(pcaSerialized.slice(0, ParcelCollectionAckSet.FORMAT_SIGNATURE.byteLength));
if (!formatSignature.equals(ParcelCollectionAckSet.FORMAT_SIGNATURE)) {
throw new InvalidMessageError('Format signature should be that of a PCA set');
const formatSignature = Buffer.from(pcaSerialized.slice(0, ParcelCollectionAck.FORMAT_SIGNATURE.byteLength));
if (!formatSignature.equals(ParcelCollectionAck.FORMAT_SIGNATURE)) {
throw new InvalidMessageError('Format signature should be that of a PCA');
}
const pcaSetSerialized = pcaSerialized.slice(10);
const result = asn1js.verifySchema(pcaSetSerialized, ParcelCollectionAckSet.SCHEMA);
const pcaSequenceSerialized = pcaSerialized.slice(10);
const result = asn1js.verifySchema(pcaSequenceSerialized, ParcelCollectionAck.SCHEMA);
if (!result.verified) {
throw new InvalidMessageError('PCA set did not meet required structure');
throw new InvalidMessageError('PCA did not meet required structure');
}
const ackBlocks = result.result.ack_set ?? [];
const acks = ackBlocks.map(ackBlock => ({
parcelId: ackBlock.valueBlock.value[2].valueBlock.value,
recipientEndpointAddress: ackBlock.valueBlock.value[1].valueBlock
.value,
senderEndpointPrivateAddress: ackBlock.valueBlock.value[0]
.valueBlock.value,
}));
return new ParcelCollectionAckSet(new Set(acks));
const pcaBlock = result.result.ParcelCollectionAck;
return new ParcelCollectionAck(pcaBlock.senderEndpointPrivateAddress.valueBlock.value, pcaBlock.recipientEndpointAddress.valueBlock.value, pcaBlock.parcelId.valueBlock.value);
}
serialize() {
const ackSequences = [...this.ackSet].map(ack => new asn1js.Sequence({
const ackBlock = new asn1js.Sequence({
value: [
new asn1js.VisibleString({ value: ack.senderEndpointPrivateAddress }),
new asn1js.VisibleString({ value: ack.recipientEndpointAddress }),
new asn1js.VisibleString({ value: ack.parcelId }),
new asn1js.VisibleString({ value: this.senderEndpointPrivateAddress }),
new asn1js.VisibleString({ value: this.recipientEndpointAddress }),
new asn1js.VisibleString({ value: this.parcelId }),
],
}));
const ackSetSerialized = new asn1js.Set({ value: ackSequences }).toBER(false);
const serialization = new ArrayBuffer(ParcelCollectionAckSet.FORMAT_SIGNATURE.byteLength + ackSetSerialized.byteLength);
});
const ackSerialized = ackBlock.toBER(false);
const serialization = new ArrayBuffer(ParcelCollectionAck.FORMAT_SIGNATURE.byteLength + ackSerialized.byteLength);
const serializationView = new Uint8Array(serialization);
serializationView.set(ParcelCollectionAckSet.FORMAT_SIGNATURE, 0);
serializationView.set(new Uint8Array(ackSetSerialized), ParcelCollectionAckSet.FORMAT_SIGNATURE.byteLength);
serializationView.set(ParcelCollectionAck.FORMAT_SIGNATURE, 0);
serializationView.set(new Uint8Array(ackSerialized), ParcelCollectionAck.FORMAT_SIGNATURE.byteLength);
return serialization;
}
}
ParcelCollectionAckSet.FORMAT_SIGNATURE = generateFormatSignature(0x51, 0);
ParcelCollectionAckSet.SCHEMA = new asn1js.Set({
name: 'ParcelCollectionAckSet',
ParcelCollectionAck.FORMAT_SIGNATURE = generateFormatSignature(0x51, 0);
ParcelCollectionAck.SCHEMA = new asn1js.Sequence({
name: 'ParcelCollectionAck',
value: [
new asn1js.Repeated({
name: 'ack_set',
value: new asn1js.Sequence({
name: 'ack',
value: [
new asn1js.VisibleString({
name: 'senderEndpointPrivateAddress',
optional: false,
}),
new asn1js.VisibleString({ name: 'recipientEndpointAddress', optional: false }),
new asn1js.VisibleString({ name: 'parcelId', optional: false }),
],
}),
}),
new asn1js.VisibleString({ name: 'senderEndpointPrivateAddress', optional: false }),
new asn1js.VisibleString({ name: 'recipientEndpointAddress', optional: false }),
new asn1js.VisibleString({ name: 'parcelId', optional: false }),
],
});
//# sourceMappingURL=ParcelCollectionAck.js.map
{
"name": "@relaycorp/relaynet-core",
"version": "1.25.0",
"version": "1.25.1",
"author": {

@@ -5,0 +5,0 @@ "email": "no-reply@relaycorp.tech",

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