struct ChunkNoncePayload @0xadba174b7e8dcc08 {
id @0 : lib.FileID;
offset @1 : lib.Offset;
final @2 : Bool;
}
And the following Go code for making a nonce for encrypting a chunk of a large file: pld := lcl.ChunkNoncePayload{
Id: fid,
Offset: offset,
Final: isFinal,
}
hsh, err := core.PrefixedHash(&pld)
if err != nil {
return nil, err
}
var ret [24]byte
copy(ret[:], (\*hsh)[0:24])
return &ret, nil
As in signing, it's nice to know this nonce won't conflict with some other nonce for a different data type, and the domain separation in the IDL guarantees that.