Skip to content

assertByteLength

assertByteLength(bytes, length, name): Uint8Array

Defined in: ootle/src/helpers/bytes.ts:16

Asserts that bytes has exactly length bytes; otherwise throws with a descriptive message. Returns bytes so the assertion can be used inline in a property initialiser or destructuring expression.

Message format deliberately mirrors the existing stealth-side inline checks (e.g. Mask must be 32 bytes, got 31).

Uint8Array

number

string

Uint8Array

when the length does not match.