Closed sjmerelglobus closed 6 months ago
Use the following code to get the hash:
let hash = try McuMgrImage(data: image.data).hash
Before it was done under the hood, but as support for SUIT files was added, where hash is encoded as CBOR, hash is to be given explicitly. We may think of adding extension helper methods.
@dinesharjani What do you think?
thanks but this should be somewhere documented
Right.
@dinesharjani, why is the has given as a separate parameter? For the sake of SUIT files? They also have the hash inside.
@nysander you are correct. I hope I can get to it today.
As for why, it's because since nRF Connect uses this API, I found that making the hash "magic" made everything more complicated. Also, you can see how the hash should be calculated in the Example app for now. But yes, I should fix the README.
thanks
issue here is that we are not using native envelope but download image data by ourselves and then upload it to the device, so the alternate method to getting hash was missing.
Readme updated.
The FirmwareUpgradeManager.start() method now takes a hash parameter, but it's not explained in the README what kind of hash is expected or how best to calculate it.