diff --git a/JsonWebToken.cs b/JsonWebToken.cs
new file mode 100644
index 0000000..606667e
--- /dev/null
+++ b/JsonWebToken.cs
@@ -0,0 +1,121 @@
+using Microsoft.IdentityModel.Tokens;
+using System.IdentityModel.Tokens.Jwt;
+using System.Security.Claims;
+using System.Text;
+using System.Text.Json;
+
+namespace Stella
+{
+ public static class JsonWebToken
+ {
+ private static readonly JwtSecurityTokenHandler TokenHandler = new();
+ private static readonly string secretKey = "i'm not that mean";
+
+ ///
+ /// Generates a JWT with the given claims and expiration.
+ /// Arrays and objects are JSON-serialized; strings are kept as-is.
+ ///
+ public static string Generate(Dictionary claims, TimeSpan expiresIn)
+ {
+ var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(secretKey));
+ var creds = new SigningCredentials(key, SecurityAlgorithms.HmacSha256);
+
+ var jwtClaims = new List();
+ foreach (var pair in claims)
+ {
+ if (pair.Value == null) continue;
+
+ string value;
+
+ if (pair.Value is string s)
+ {
+ value = s;
+ }
+ else if (pair.Value is System.Collections.IEnumerable && pair.Value is not string)
+ {
+ value = JsonSerializer.Serialize(pair.Value);
+ }
+ else
+ {
+ value = JsonSerializer.Serialize(pair.Value);
+ }
+
+ jwtClaims.Add(new Claim(pair.Key, value));
+ }
+
+ var token = new JwtSecurityToken(
+ claims: jwtClaims,
+ expires: DateTime.UtcNow.Add(expiresIn),
+ signingCredentials: creds
+ );
+
+ return TokenHandler.WriteToken(token);
+ }
+
+ ///
+ /// Verifies a JWT. Returns true if valid, false otherwise.
+ ///
+ public static bool Verify(string? token)
+ {
+ if (string.IsNullOrWhiteSpace(token)) return false;
+
+ var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(secretKey));
+ var parameters = new TokenValidationParameters
+ {
+ ValidateIssuer = false,
+ ValidateAudience = false,
+ ValidateLifetime = true,
+ IssuerSigningKey = key,
+ ClockSkew = TimeSpan.FromMinutes(5) // give some leeway
+ };
+
+ try
+ {
+ TokenHandler.ValidateToken(token, parameters, out _);
+ return true;
+ }
+ catch
+ {
+ return false;
+ }
+ }
+
+ ///
+ /// Decodes a JWT without verifying signature.
+ ///
+ public static IDictionary? Decode(string? token)
+ {
+ if (string.IsNullOrWhiteSpace(token)) return null;
+
+ try
+ {
+ var jwt = TokenHandler.ReadJwtToken(token);
+ var payload = new Dictionary();
+
+ foreach (var kv in jwt.Payload)
+ payload[kv.Key] = kv.Value;
+
+ return payload;
+ }
+ catch
+ {
+ return null;
+ }
+ }
+
+ ///
+ /// Verifies and decodes a JWT. Returns null if invalid.
+ ///
+ public static IDictionary? VerifyAndDecode(string? token)
+ {
+ if (string.IsNullOrWhiteSpace(token)) return null;
+
+ if (token.StartsWith("Bearer ", StringComparison.OrdinalIgnoreCase))
+ token = token["Bearer ".Length..];
+
+ if (!Verify(token)) return null;
+
+ return Decode(token);
+ }
+ }
+}
diff --git a/Logs.cs b/Logs.cs
new file mode 100644
index 0000000..eda6fc7
--- /dev/null
+++ b/Logs.cs
@@ -0,0 +1,43 @@
+using System.Text;
+using System.Text.Json;
+
+namespace Stella
+{
+ public static class Logs
+ {
+ private static readonly string webhookUrl = "i'm not that mean";
+
+ public static async Task SendWebhookAsync(string imageName, string? uploadedBy, string? roomName)
+ {
+ var payload = new
+ {
+ content = (string?)null,
+ embeds = new[]
+ {
+ new
+ {
+ description = $"Uploaded by @{uploadedBy}\n\nRoom: {roomName}",
+ color = 16416882,
+ image = new
+ {
+ url = $"https://ns.stellaonline.org/img/{imageName}"
+ },
+ timestamp = DateTime.UtcNow.ToString("o")
+ }
+ },
+ attachments = Array.Empty