feat(client): add CryptoService for login encryption

Implements ICryptoService for encrypting login credentials using RSA-OAEP.
Uses JavaScript interop with browser's native SubtleCrypto API instead of
Blazor.SubtleCrypto package (which only supports AES-GCM, not RSA-OAEP).

- ICryptoService interface in JdeScoping.Client.Services namespace
- CryptoService fetches server's public key once, caches it
- interop.js rsaEncrypt function for RSA-OAEP encryption via Web Crypto API
This commit is contained in:
Joseph Doherty
2026-01-03 08:33:10 -05:00
parent 1c1752a4fd
commit 30153dcbf8
3 changed files with 125 additions and 0 deletions
@@ -0,0 +1,16 @@
using JdeScoping.Core.Models.Auth;
namespace JdeScoping.Client.Services;
/// <summary>
/// Service for encrypting data using server's RSA public key.
/// </summary>
public interface ICryptoService
{
/// <summary>
/// Encrypts login credentials for transmission to server.
/// </summary>
/// <param name="model">Login credentials to encrypt</param>
/// <returns>Base64-encoded encrypted data</returns>
Task<string> EncryptLoginAsync(LoginModel model);
}