You've already forked authentication-service
mirror of
https://github.com/matrix-org/matrix-authentication-service.git
synced 2025-07-29 22:01:14 +03:00
Add variants for unknown values on mas-iana types
Remove the Copy derive and mark enums as non-exhaustive.
This commit is contained in:
committed by
Quentin Gliech
parent
9e3b3567b2
commit
80d317f23c
@ -415,7 +415,7 @@ impl PrivateKey {
|
||||
/// Returns an error if the key is not suited for the selected algorithm
|
||||
pub fn verifying_key_for_alg(
|
||||
&self,
|
||||
alg: JsonWebSignatureAlg,
|
||||
alg: &JsonWebSignatureAlg,
|
||||
) -> Result<AsymmetricVerifyingKey, WrongAlgorithmError> {
|
||||
let key = match (self, alg) {
|
||||
(Self::Rsa(key), _) => {
|
||||
@ -469,7 +469,7 @@ impl PrivateKey {
|
||||
/// Returns an error if the key is not suited for the selected algorithm
|
||||
pub fn signing_key_for_alg(
|
||||
&self,
|
||||
alg: JsonWebSignatureAlg,
|
||||
alg: &JsonWebSignatureAlg,
|
||||
) -> Result<AsymmetricSigningKey, WrongAlgorithmError> {
|
||||
let key = match (self, alg) {
|
||||
(Self::Rsa(key), _) => {
|
||||
|
@ -33,8 +33,8 @@ macro_rules! plain_test {
|
||||
let algs = key.possible_algs();
|
||||
assert_ne!(algs.len(), 0);
|
||||
|
||||
for &alg in algs {
|
||||
let header = JsonWebSignatureHeader::new(alg);
|
||||
for alg in algs {
|
||||
let header = JsonWebSignatureHeader::new(alg.clone());
|
||||
let payload = "hello";
|
||||
let signer = key.signing_key_for_alg(alg).unwrap();
|
||||
let jwt = Jwt::sign(header, payload, &signer).unwrap();
|
||||
@ -58,8 +58,8 @@ macro_rules! enc_test {
|
||||
let algs = key.possible_algs();
|
||||
assert_ne!(algs.len(), 0);
|
||||
|
||||
for &alg in algs {
|
||||
let header = JsonWebSignatureHeader::new(alg);
|
||||
for alg in algs {
|
||||
let header = JsonWebSignatureHeader::new(alg.clone());
|
||||
let payload = "hello";
|
||||
let signer = key.signing_key_for_alg(alg).unwrap();
|
||||
let jwt = Jwt::sign(header, payload, &signer).unwrap();
|
||||
|
Reference in New Issue
Block a user