using Grpc.Core; namespace Svrnty.CQRS.Altcha.Grpc; /// /// Helper that builds gRPC call metadata (an Authorization header) /// from . Kept as a separate /// shared helper so the verifier and challenge provider apply identical /// rules. /// internal static class AltchaCallCredentials { public static async Task BuildMetadataAsync(AltchaGrpcOptions options, CancellationToken cancellationToken) { if (options.TokenProvider is null) return null; var token = await options.TokenProvider(cancellationToken); if (string.IsNullOrWhiteSpace(token)) return null; return new Metadata { { "Authorization", $"Bearer {token}" } }; } }