Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions cpp/includes/array_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
#include <cstddef>
#include <vector>

namespace discord {
namespace dave {
namespace discord::dave {

template <typename T>
class ArrayView {
Expand Down Expand Up @@ -40,5 +39,4 @@ inline ArrayView<T> MakeArrayView(std::vector<T>& data)
return ArrayView<T>(data.data(), data.size());
}

} // namespace dave
} // namespace discord
} // namespace discord::dave
6 changes: 2 additions & 4 deletions cpp/includes/dave_interfaces.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ struct SignaturePrivateKey;
} // namespace mlspp


namespace discord {
namespace dave {
namespace discord::dave {

using EncryptorStats = DAVEEncryptorStats;
using DecryptorStats = DAVEDecryptorStats;
Expand Down Expand Up @@ -211,5 +210,4 @@ static_assert(DAVE_LOGGING_SEVERITY_WARNING == static_cast<int>(LoggingSeverity:
static_assert(DAVE_LOGGING_SEVERITY_ERROR == static_cast<int>(LoggingSeverity::LS_ERROR));
static_assert(DAVE_LOGGING_SEVERITY_NONE == static_cast<int>(LoggingSeverity::LS_NONE));

} // namespace dave
} // namespace discord
} // namespace discord::dave
6 changes: 2 additions & 4 deletions cpp/src/dave/bindings_wasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@

using namespace emscripten;

namespace discord {
namespace dave {
namespace discord::dave {

val ToOwnedTypedArray(const uint8_t* data, size_t size)
{
Expand Down Expand Up @@ -314,8 +313,7 @@ class DecryptorWrapper {
std::unique_ptr<Decryptor> decryptor_;
};

} // namespace dave
} // namespace discord
} // namespace discord::dave

EMSCRIPTEN_BINDINGS(dave)
{
Expand Down
6 changes: 2 additions & 4 deletions cpp/src/dave/boringssl_cryptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
#include "dave/common.h"
#include "dave/logger.h"

namespace discord {
namespace dave {
namespace discord::dave {

void PrintSSLErrors()
{
Expand Down Expand Up @@ -100,5 +99,4 @@ bool BoringSSLCryptor::Decrypt(ArrayView<uint8_t> plaintextBufferOut,
return decryptResult == 1;
}

} // namespace dave
} // namespace discord
} // namespace discord::dave
6 changes: 2 additions & 4 deletions cpp/src/dave/boringssl_cryptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

#include "dave/cryptor.h"

namespace discord {
namespace dave {
namespace discord::dave {

class BoringSSLCryptor : public ICryptor {
public:
Expand All @@ -29,5 +28,4 @@ class BoringSSLCryptor : public ICryptor {
EVP_AEAD_CTX cipherCtx_;
};

} // namespace dave
} // namespace discord
} // namespace discord::dave
8 changes: 2 additions & 6 deletions cpp/src/dave/codec_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
#include "logger.h"
#include "utils/leb128.h"

namespace discord {
namespace dave {
namespace codec_utils {
namespace discord::dave::codec_utils {

UnencryptedFrameHeaderSize BytesCoveringH264PPS(const uint8_t* payload,
const uint64_t sizeRemaining)
Expand Down Expand Up @@ -439,6 +437,4 @@ bool ValidateEncryptedFrame(OutboundFrameProcessor& processor, ArrayView<uint8_t
return true;
}

} // namespace codec_utils
} // namespace dave
} // namespace discord
} // namespace discord::dave::codec_utils
8 changes: 2 additions & 6 deletions cpp/src/dave/codec_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
#include "common.h"
#include "dave/frame_processors.h"

namespace discord {
namespace dave {
namespace codec_utils {
namespace discord::dave::codec_utils {

bool ProcessFrameOpus(OutboundFrameProcessor& processor, ArrayView<const uint8_t> frame);
bool ProcessFrameVp8(OutboundFrameProcessor& processor, ArrayView<const uint8_t> frame);
Expand All @@ -18,6 +16,4 @@ bool ProcessFrameAv1(OutboundFrameProcessor& processor, ArrayView<const uint8_t>

bool ValidateEncryptedFrame(OutboundFrameProcessor& processor, ArrayView<uint8_t> frame);

} // namespace codec_utils
} // namespace dave
} // namespace discord
} // namespace discord::dave::codec_utils
6 changes: 2 additions & 4 deletions cpp/src/dave/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@

#include "version.h"

namespace discord {
namespace dave {
namespace discord::dave {

using UnencryptedFrameHeaderSize = uint16_t;
using TruncatedSyncNonce = uint32_t;
Expand Down Expand Up @@ -64,5 +63,4 @@ inline std::optional<T> GetOptional(V&& variant)
}
}

} // namespace dave
} // namespace discord
} // namespace discord::dave
6 changes: 2 additions & 4 deletions cpp/src/dave/cryptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
#include "openssl_cryptor.h"
#endif

namespace discord {
namespace dave {
namespace discord::dave {

std::unique_ptr<ICryptor> CreateCryptor(const EncryptionKey& encryptionKey)
{
Expand All @@ -20,5 +19,4 @@ std::unique_ptr<ICryptor> CreateCryptor(const EncryptionKey& encryptionKey)
return cryptor->IsValid() ? std::move(cryptor) : nullptr;
}

} // namespace dave
} // namespace discord
} // namespace discord::dave
6 changes: 2 additions & 4 deletions cpp/src/dave/cryptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

#include "dave_interfaces.h"

namespace discord {
namespace dave {
namespace discord::dave {

class ICryptor {
public:
Expand All @@ -27,5 +26,4 @@ class ICryptor {

std::unique_ptr<ICryptor> CreateCryptor(const EncryptionKey& encryptionKey);

} // namespace dave
} // namespace discord
} // namespace discord::dave
6 changes: 2 additions & 4 deletions cpp/src/dave/cryptor_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@

using namespace std::chrono_literals;

namespace discord {
namespace dave {
namespace discord::dave {

KeyGeneration ComputeWrappedGeneration(KeyGeneration oldest, KeyGeneration generation)
{
Expand Down Expand Up @@ -179,5 +178,4 @@ void CryptorManager::CleanupExpiredCryptors()
}
}

} // namespace dave
} // namespace discord
} // namespace discord::dave
6 changes: 2 additions & 4 deletions cpp/src/dave/cryptor_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
#include "dave/common.h"
#include "utils/clock.h"

namespace discord {
namespace dave {
namespace discord::dave {

KeyGeneration ComputeWrappedGeneration(KeyGeneration oldest, KeyGeneration generation);

Expand Down Expand Up @@ -54,5 +53,4 @@ class CryptorManager {
std::deque<BigNonce> missingNonces_;
};

} // namespace dave
} // namespace discord
} // namespace discord::dave
6 changes: 2 additions & 4 deletions cpp/src/dave/decryptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@

using namespace std::chrono_literals;

namespace discord {
namespace dave {
namespace discord::dave {

constexpr auto kStatsInterval = 10s;

Expand Down Expand Up @@ -239,5 +238,4 @@ void Decryptor::ReturnFrameProcessor(std::unique_ptr<InboundFrameProcessor> fram
frameProcessors_.push_back(std::move(frameProcessor));
}

} // namespace dave
} // namespace discord
} // namespace discord::dave
6 changes: 2 additions & 4 deletions cpp/src/dave/decryptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
#include "frame_processors.h"
#include "utils/clock.h"

namespace discord {
namespace dave {
namespace discord::dave {

class IKeyRatchet;

Expand Down Expand Up @@ -71,5 +70,4 @@ class Decryptor final : public IDecryptor {
std::array<DecryptorStats, 2> stats_;
};

} // namespace dave
} // namespace discord
} // namespace discord::dave
6 changes: 2 additions & 4 deletions cpp/src/dave/encryptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@

using namespace std::chrono_literals;

namespace discord {
namespace dave {
namespace discord::dave {

constexpr auto kStatsInterval = 10s;

Expand Down Expand Up @@ -308,5 +307,4 @@ void Encryptor::UpdateCurrentProtocolVersion(ProtocolVersion version)
}
}

} // namespace dave
} // namespace discord
} // namespace discord::dave
6 changes: 2 additions & 4 deletions cpp/src/dave/encryptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
#include "dave/frame_processors.h"
#include "dave/version.h"

namespace discord {
namespace dave {
namespace discord::dave {

class Encryptor final : public IEncryptor {
public:
Expand Down Expand Up @@ -82,5 +81,4 @@ class Encryptor final : public IEncryptor {
ProtocolVersion currentProtocolVersion_{MaxSupportedProtocolVersion()};
};

} // namespace dave
} // namespace discord
} // namespace discord::dave
6 changes: 2 additions & 4 deletions cpp/src/dave/frame_processors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
#include <intrin.h>
#endif

namespace discord {
namespace dave {
namespace discord::dave {

std::pair<bool, size_t> OverflowAdd(size_t a, size_t b)
{
Expand Down Expand Up @@ -398,5 +397,4 @@ void OutboundFrameProcessor::AddEncryptedBytes(const uint8_t* bytes, size_t size
frameIndex_ += size;
}

} // namespace dave
} // namespace discord
} // namespace discord::dave
6 changes: 2 additions & 4 deletions cpp/src/dave/frame_processors.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
#include "common.h"
#include "dave_interfaces.h"

namespace discord {
namespace dave {
namespace discord::dave {

struct Range {
size_t offset;
Expand Down Expand Up @@ -87,5 +86,4 @@ class OutboundFrameProcessor {
Ranges unencryptedRanges_;
};

} // namespace dave
} // namespace discord
} // namespace discord::dave
6 changes: 2 additions & 4 deletions cpp/src/dave/key_ratchet.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

#include "common.h"

namespace discord {
namespace dave {
namespace discord::dave {

} // namespace dave
} // namespace discord
} // namespace discord::dave
6 changes: 2 additions & 4 deletions cpp/src/dave/logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
#include <cstring>
#include <iostream>

namespace discord {
namespace dave {
namespace discord::dave {

std::atomic<LogSink> gLogSink = nullptr;

Expand Down Expand Up @@ -51,5 +50,4 @@ LogStreamer::~LogStreamer()
}
}

} // namespace dave
} // namespace discord
} // namespace discord::dave
6 changes: 2 additions & 4 deletions cpp/src/dave/logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
#define DISCORD_LOG_FILE_LINE(sev, file, line) ::discord::dave::LogStreamer(sev, file, line)
#define DISCORD_LOG(sev) DISCORD_LOG_FILE_LINE(::discord::dave::sev, __FILE__, __LINE__)
#endif
namespace discord {
namespace dave {
namespace discord::dave {

using LogSink = void (*)(LoggingSeverity severity,
const char* file,
Expand All @@ -36,5 +35,4 @@ class LogStreamer {
std::ostringstream stream_;
};

} // namespace dave
} // namespace discord
} // namespace discord::dave
10 changes: 2 additions & 8 deletions cpp/src/dave/mls/detail/persisted_key_pair.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@

#include "dave/mls/persisted_key_pair.h"

namespace discord {
namespace dave {
namespace mls {
namespace detail {
namespace discord::dave::mls::detail {

std::shared_ptr<::mlspp::SignaturePrivateKey> GetNativePersistedKeyPair(KeyPairContextType ctx,
const std::string& keyID,
Expand All @@ -24,7 +21,4 @@ std::shared_ptr<::mlspp::SignaturePrivateKey> GetGenericPersistedKeyPair(
bool DeleteNativePersistedKeyPair(KeyPairContextType ctx, const std::string& keyID);
bool DeleteGenericPersistedKeyPair(KeyPairContextType ctx, const std::string& keyID);

} // namespace detail
} // namespace mls
} // namespace dave
} // namespace discord
} // namespace discord::dave::mls::detail
8 changes: 2 additions & 6 deletions cpp/src/dave/mls/parameters.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#include "parameters.h"

namespace discord {
namespace dave {
namespace mls {
namespace discord::dave::mls {

::mlspp::CipherSuite::ID CiphersuiteIDForProtocolVersion(
[[maybe_unused]] ProtocolVersion version) noexcept
Expand Down Expand Up @@ -55,6 +53,4 @@ ::mlspp::ExtensionList GroupExtensionsForProtocolVersion(
return extensionList;
}

} // namespace mls
} // namespace dave
} // namespace discord
} // namespace discord::dave::mls
Loading