The wire format reads and writes exactly N bytes for values of this type;
the codec throws on any other length.
N is a literal type, so a plain Uint8Array — whose length is number
— is not assignable here. Use fixedBytes to build one, or the
generated factory for a fixed opaque typedef (sha256Hash(data) and
friends), both of which check the length at runtime so no cast is needed.
A
Uint8Arraythat must contain exactlyNbytes.The wire format reads and writes exactly
Nbytes for values of this type; the codec throws on any other length.Nis a literal type, so a plainUint8Array— whoselengthisnumber— is not assignable here. Use fixedBytes to build one, or the generated factory for a fixed opaque typedef (sha256Hash(data)and friends), both of which check the length at runtime so no cast is needed.