WIP making ClientCreate endpoint

This commit is contained in:
eelke 2026-02-20 17:35:38 +01:00
parent 138f335af0
commit eb872a4f44
28 changed files with 365 additions and 121 deletions

View file

@ -3,7 +3,7 @@ using IdentityShroud.Core.Model;
namespace IdentityShroud.Core.Tests.Model;
public class KeyTests
public class RealmKeyTests
{
[Fact]
public void SetNewKey()
@ -16,12 +16,12 @@ public class KeyTests
.Encrypt(Arg.Any<byte[]>())
.Returns(x => encryptedPrivateKey);
Key key = new();
key.SetPrivateKey(encryptionService, privateKey);
RealmKey realmKey = new();
realmKey.SetPrivateKey(encryptionService, privateKey);
// should be able to return original without calling decrypt
Assert.Equal(privateKey, key.GetPrivateKey(encryptionService));
Assert.Equal(encryptedPrivateKey, key.PrivateKeyEncrypted);
Assert.Equal(privateKey, realmKey.GetPrivateKey(encryptionService));
Assert.Equal(encryptedPrivateKey, realmKey.PrivateKeyEncrypted);
encryptionService.Received(1).Encrypt(privateKey);
encryptionService.DidNotReceive().Decrypt(Arg.Any<byte[]>());
@ -38,12 +38,12 @@ public class KeyTests
.Decrypt(encryptedPrivateKey)
.Returns(x => privateKey);
Key key = new();
key.PrivateKeyEncrypted = encryptedPrivateKey;
RealmKey realmKey = new();
realmKey.PrivateKeyEncrypted = encryptedPrivateKey;
// should be able to return original without calling decrypt
Assert.Equal(privateKey, key.GetPrivateKey(encryptionService));
Assert.Equal(encryptedPrivateKey, key.PrivateKeyEncrypted);
Assert.Equal(privateKey, realmKey.GetPrivateKey(encryptionService));
Assert.Equal(encryptedPrivateKey, realmKey.PrivateKeyEncrypted);
encryptionService.Received(1).Decrypt(encryptedPrivateKey);
}