refactor: use helper method for encrypting ls name

This commit is contained in:
Anna 2022-07-18 17:14:51 -04:00
parent d7dfa0d495
commit a99454a051
1 changed files with 1 additions and 3 deletions

View File

@ -206,9 +206,7 @@ internal class Client : IDisposable {
internal async Task<(Channel, byte[])> Create(string name) {
var shared = SodiumSecretBoxXChaCha20Poly1305.GenerateKey();
var nonce = SodiumSecretBoxXChaCha20Poly1305.GenerateNonce();
var ciphertext = SodiumSecretBoxXChaCha20Poly1305.Create(Encoding.UTF8.GetBytes(name), nonce, shared);
var encryptedName = nonce.Concat(ciphertext);
var encryptedName = SecretBox.Encrypt(shared, Encoding.UTF8.GetBytes(name));
var response = await this.QueueMessageAndWait(new RequestKind.Create(new CreateRequest {
Name = encryptedName,