From 8e84d21ad9e024510696111c136e3a020b32e862 Mon Sep 17 00:00:00 2001 From: Richard Barnes Date: Sun, 10 Sep 2023 21:29:08 -0400 Subject: [PATCH] clang-format --- include/mls/credential.h | 11 +++++++---- include/mls/crypto.h | 3 ++- src/credential.cpp | 22 ++++++++++++++-------- test/crypto.cpp | 3 ++- 4 files changed, 25 insertions(+), 14 deletions(-) diff --git a/include/mls/credential.h b/include/mls/credential.h index 2019aa3d..be0c213e 100644 --- a/include/mls/credential.h +++ b/include/mls/credential.h @@ -7,7 +7,7 @@ namespace MLS_NAMESPACE { namespace hpke { - struct UserInfoVC; +struct UserInfoVC; } // struct { @@ -68,10 +68,13 @@ struct UserInfoVCCredential bool valid_for(const SignaturePublicKey& pub) const; bool valid_from(const PublicJWK& pub) const; - friend tls::ostream operator<<(tls::ostream& str, const UserInfoVCCredential& obj); + friend tls::ostream operator<<(tls::ostream& str, + const UserInfoVCCredential& obj); friend tls::istream operator>>(tls::istream& str, UserInfoVCCredential& obj); - friend bool operator==(const UserInfoVCCredential& lhs, const UserInfoVCCredential& rhs); - friend bool operator!=(const UserInfoVCCredential& lhs, const UserInfoVCCredential& rhs); + friend bool operator==(const UserInfoVCCredential& lhs, + const UserInfoVCCredential& rhs); + friend bool operator!=(const UserInfoVCCredential& lhs, + const UserInfoVCCredential& rhs); private: std::shared_ptr _vc; diff --git a/include/mls/crypto.h b/include/mls/crypto.h index 3087bed6..ccb78e7a 100644 --- a/include/mls/crypto.h +++ b/include/mls/crypto.h @@ -227,7 +227,8 @@ struct SignaturePublicKey TLS_SERIALIZABLE(data) }; -struct PublicJWK { +struct PublicJWK +{ SignatureScheme signature_scheme; std::optional key_id; SignaturePublicKey public_key; diff --git a/src/credential.cpp b/src/credential.cpp index 370b985d..36b10629 100644 --- a/src/credential.cpp +++ b/src/credential.cpp @@ -118,7 +118,8 @@ operator==(const X509Credential& lhs, const X509Credential& rhs) UserInfoVCCredential::UserInfoVCCredential(std::string userinfo_vc_jwt_in) : userinfo_vc_jwt(std::move(userinfo_vc_jwt_in)) , _vc(std::make_shared(userinfo_vc_jwt)) -{} +{ +} bool // NOLINTNEXTLINE(readability-convert-member-functions-to-static) @@ -140,28 +141,33 @@ UserInfoVCCredential::valid_from(const PublicJWK& pub) const return _vc->valid_from(*sig_pub); } -tls::ostream operator<<(tls::ostream& str, const UserInfoVCCredential& obj) { +tls::ostream +operator<<(tls::ostream& str, const UserInfoVCCredential& obj) +{ return str << from_ascii(obj.userinfo_vc_jwt); } -tls::istream operator>>(tls::istream& str, UserInfoVCCredential& obj) { +tls::istream +operator>>(tls::istream& str, UserInfoVCCredential& obj) +{ auto jwt = bytes{}; str >> jwt; obj = UserInfoVCCredential(to_ascii(jwt)); return str; } -bool operator==(const UserInfoVCCredential& lhs, const UserInfoVCCredential& rhs) { +bool +operator==(const UserInfoVCCredential& lhs, const UserInfoVCCredential& rhs) +{ return lhs.userinfo_vc_jwt == rhs.userinfo_vc_jwt; } -bool operator!=(const UserInfoVCCredential& lhs, const UserInfoVCCredential& rhs) { +bool +operator!=(const UserInfoVCCredential& lhs, const UserInfoVCCredential& rhs) +{ return !(lhs == rhs); } - - - /// /// CredentialBinding and MultiCredential /// diff --git a/test/crypto.cpp b/test/crypto.cpp index 5f1d251c..393a0a04 100644 --- a/test/crypto.cpp +++ b/test/crypto.cpp @@ -117,7 +117,8 @@ TEST_CASE("Signature Key JWK Import/Export") const auto known_scheme = SignatureScheme::ed25519; const auto known_key_id = std::string("059fc2ee-5ef6-456a-91d8-49c422c772b2"); - const auto knwon_pub_data = from_hex("9a2963aa2940655db2164a88061af186fb76c0832f3ed90d105ceece21063ad2"); + const auto knwon_pub_data = from_hex( + "9a2963aa2940655db2164a88061af186fb76c0832f3ed90d105ceece21063ad2"); const auto jwk = PublicJWK::parse(full_jwk); REQUIRE(jwk.signature_scheme == known_scheme);