You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All of the backend infrastructure was in place to support &[u8],
and some functions already take `impl AsRef<[u8]>`. However the
main decode() and decode_header() functions require a &str. This
change updates a few internal signatures and adds a _bytes()
version of decode and decode_header.
When you're doing many requests per second, the cost of doing
an extra utf-8 check over header payloads is significant. By
supporting a &[u8] decode, users can let base64 and the crypto
implementation in question handle its own bytewise validity. They
already do this today in addition to the extra utf-8 scan.
let token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ";
24
+
let token = b"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ";
22
25
let key = DecodingKey::from_secret("secret".as_ref());
0 commit comments