[Feature request] Add SRI hash alongside sha256 hash
yae currently provides a sha256 hash for its tracked programs. While this works, most packages today prefer using SRI hashes which can be obtained with the nix store prefetch-file command.
Could a hash field be added to the schema? While not a deal breaker, it'd be nice for consistency's sake.
This can be achieved with the nix hash suite of sub-commands given the current implementation.
At present, Yae uses nix-prefetch-url internally to get the initial SHA-256 hash, so adding a call to nix hash convert would be the most straightforward solution.
I occasionally observed extended double fetches when testing both nix-prefetch-url and nix store prefetch-file in sequence, and this solution would also avoid having to (pre-) fetch the file again, taking twice the time for the second hash in certain cases.
$ nix store prefetch-file --hash-type sha256 --unpack "https://github.com/Fuwn/yae/archive/main.tar.gz"
Downloaded 'https://github.com/Fuwn/yae/archive/main.tar.gz' to '/nix/store/kkr73ar848jqyfjwqy3g1xdca4lakiiq-main.tar.gz' (hash 'sha256-Afoxw2+Wjn7zUmtmOBH4+JtsVEdLBO0+3Mzm14/8gYk=').
$ nix-prefetch-url --unpack https://github.com/Fuwn/yae/archive/main.tar.gz
path is '/nix/store/kkr73ar848jqyfjwqy3g1xdca4lakiiq-main.tar.gz'
12c1zj7xgrncvhzfs12b8xa6r6zqz08khrkbabrpx3lndz1k3yh1
$ nix hash convert --hash-algo sha256 --from nix32 12c1zj7xgrncvhzfs12b8xa6r6zqz08khrkbabrpx3lndz1k3yh1
sha256-Afoxw2+Wjn7zUmtmOBH4+JtsVEdLBO0+3Mzm14/8gYk=
I'll look into adding this functionality shortly.
Commit https://github.com/Fuwn/yae/commit/af8d47f92af62917ea2f8fe800782374225d36bc closes this feature request.