Skip to content

Commit

Permalink
fix: use proper data for notify pubkey
Browse files Browse the repository at this point in the history
  • Loading branch information
Rakowskiii committed Jul 28, 2023
1 parent 11c6f92 commit 2542682
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/handlers/notify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use {
log::warn,
mongodb::bson::doc,
relay_rpc::{
domain::Topic,
domain::{ClientId, DecodedClientId, Topic},
jwt::{JwtHeader, JWT_HEADER_ALG, JWT_HEADER_TYP},
rpc::{msg_id::MsgId, Publish},
},
Expand Down Expand Up @@ -101,7 +101,8 @@ pub async fn handler(
.await?
.ok_or(error::Error::NoProjectDataForTopic(project_id.clone()))?;

let notify_pubkey = bs58::encode(state.keypair.public_key().as_bytes()).into_string();
let decoded_client_id = DecodedClientId(*state.keypair.public_key().as_bytes());
let notify_pubkey = ClientId::from(decoded_client_id).to_string();
// Generate publish jobs - this will also remove accounts from not_found
// Prepares the encrypted message and gets the topic for each account
let jobs = generate_publish_jobs(
Expand Down Expand Up @@ -325,7 +326,7 @@ fn sign_message(
iat: chrono::Utc::now().timestamp(),
exp: (chrono::Utc::now() + chrono::Duration::seconds(NOTIFY_MSG_TTL as i64))
.timestamp(),
iss: format!("did:key:{}", notify_pubkey),
iss: notify_pubkey.to_string(),
ksu: client_data.ksu.to_string(),
aud: format!("did:pkh:{}", client_data.id),
act: "notify_message".to_string(),
Expand Down

0 comments on commit 2542682

Please sign in to comment.