What’s the point of this?
What’s the point of this?
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.
A coin is just a metal disk. A dollar bill is just a piece of paper. Neither of them do anything. After adopting them, you lose control of how your cash is represented. And yet we find them useful.
A simple implementation is a virtue, not an albatross.
For this library, the next best thing would be to make two simple API calls instead of one simple API call. As a cost, this is very low. However, the "next best thing" also has a number of desirable properties compared to this library: better support for custom serialization and a lower attack surface for supply-chain attacks. When you look at the costs vs. the benefits of this library, the utility is negative.
Using your example of currency: a paper bill is not just a piece of paper. It's a piece of paper coupled with the vast machinations of a nation state that can enforce its currency via its monopoly on violence. You can't get all the benefits of a $100 bill just by having a green piece of paper.
It's the same in the original: https://nacl.cr.yp.to/secretbox.html
I had the impression NaCL was about being highly opinionated, so this choice surprised me.
NaCl tends to be faster on hardware without AES acceleration.
Go's AES/GCM implementation is not constant time unless the hardware has AES acceleration.