feat: establish dotnet engineering foundation

This commit is contained in:
2026-07-27 15:00:14 +08:00
parent 60a376ea0b
commit 28e9a9fa41
36 changed files with 17301 additions and 89 deletions

View File

@@ -4,11 +4,14 @@ using Tiku.Application.Growth;
using Tiku.Domain.Common;
using Tiku.Domain.Growth;
using Tiku.Domain.Tenancy;
using Tiku.Infrastructure.Commerce;
using Tiku.Infrastructure.Persistence;
namespace Tiku.Infrastructure.Growth;
public sealed class CrmService(TikuDbContext dbContext) : ICrmService
internal sealed class CrmService(
TikuDbContext dbContext,
ITenantSecretProtector tenantSecretProtector) : ICrmService
{
private static readonly HashSet<string> SensitiveKeys = new(StringComparer.OrdinalIgnoreCase)
{
@@ -254,8 +257,15 @@ public sealed class CrmService(TikuDbContext dbContext) : ICrmService
item.RotatedAt = DateTimeOffset.UtcNow;
}
var protectedPayload = tenantSecretProtector.Protect(
tenantId,
secretRef,
JsonSerializer.SerializeToElement(new { webhookSecret = secret }));
item.Status = TenantSecretStatus.Active;
item.SecretPayload = JsonSerializer.SerializeToElement(new { webhookSecret = secret });
item.EncryptionKeyId = protectedPayload.KeyId;
item.EncryptedPayload = protectedPayload.Ciphertext;
item.EncryptionNonce = protectedPayload.Nonce;
item.EncryptionTag = protectedPayload.Tag;
}
private async Task AssertAdminAsync(CrmAdminActor actor, CancellationToken cancellationToken)