using System.Net; using EnvelopeGenerator.ReceiverUI.Options; using Microsoft.Extensions.Options; namespace EnvelopeGenerator.ReceiverUI.Services; public class AuthService(HttpClient http, IOptions apiOptions) { private readonly ApiOptions _api = apiOptions.Value; /// /// Checks whether the current user holds a valid receiver token for the given envelope key. /// Calls GET /api/auth/check/envelope/{envelopeKey}. /// public async Task CheckEnvelopeAccessAsync(string envelopeKey, CancellationToken cancel = default) { var response = await http.GetAsync($"{_api.BaseUrl}/api/auth/check/envelope/{Uri.EscapeDataString(envelopeKey)}", cancel); return response.StatusCode == HttpStatusCode.OK; } }