Always send RSA256-signed requests
This commit is contained in:
parent
e21c5a8132
commit
553dbb9b7b
|
@ -3,16 +3,17 @@ use std::{fmt::Display, sync::Arc};
|
|||
use chrono::Utc;
|
||||
use http::{HeaderMap, HeaderName, HeaderValue, Method};
|
||||
use indexmap::IndexSet;
|
||||
use magnetar_core::web_model::content_type::ContentActivityStreams;
|
||||
use serde_json::Value;
|
||||
use sha2::Digest;
|
||||
use thiserror::Error;
|
||||
use url::Url;
|
||||
|
||||
use magnetar_core::web_model::content_type::ContentActivityStreams;
|
||||
|
||||
use crate::{
|
||||
client::federation_client::{FederationClient, FederationClientError},
|
||||
crypto::{ApSigningError, ApSigningKey, SigningAlgorithm},
|
||||
ApClientService, ApSignature, ApSigningField, ApSigningHeaders, SigningInput, SigningParts,
|
||||
ApClientService,
|
||||
ApSignature,
|
||||
ApSigningField, ApSigningHeaders, client::federation_client::{FederationClient, FederationClientError}, crypto::{ApSigningError, ApSigningKey, SigningAlgorithm}, SigningInput, SigningParts,
|
||||
};
|
||||
|
||||
pub struct ApClientServiceDefaultProvider {
|
||||
|
@ -413,9 +414,9 @@ mod test {
|
|||
|
||||
use crate::{
|
||||
ap_client::ApClientServiceDefaultProvider,
|
||||
ApClientService,
|
||||
client::federation_client::FederationClient,
|
||||
crypto::{ApHttpPrivateKey, SigningAlgorithm},
|
||||
ApClientService,
|
||||
};
|
||||
|
||||
#[tokio::test]
|
||||
|
@ -427,7 +428,12 @@ mod test {
|
|||
let rsa_key = rsa::RsaPrivateKey::from_pkcs8_pem(key.trim()).into_diagnostic()?;
|
||||
let ap_client = ApClientServiceDefaultProvider {
|
||||
client: Arc::new(
|
||||
FederationClient::new(true, 128_000, 25, UserAgent::from_static("magnetar/0.42"))
|
||||
FederationClient::new(
|
||||
true,
|
||||
128_000,
|
||||
25,
|
||||
UserAgent::from_static("magnetar/0.42 (https://astolfo.social)"),
|
||||
)
|
||||
.into_diagnostic()?,
|
||||
),
|
||||
};
|
||||
|
@ -435,9 +441,9 @@ mod test {
|
|||
let val = ap_client
|
||||
.signed_get(
|
||||
ApHttpPrivateKey::Rsa(Box::new(Cow::Owned(rsa_key)))
|
||||
.create_signing_key(&key_id, SigningAlgorithm::Hs2019)
|
||||
.create_signing_key(&key_id, SigningAlgorithm::RsaSha256)
|
||||
.into_diagnostic()?,
|
||||
SigningAlgorithm::Hs2019,
|
||||
SigningAlgorithm::RsaSha256,
|
||||
None,
|
||||
&url,
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue