• unsnap_biceps 2 hours ago

    Looks pretty cool, however, I'm curious about the usage of a pointer to the key slice. A slice is just two ints and a pointer, so the copy semantics is pretty cheap, and one less pointer for the GC to clean up later.

    Is there some reason why you choose to pass a pointer to the slice?

    • silisili an hour ago

      You're correct about slice semantics but key here is actually a Go array, not a slice. So it's passing a pointer instead of an entire array.

      • unsnap_biceps 9 minutes ago

        Ahh, thank you. Still very new to go :)

    • Xxfireman an hour ago

      “intellectual curiosity of your coworkers demands they base64-parse it.” This is crazy behavior. Creating your own pagination key, assuming it exists, and then putting that in production certainly proves “Hyrum’s law”.

      • njtransit 2 hours ago

        This looks like a very simple wrapper around golang.org/x/crypto/nacl/secretbox

        What’s the point of this?

        • maxbond an hour ago

          To remove/obscure structure from a token so that the structure is not relied upon & can be changed in backwards incompatible ways without disrupting API consumers.

          If you think it's internal details are too simple to justify a dependency, you can vendor or reimplement it, but that's orthogonal to whether it's pointless. The README is pretty detailed & explicit about what the point is.