refactor(crypto): replace byte-slice signing contexts with SigningContext enum

This commit is contained in:
CleverWild
2026-08-26 13:06:59 +02:00
committed by Skipper
parent f881102f0a
commit a501283b0c
12 changed files with 121 additions and 52 deletions

View File

@@ -336,7 +336,7 @@ impl ProposalManager {
approve: bool,
signature: Vec<u8>,
) -> Result<VoteOutcome, Error> {
use arbiter_crypto::authn::{self, GOVERNANCE_CONTEXT};
use arbiter_crypto::authn::{self, SigningContext};
let mut conn = self.db.get().await?;
@@ -391,7 +391,7 @@ impl ProposalManager {
let auth_sig = authn::Signature::try_from(signature.as_slice())
.map_err(|()| Error::InvalidSignature)?;
if !pubkey.verify_message(&vote_msg, GOVERNANCE_CONTEXT, &auth_sig) {
if !pubkey.verify_message(&vote_msg, SigningContext::GovernanceVote, &auth_sig) {
return Err(Error::InvalidSignature);
}
@@ -537,7 +537,7 @@ impl ProposalManager {
approve: bool,
signature: Vec<u8>,
) -> Result<VoteOutcome, Error> {
use arbiter_crypto::authn::{self, GOVERNANCE_CONTEXT};
use arbiter_crypto::authn::{self, SigningContext};
let mut conn = self.db.get().await?;
@@ -596,7 +596,7 @@ impl ProposalManager {
let auth_sig = authn::Signature::try_from(signature.as_slice())
.map_err(|()| Error::InvalidSignature)?;
if !pubkey.verify_message(&vote_msg, GOVERNANCE_CONTEXT, &auth_sig) {
if !pubkey.verify_message(&vote_msg, SigningContext::GovernanceVote, &auth_sig) {
return Err(Error::InvalidSignature);
}