JSON Web Key (JWK) (de)serialization, generation, and conversion.
Note: requires rustc nightly >= 1.45 for conveniences around fixed-size arrays.
Goals
tl;dr: get keys into a format that can be used by other crates; be as safe as possible while doing so.
Non-goals
```rust extern crate jsonwebtoken as jwt; extern crate jsonwebkey as jwk;
fn main() { let jwkstr = r#"{ "kty": "EC", "d": "ZoKQ9j4dhIBlMRVrv-QG8PT9sutv395eio9MtpgKg", "crv": "P-256", "x": "QOMHmv96tVlJv-uNqprnDSKIj5AiLTXKRomXYnav0N0", "y": "TjYZoHnctatEE6NCrKmXQdJJPnNzZEX8nBmZde3AY4k" }"#; let jwk = jwk::JsonWebKey::fromstr(jwkstr).unwrap(); let encodingkey = jwk::EncodingKey::fromecder(jwk.toder().unwrap()); let token = jwt::encode(&jwt::Header::default(), &() /* claims */, encodingkey).unwrap(); } ```