Skip to main content
Module

x/earthstar/src/syncer/message_crypto.ts>DecryptLengthDelimitStream

Storage for private, distributed, offline-first applications.
Go to Latest
class DecryptLengthDelimitStream
import { DecryptLengthDelimitStream } from "https://deno.land/x/earthstar@v10.2.2/src/syncer/message_crypto.ts";

Given a stream of potentially multiple and / or truncated chunks with an encrypted length delimiter, finds encrypted length delimiters and uses that to enqueue discrete chunks

Constructors

new
DecryptLengthDelimitStream(derivedKey: CryptoKey)

Properties

private
carryOver: UnfinishedLength | UnfinishedMessage | null
private
derivedKey: CryptoKey
private
transform: TransformStream<Uint8Array, Uint8Array>
readable: ReadableStream<Uint8Array>
writable: WritableStream<Uint8Array>

Methods

private
delimit(
newBytes: Uint8Array,
carryOver: UnfinishedLength | UnfinishedMessage | null,
enqueue: (bytes: Uint8Array) => void,
)
private
getCarryOver()
private
getLength(bytes: Uint8Array): Promise<{ length: number; leftover: Uint8Array; } | false>
private
setCarryOver(carryOver: UnfinishedLength | UnfinishedMessage | null)