@relaycorp/relaynet-core
Advanced tools
Comparing version
import Parcel from '../Parcel'; | ||
import { ParcelCollectionAck } from '../ParcelCollectionAck'; | ||
import PayloadPlaintext from './PayloadPlaintext'; | ||
@@ -26,3 +27,3 @@ export interface MessageWithExpiryDate { | ||
serialize(): ArrayBuffer; | ||
deserializeMessages(): AsyncIterableIterator<Parcel>; | ||
deserializeMessages(): AsyncIterable<Parcel | ParcelCollectionAck>; | ||
} |
@@ -36,2 +36,3 @@ "use strict"; | ||
const Parcel_1 = __importDefault(require("../Parcel")); | ||
const ParcelCollectionAck_1 = require("../ParcelCollectionAck"); | ||
/** | ||
@@ -121,5 +122,9 @@ * Number of octets needed to represent the type and length of an 8 MiB value in DER. | ||
return __asyncGenerator(this, arguments, function* deserializeMessages_1() { | ||
for (const message of this.messages) { | ||
for (const messageSerialized of this.messages) { | ||
const messageFormatSignature = Buffer.from(messageSerialized.slice(0, 10)); | ||
const messageClass = messageFormatSignature.equals(ParcelCollectionAck_1.ParcelCollectionAck.FORMAT_SIGNATURE) | ||
? ParcelCollectionAck_1.ParcelCollectionAck | ||
: Parcel_1.default; | ||
try { | ||
yield yield __await(Parcel_1.default.deserialize(message)); | ||
yield yield __await(messageClass.deserialize(messageSerialized)); | ||
} | ||
@@ -126,0 +131,0 @@ catch (error) { |
import Parcel from '../Parcel'; | ||
import { ParcelCollectionAck } from '../ParcelCollectionAck'; | ||
import PayloadPlaintext from './PayloadPlaintext'; | ||
@@ -26,3 +27,3 @@ export interface MessageWithExpiryDate { | ||
serialize(): ArrayBuffer; | ||
deserializeMessages(): AsyncIterableIterator<Parcel>; | ||
deserializeMessages(): AsyncIterable<Parcel | ParcelCollectionAck>; | ||
} |
@@ -5,2 +5,3 @@ import * as asn1js from 'asn1js'; | ||
import Parcel from '../Parcel'; | ||
import { ParcelCollectionAck } from '../ParcelCollectionAck'; | ||
/** | ||
@@ -76,5 +77,9 @@ * Number of octets needed to represent the type and length of an 8 MiB value in DER. | ||
async *deserializeMessages() { | ||
for (const message of this.messages) { | ||
for (const messageSerialized of this.messages) { | ||
const messageFormatSignature = Buffer.from(messageSerialized.slice(0, 10)); | ||
const messageClass = messageFormatSignature.equals(ParcelCollectionAck.FORMAT_SIGNATURE) | ||
? ParcelCollectionAck | ||
: Parcel; | ||
try { | ||
yield Parcel.deserialize(message); | ||
yield messageClass.deserialize(messageSerialized); | ||
} | ||
@@ -81,0 +86,0 @@ catch (error) { |
{ | ||
"name": "@relaycorp/relaynet-core", | ||
"version": "1.25.1", | ||
"version": "1.25.2", | ||
"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
337490
0.41%5053
0.24%