forked from gongxuegit/tiku-backend.net
feat: establish dotnet engineering foundation
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user