Signing data structures the wrong way

https://blog.foks.pub/posts/domain-separation-in-idl/

Signing data structures the right way | The FOKS Blog

Why not digest the type as part of the hash? This avoids the problem in the article and keeps the transmission size small.

They use a magic number, rather than a digest derived from the schema[1], but otherwise they do as you suggest. The magic number is given to the signing function (sender side) and the validation function (receiver side) but does not increase the size of the transmitted message.

[1]

I think that's what you mean by digest, but maybe you just mean `type` = `magic number`