forked from alemi/upub
fix: oh yes that was it! now digest
This commit is contained in:
parent
21db907e17
commit
b37d799f59
1 changed files with 2 additions and 2 deletions
|
@ -96,7 +96,7 @@ async fn worker(db: DatabaseConnection, domain: String, poll_interval: u64) -> R
|
|||
|
||||
async fn deliver(key: &PKey<Private>, to: &str, from: &str, payload: serde_json::Value, domain: &str) -> Result<(), UpubError> {
|
||||
let payload = serde_json::to_string(&payload).unwrap();
|
||||
let digest = format!("sha-256={}", base64::prelude::BASE64_URL_SAFE.encode(openssl::sha::sha256(payload.as_bytes())));
|
||||
let digest = format!("sha-256={}", base64::prelude::BASE64_STANDARD.encode(openssl::sha::sha256(payload.as_bytes())));
|
||||
let host = Context::server(to);
|
||||
let date = chrono::Utc::now().format("%a, %d %b %Y %H:%M:%S GMT").to_string(); // lmao @ "GMT"
|
||||
let path = to.replace("https://", "").replace("http://", "").replace(&host, "");
|
||||
|
@ -131,7 +131,7 @@ async fn deliver(key: &PKey<Private>, to: &str, from: &str, payload: serde_json:
|
|||
tracing::info!("signing:\n{to_sign}");
|
||||
let mut signer = Signer::new(MessageDigest::sha256(), key)?;
|
||||
signer.update(to_sign.as_bytes())?;
|
||||
let signature = base64::prelude::BASE64_URL_SAFE.encode(signer.sign_to_vec()?);
|
||||
let signature = base64::prelude::BASE64_STANDARD.encode(signer.sign_to_vec()?);
|
||||
format!("keyId=\"{from}#main-key\",algorithm=\"rsa-sha256\",headers=\"(request-target) host date digest\",signature=\"{signature}\"")
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue