main #33

Merged
derek merged 3 commits from main into working 2025-08-22 21:33:36 -07:00
Showing only changes of commit aa5ba4fa17 - Show all commits
+14 -7
View File
@@ -91,16 +91,23 @@ if (IPayment._PaymentType == PaymentType.StripeIntent) {
RsaSecurityKey? PublicKey = null; RsaSecurityKey? PublicKey = null;
using (HttpClient client = new HttpClient()) { using (HttpClient client = new HttpClient()) {
while (PublicKey == null) { while (PublicKey == null) {
HttpResponseMessage PublicKeyResponse = await client.GetAsync("https://auth.mistox.com/api/auth/publickey"); try {
if (PublicKeyResponse.IsSuccessStatusCode) { HttpResponseMessage PublicKeyResponse = await client.GetAsync("https://auth.mistox.com/api/auth/publickey");
string publicKey = await PublicKeyResponse.Content.ReadAsStringAsync(); if (PublicKeyResponse.IsSuccessStatusCode) {
RSA rsa = RSA.Create(); string publicKey = await PublicKeyResponse.Content.ReadAsStringAsync();
rsa.ImportFromPem(publicKey); RSA rsa = RSA.Create();
PublicKey = new RsaSecurityKey(rsa); rsa.ImportFromPem(publicKey);
} else { PublicKey = new RsaSecurityKey(rsa);
} else {
await Task.Delay(2000); // sleep the main thread for 2 seconds before sending another request. Prevent DDOS of my own equiptment
Console.WriteLine("auth.mistox.com returned error code: " + PublicKeyResponse.StatusCode);
}
} catch (Exception e) {
await Task.Delay(2000); // sleep the main thread for 2 seconds before sending another request. Prevent DDOS of my own equiptment await Task.Delay(2000); // sleep the main thread for 2 seconds before sending another request. Prevent DDOS of my own equiptment
Console.WriteLine("Error loading public key: " + e.InnerException?.Message);
} }
} }
Console.WriteLine("PublicKey loaded");
} }
builder.Services.AddAuthentication(options => { builder.Services.AddAuthentication(options => {