refactor(crypto): replace byte-slice signing contexts with SigningContext enum
This commit is contained in:
@@ -12,7 +12,7 @@ use crate::{
|
||||
schema::program_client,
|
||||
},
|
||||
};
|
||||
use arbiter_crypto::authn::{self, AuthChallenge, CLIENT_CONTEXT};
|
||||
use arbiter_crypto::authn::{self, AuthChallenge, SigningContext};
|
||||
use arbiter_proto::{
|
||||
ClientMetadata,
|
||||
transport::{Bi, expect_message},
|
||||
@@ -306,7 +306,7 @@ where
|
||||
Error::Transport
|
||||
})?;
|
||||
|
||||
if !pubkey.verify(&challenge, CLIENT_CONTEXT, &signature) {
|
||||
if !pubkey.verify(&challenge, SigningContext::Client, &signature) {
|
||||
error!("Challenge solution verification failed");
|
||||
return Err(Error::InvalidChallengeSolution);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ use crate::{
|
||||
db::{DatabasePool, schema::operator_identity},
|
||||
peers::operator::auth::Outbound,
|
||||
};
|
||||
use arbiter_crypto::authn::{self, AuthChallenge, OPERATOR_CONTEXT};
|
||||
use arbiter_crypto::authn::{self, AuthChallenge, SigningContext};
|
||||
use arbiter_proto::transport::Bi;
|
||||
|
||||
use diesel::{ExpressionMethods as _, OptionalExtension as _, QueryDsl};
|
||||
@@ -141,7 +141,7 @@ where
|
||||
Error::InvalidChallengeSolution
|
||||
})?;
|
||||
|
||||
let valid = pubkey.verify(challenge, OPERATOR_CONTEXT, &signature);
|
||||
let valid = pubkey.verify(challenge, SigningContext::Operator, &signature);
|
||||
|
||||
if !valid {
|
||||
self.transport
|
||||
|
||||
Reference in New Issue
Block a user