fake_fast_pair_data_encryptor.cc 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Copyright 2021 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "ash/quick_pair/fast_pair_handshake/fake_fast_pair_data_encryptor.h"
  5. namespace ash {
  6. namespace quick_pair {
  7. FakeFastPairDataEncryptor::FakeFastPairDataEncryptor() = default;
  8. FakeFastPairDataEncryptor::~FakeFastPairDataEncryptor() = default;
  9. const std::array<uint8_t, kBlockSizeBytes>
  10. FakeFastPairDataEncryptor::EncryptBytes(
  11. const std::array<uint8_t, kBlockSizeBytes>& bytes_to_encrypt) {
  12. return encrypted_bytes_;
  13. }
  14. const absl::optional<std::array<uint8_t, 64>>&
  15. FakeFastPairDataEncryptor::GetPublicKey() {
  16. return public_key_;
  17. }
  18. void FakeFastPairDataEncryptor::ParseDecryptedResponse(
  19. const std::vector<uint8_t>& encrypted_response_bytes,
  20. base::OnceCallback<void(const absl::optional<DecryptedResponse>&)>
  21. callback) {
  22. std::move(callback).Run(response_);
  23. }
  24. void FakeFastPairDataEncryptor::ParseDecryptedPasskey(
  25. const std::vector<uint8_t>& encrypted_passkey_bytes,
  26. base::OnceCallback<void(const absl::optional<DecryptedPasskey>&)>
  27. callback) {
  28. std::move(callback).Run(passkey_);
  29. }
  30. } // namespace quick_pair
  31. } // namespace ash