#include #include namespace larra::xmpp::client { constexpr std::string_view kUsername = "test1"; constexpr std::string_view kPassword = "test1"; constexpr std::string_view kClientNonce = "jzabxxqWYZEmuM9pRq7JR4VQ"; constexpr std::string_view kServerNonce = "jzabxxqWYZEmuM9pRq7JR4VQ65tCij07kpOM2/+obhuYEQ=="; constexpr std::string_view kServerFirst = "r=jzabxxqWYZEmuM9pRq7JR4VQ65tCij07kpOM2/+obhuYEQ==," "s=cTJBDYBtebLYSyDKwIut5w==,i=4096"; const std::string kSalt = DecodeBase64("cTJBDYBtebLYSyDKwIut5w=="); constexpr std::string_view kClientFirst = "n=test1,r=jzabxxqWYZEmuM9pRq7JR4VQ"; constexpr int kIterations = 4096; constexpr std::string_view kExpectedDataNoBase64 = "c=biws,r=jzabxxqWYZEmuM9pRq7JR4VQ65tCij07kpOM2/+obhuYEQ==,p=Xpco7kbX/I0OQ7ubCScmCdG1Nml2QBIJw4dp2jdJl9bNq2Uny43CQ88zrCvfBnJuLdXM/" "kw8VBzb6oy6BkRdog=="; constexpr sha512sum::EncryptionTag kTag{}; auto ToUnsignedCharStringView(auto& range) -> UnsignedStringView { return {new(range.data()) unsigned char[range.size()], range.size()}; }; TEST(SCRAM, SHA512) { auto data = GenerateScramAuthMessage(kUsername, kSalt, kServerNonce, kServerFirst, kClientFirst, kIterations, kTag); EXPECT_EQ(data, kExpectedDataNoBase64); } } // namespace larra::xmpp::client