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?
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.
Ahh, thank you. Still very new to go :)
“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”.
This looks like a very simple wrapper around golang.org/x/crypto/nacl/secretbox
What’s the point of this?
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.