@mega-yfue/eufy-sdk / unwrapCleanRecordBlob
Function: unwrapCleanRecordBlob()
ts
function unwrapCleanRecordBlob(blob): Uint8Array<ArrayBufferLike> | undefined;Unwrap the vendor's container and hand back the protobuf inside it, or undefined.
The container is 0xAA 0x01, a length, the message, then a two-byte big-endian checksum over every byte before it. The width of the length field is not documented, so rather than assume one, this tries the plausible widths and keeps the one whose checksum verifies — the checksum is the oracle, and a wrong guess about the length fails it rather than producing a plausible wrong message.
That is the whole reason this validates instead of parsing optimistically: a run's statistics that are quietly wrong are worse than statistics a caller could not read.
Parameters
blob
Uint8Array
Returns
Uint8Array<ArrayBufferLike> | undefined