import { Member, type PlatformID } from '@digitaldefiance/ecies-lib'; import { Readable } from '../browserStream'; import { BlockDataType } from '../enumerations/blockDataType'; import { BlockSize } from '../enumerations/blockSize'; import { BlockType } from '../enumerations/blockType'; import { EphemeralBlockMetadata } from '../ephemeralBlockMetadata'; import { IEphemeralBlock } from '../interfaces/blocks/ephemeral'; import { Checksum } from '../types/checksum'; import { BaseBlock } from './base'; import { IEncryptedBlock } from '../interfaces/blocks/encrypted'; /** * Ephemeral blocks are blocks that are not stored on disk, but are either input blocks or reconstituted blocks. * Ephemeral blocks should never be written to disk and are therefore memory-only. */ export declare class EphemeralBlock extends BaseBlock implements IEphemeralBlock { /** * Creates a new ephemeral block. * * Ephemeral blocks represent user data in memory - either input data being * prepared for storage, or reconstituted data read back from the OFF system. * They are NOT padded; padding happens during the whitening/storage process. * * @param type - The block type * @param dataType - The data type * @param blockSize - The block size category (data can be smaller) * @param data - The user data * @param checksum - The checksum of the data * @param creator - The member who created this block * @param dateCreated - When the block was created * @param lengthBeforeEncryption - Original data length (if encrypted) * @param canRead - Whether the block can be read * @param canPersist - Whether the block can be persisted */ static from(type: BlockType, dataType: BlockDataType, blockSize: BlockSize, data: Uint8Array, checksum: Checksum, creator: Member, dateCreated?: Date, lengthBeforeEncryption?: number, canRead?: boolean, canPersist?: boolean): Promise>; /** * The data in the block */ protected readonly _data: Uint8Array; /** * The block creator object */ protected readonly _creator: Member; /** * Create a new ephemeral block. * * Ephemeral blocks represent user data that has been read/reconstituted from * the OFF system. They are NOT padded - padding happens during the whitening * process when data is prepared for storage. * * @param type - The type of the block * @param dataType - The type of data in the block * @param data - The user data (NOT padded) * @param checksum - The checksum of the data * @param metadata - Block metadata including the block size category * @param canRead - Whether the block can be read * @param canPersist - Whether the block can be persisted (defaults to false for ephemeral blocks) */ constructor(type: BlockType, dataType: BlockDataType, data: Uint8Array | Readable, checksum: Checksum, metadata: EphemeralBlockMetadata, canRead?: boolean, canPersist?: boolean); /** * The block's checksum (hash of the user data). * * Note: For ephemeral blocks, this is the checksum of the actual user data, * not a content-addressed block ID. Ephemeral blocks are transient in-memory * representations and don't have persistent IDs in the OFF system sense. * The block only gets a "real" ID after whitening and storage. */ get idChecksum(): Checksum; /** * The data in the block */ get data(): Uint8Array; /** * The date the block was created */ get dateCreated(): Date; /** * The actual data length of the block before any encryption or padding overhead */ get lengthBeforeEncryption(): number; /** * Whether the block can be encrypted */ canEncrypt(): boolean; /** * Whether the block can be encrypted for multiple recipients * @param recipientCount number of recipients * @returns */ canMultiEncrypt(recipientCount: number): boolean; /** * Synchronously validate the block's data and structure * @throws {ChecksumMismatchError} If checksums do not match */ validateSync(): void; /** * Asynchronously validate the block's data and structure * @throws {ChecksumMismatchError} If checksums do not match */ validateAsync(): Promise; /** * The block creator object * Only returns Member creators, not GuidV4 IDs */ get creator(): Member | undefined; get layerOverheadSize(): number; /** * Get this layer's header data */ get layerHeaderData(): Uint8Array; /** * Get the payload data not including headers or padding */ get layerPayload(): Uint8Array; /** * Get the length of the payload not counting padding */ get layerPayloadSize(): number; /** * Encrypt this block using the creator's public key * @param creator The member who will own the encrypted block * @returns A new EncryptedOwnedDataBlock */ encrypt(newBlockType: BlockType, recipients?: Member[]): Promise>; /** * Get the data for this layer, excluding the layer headers of lower-level layers * and including everything to the end of the block. */ get layerData(): Uint8Array; } //# sourceMappingURL=ephemeral.d.ts.map