basic JWK support in crypto SDK (#1058)
Basic JWK serialization of the curves we use for atproto crypto (P-256,
K-256), for public keys only. This will get used in OAuth
implementation.
The decision to implement this directly instead of using something like
https://github.com/lestrrat-go/jwx is entangled with deciding to use
`golang-jwt` for service auth implementation (which is distinct from
OAuth implementation, and doesn't directly require JWKs). I think the
secp256k1 experimental support in `jwx/jwt` would pull in a new
dependency/implementation, and I like our current choice, and it doesn't
seem as easy to wedge in a new curve type/implementation with `jwx`
family of packages.
On the other hand, I sure don't love parsing those uncompressed bytes
out in to `(x, y)` coordinates!
I thought about only exposing `[]byte` JSON instead of the `JWK` struct
itself, but feels more idiomatic and flexible to just expose the struct.
For example, will make it easier for calling code to deal with JWK sets
(arrays of keys, used in OAuth client metadata).
authored by
bnewbold.net
and committed by
GitHub
236dd575
f8de501b