mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 15:36:12 -04:00
Use credential_id to correlate matched credential back to original
Upon succesfully dectypting an advertisements, the decoding library returns the id of the credential which was used to decrypt. We then use this id to correlate the decoded adv back to the original shared_credential which was used to decrypt it and save this and propagate it in the result returned to the caller PiperOrigin-RevId: 646179759
This commit is contained in:
@@ -29,13 +29,19 @@ namespace presence {
|
||||
// Implements the Rust backed parsing and decrypting of advertisement bytes
|
||||
class AdvertisementDecoderImpl : public AdvertisementDecoder {
|
||||
public:
|
||||
AdvertisementDecoderImpl() : cred_book_(InitializeCredentialBook(nullptr)) {}
|
||||
AdvertisementDecoderImpl()
|
||||
: cred_book_(InitializeCredentialBook(nullptr)),
|
||||
private_credentials_(
|
||||
std::vector<::nearby::internal::SharedCredential>()) {}
|
||||
|
||||
explicit AdvertisementDecoderImpl(
|
||||
absl::flat_hash_map<nearby::internal::IdentityType,
|
||||
std::vector<internal::SharedCredential>>*
|
||||
credentials_map)
|
||||
: cred_book_(InitializeCredentialBook(credentials_map)) {}
|
||||
: cred_book_(InitializeCredentialBook(credentials_map)),
|
||||
private_credentials_(
|
||||
(*credentials_map)
|
||||
[internal::IdentityType::IDENTITY_TYPE_PRIVATE_GROUP]) {}
|
||||
|
||||
absl::StatusOr<Advertisement> DecodeAdvertisement(
|
||||
absl::string_view advertisement) override;
|
||||
@@ -46,6 +52,7 @@ class AdvertisementDecoderImpl : public AdvertisementDecoder {
|
||||
std::vector<::nearby::internal::SharedCredential>>*
|
||||
credentials_map);
|
||||
nearby_protocol::CredentialBook cred_book_;
|
||||
std::vector<::nearby::internal::SharedCredential> private_credentials_;
|
||||
};
|
||||
|
||||
} // namespace presence
|
||||
|
||||
Reference in New Issue
Block a user