• BorgDrone
    link
    fedilink
    arrow-up
    2
    ·
    4 hours ago

    Why even bother with things like strings for a salt? I would expect it to just take a byte array. Just create some random bytes and provide that.

    • frezik@midwest.social
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      2 hours ago

      Yeah, that’s my thinking, too. But the library only takes b64.

      Edit: also, if anything, this system reduces the benefit of strong typing. You can feed whatever string you want into it and the compiler will say it’s OK, even if it would fail at run time. If it were a Vec<u8>, then the compiler can check things. Especially if you do something to let the compiler enforce the length (if possible).

      Or hand over a UUID object directly. Yeah, it ties it to a specific library, but it’s either that or you’re not taking full advantage of strong typing.

      Or just have a sensible default implementation.