mirror of
https://github.com/fluencelabs/js-libp2p-noise
synced 2025-04-25 15:12:32 +00:00
Remove empty lines
This commit is contained in:
parent
4b2091be9f
commit
36a66c59da
@ -7,14 +7,12 @@ interface ReturnEncryptionWrapper {
|
|||||||
|
|
||||||
const maxPlaintextLength = 65519;
|
const maxPlaintextLength = 65519;
|
||||||
|
|
||||||
|
|
||||||
// Returns generator that encrypts payload from the user
|
// Returns generator that encrypts payload from the user
|
||||||
export function encryptStream(handshake: Handshake): ReturnEncryptionWrapper {
|
export function encryptStream(handshake: Handshake): ReturnEncryptionWrapper {
|
||||||
return async function * (source) {
|
return async function * (source) {
|
||||||
for await (const chunk of source) {
|
for await (const chunk of source) {
|
||||||
const chunkBuffer = Buffer.from(chunk);
|
const chunkBuffer = Buffer.from(chunk);
|
||||||
|
|
||||||
|
|
||||||
for (let i = 0; i < chunkBuffer.length; i += maxPlaintextLength) {
|
for (let i = 0; i < chunkBuffer.length; i += maxPlaintextLength) {
|
||||||
let end = i + maxPlaintextLength;
|
let end = i + maxPlaintextLength;
|
||||||
if (end > chunkBuffer.length) {
|
if (end > chunkBuffer.length) {
|
||||||
@ -29,7 +27,6 @@ export function encryptStream(handshake: Handshake): ReturnEncryptionWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Decrypt received payload to the user
|
// Decrypt received payload to the user
|
||||||
export function decryptStream(handshake: Handshake): ReturnEncryptionWrapper {
|
export function decryptStream(handshake: Handshake): ReturnEncryptionWrapper {
|
||||||
return async function * (source) {
|
return async function * (source) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user