private async Task SetKeys(string seedString) { if (Keys.Init) { return; } if (string.IsNullOrEmpty(seedString)) { throw new WebSocketError("Missing seed", Session.Username); } if (Keys.Salts == null) { throw new WebSocketError("Missing salts", Session.Username); } if (string.IsNullOrEmpty(_seedString)) { _seedString = seedString; } var seed = Convert.FromBase64String(seedString); Keys.EncryptionKey = AesGcmUtils.ImportKeyFromMaster(seed, Convert.FromBase64String(Keys.Salts.EncryptionKeySalt)); Keys.DhPrivateKey = DiffieHellmanUtils.ImportKeyFromMaster(seed, Convert.FromBase64String(Keys.Salts.DhKeySalt)); Keys.HmacKey = HmacUtils.ImportKeyFromMaster(seed, Convert.FromBase64String(Keys.Salts.HmacKeySalt)); await ValidateKey(); Keys.Init = true; _resolveConnection?.Invoke(); _connectionResolved = true; }