refactor: use helper method for encrypting ls name
This commit is contained in:
parent
d7dfa0d495
commit
a99454a051
|
@ -206,9 +206,7 @@ internal class Client : IDisposable {
|
||||||
|
|
||||||
internal async Task<(Channel, byte[])> Create(string name) {
|
internal async Task<(Channel, byte[])> Create(string name) {
|
||||||
var shared = SodiumSecretBoxXChaCha20Poly1305.GenerateKey();
|
var shared = SodiumSecretBoxXChaCha20Poly1305.GenerateKey();
|
||||||
var nonce = SodiumSecretBoxXChaCha20Poly1305.GenerateNonce();
|
var encryptedName = SecretBox.Encrypt(shared, Encoding.UTF8.GetBytes(name));
|
||||||
var ciphertext = SodiumSecretBoxXChaCha20Poly1305.Create(Encoding.UTF8.GetBytes(name), nonce, shared);
|
|
||||||
var encryptedName = nonce.Concat(ciphertext);
|
|
||||||
|
|
||||||
var response = await this.QueueMessageAndWait(new RequestKind.Create(new CreateRequest {
|
var response = await this.QueueMessageAndWait(new RequestKind.Create(new CreateRequest {
|
||||||
Name = encryptedName,
|
Name = encryptedName,
|
||||||
|
|
Loading…
Reference in New Issue