Add initial pairing in scalable seeker

PiperOrigin-RevId: 541034178
This commit is contained in:
Janusz Sobczak
2023-06-16 16:14:14 -07:00
committed by Copybara-Service
parent 4914cbc2f9
commit 20acd4eeb9
10 changed files with 284 additions and 33 deletions
@@ -46,11 +46,17 @@ void FakeFastPairRepository::GetDeviceMetadata(
std::unique_ptr<FakeFastPairRepository> FakeFastPairRepository::Create(
absl::string_view model_id, absl::string_view public_anti_spoof_key) {
std::string decoded_key;
absl::Base64Unescape(public_anti_spoof_key, &decoded_key);
proto::Device metadata;
auto repository = std::make_unique<FakeFastPairRepository>();
metadata.mutable_anti_spoofing_key_pair()->set_public_key(decoded_key);
if (public_anti_spoof_key.length() == kPublicKeyByteSize) {
metadata.mutable_anti_spoofing_key_pair()->set_public_key(
public_anti_spoof_key);
} else {
std::string decoded_key;
absl::Base64Unescape(public_anti_spoof_key, &decoded_key);
CHECK_EQ(decoded_key.length(), kPublicKeyByteSize);
metadata.mutable_anti_spoofing_key_pair()->set_public_key(decoded_key);
}
repository->SetFakeMetadata(model_id, metadata);
return repository;
}