Commit Graph
272 Commits
Author SHA1 Message Date
Nick Bourdakos a08a42077c PR #2404: Add license header to all source files
Imported from GitHub PR https://github.com/google/nearby/pull/2404

Copybara import of the project:

--
a6fbb3c396321c0b9012b787323f5f2ff652fd8f by Nick Bourdakos <bourdakos1@gmail.com>:

Add license header to all source files

Merging this change closes #2404

PiperOrigin-RevId: 623540004
2024-04-10 10:40:38 -07:00
Ryan Hansberry f788b89190 [NearbyPresence] Fix typo: remove extraneous semicolon.
PiperOrigin-RevId: 623198081
2024-04-09 09:54:23 -07:00
Ryan Hansberry f343f4f38b [NearbyPresence] Update FakePresenceService to allow compilation with tests.
PiperOrigin-RevId: 622964231
2024-04-08 15:13:19 -07:00
hai007 734014a841 Add build flag to switch between C++ and rust implemented parser
- Both implementations implement `AdvertisementDecoder` interface and provide the
   concrete implementation for AdvertisementDecoderImpl
 - cleanup missing includes as complained about by clang-tidy

PiperOrigin-RevId: 621187625
2024-04-02 08:43:31 -07:00
hai007 112da5e64a Refactor, remove scan_request dependency from AdvertisementDecoder
- Removes banned_data_types_, PUBLIC identity advertisements will never have
   any corresponding credentials anyways, so decryption will always be skipped
   and this is now guarenteed by asserts in UpdatePublicCredentials
 - Filtering adv based on identity is moved into advertisement Filter which
   already contains the requested identity info from scan_request
 - LegacyPresenceScanFilter is no longer used by AdvertisementDecoder since
   this is not being used anywhere at the moment
 - Cleanup miscellaneous clang-tidy lints about missing or unused includes

PiperOrigin-RevId: 620086399
2024-03-28 16:15:37 -07:00
hai007 b224eb7bf8 Internal change
PiperOrigin-RevId: 619658526
2024-03-27 17:31:38 -07:00
hai007 5bc1c83472 Pure Refactor: move filtering logic into AdvertisementFilter class
- this decouples filtering logic from advertisement decoding logic
   in preparation for introducing a Rust backed impl of
   AdvertisementDecoder
 - this change is only a refactor and does not change functionality
   in any way

PiperOrigin-RevId: 618978564
2024-03-25 15:33:20 -07:00
Suet-Fei Li ed61f4a143 Change std::get back to ansl::get because it is not supported in chromium.
PiperOrigin-RevId: 617252541
2024-03-19 12:10:05 -07:00
Suet-Fei Li 989efcf2c5 Metadata to DeviceIdentityMetaData Migration
PiperOrigin-RevId: 616182462
2024-03-15 10:57:58 -07:00
Francis Tsui a082f36021 Switch glog to absl::log.
PiperOrigin-RevId: 615535748
2024-03-13 14:03:23 -07:00
Chen Wang c74c86694d Create nearby/presence/rust directory
Create the rust directory for Presence Rust codes.
2024-03-12 17:41:15 -07:00
Juliet Levesque f235957345 [Nearby Presence] Authenticate the connection using the DeviceProvider
Once the encryption protocol has been completed successfully, authentication the connection using the registered DeviceProvider from the ClientProxy. For the Nearby Presence MVP, this will be the PresenceDeviceProvider and will only support outgoing connections, which is why the responder role is not used. The result (success or failure) is passed back to callers via the EndpointManager. See go/cros-nearby-presence-np-nc-authentication  for details.

PiperOrigin-RevId: 611255632
2024-02-28 15:51:37 -08:00
Juliet Levesque 5f616fa592 [Nearby Presence] Pass remote device and EndpointManager throughout connection flow
In order to construct the `ConnectionsAuthenticationTransport` and authentication the connection with the `DeviceProvider`, the remote NearbyDevice and EndpointManager used in RequestConnectionV3() must be passed through the encryption protocol as parameters. This CL accomplishes this; it passes the remote NearbyDevice and EndpointManager through a successful encryption flow by introducting new functions to support this V3 protocol. They will be used in a follow up CL to authenticate the connection. See go/cros-nearby-presence-np-nc-authentication  for details.

PiperOrigin-RevId: 610810602
2024-02-27 11:05:52 -08:00
Ryan Hansberry 8561d03a21 [Nearby] CredentialManager: Do not block on main thread.
PiperOrigin-RevId: 608743138
2024-02-20 14:37:12 -08:00
Crisrael Lucero 88064b1543 Remove usage of absl/log/check.h in PresenceDeviceProvider
PiperOrigin-RevId: 607460011
2024-02-15 14:40:02 -08:00
Juliet Levesque fb1f01717f [Nearby Presence] Add authentication status to ConnectionInfo
Adds authentication status to `ConnectionInfo`, which will pass the result of the authentication to clients when the connection is complete. See go/cros-nearby-presence-np-nc-authentication for details. This will be used in follow up CL to communicate the authentication status to clients of RequestConnectionV3().

PiperOrigin-RevId: 606789503
2024-02-13 16:49:49 -08:00
Juliet Levesque caf34a717f [Nearby Presence] Read response data from remote device
see go/cros-nearby-presence-np-nc-authentication for details.

PiperOrigin-RevId: 606772097
2024-02-13 15:50:07 -08:00
Crisrael Lucero 6ad4bf75e2 [Nearby Presence] Use absl/variant instead of std in PresenceDeviceProvider
PiperOrigin-RevId: 604464809
2024-02-05 16:19:52 -08:00
Juliet Levesque e706703def [Nearby Presence] Optimize PresenceFrame proto for lite runtime
Adds a line to optimize the PresenceFrame proto for lite runtime, which is necessary for compilation on ChromeOS

PiperOrigin-RevId: 604404542
2024-02-05 12:48:53 -08:00
Juliet Levesque 58452f4049 [Nearby Presence] Construct Presence Frame and write to remote device
Constructs a Presence frame using BuildSignedMessageAsInitiator() and write to the AuthenticationTransport for authentication. In follow up CL's, authentication protocol will read the message from the remote device and verify it - see go/cros-nearby-presence-np-nc-authentication for details.

PiperOrigin-RevId: 603776791
2024-02-02 17:24:47 -08:00
Juliet Levesque 6b2f7fa94e [Nearby Presence] Fetch and select correct local credentials
Fetch the local credentials and select the correct local credential by verifying the validity of the time. This CL will be followed by
using the selected local credential for authentication. See go/cros-nearby-presence-np-nc-authentication  for details.

PiperOrigin-RevId: 603772266
2024-02-02 17:23:41 -08:00
hai007 e1dd4fd535 Import of rpc://team/beto-rust-devs/beto-rust
PiperOrigin-RevId: 603429939
2024-02-03 01:13:27 +00:00
Juliet Levesque aaa1bea130 [Nearby Presence] Expose API's to fetch local credentials
Expose APIs to fetch local credentials from the CredentialManager, which will be used to fetch a local credential to be used for authentication in follow up CL's. See go/cros-nearby-presence-np-nc-authentication  for details.

PiperOrigin-RevId: 601781066
2024-01-26 09:04:16 -08:00
Crisrael Lucero 41a2821099 Create PresenceDevice constructor that takes in an endpoint ID
PiperOrigin-RevId: 583266968
2023-11-16 22:15:11 -08:00
Juliet Levesque eed80b2891 [Nearby Presence] Cache the manager app id in PresenceDeviceProvider
Cache the manager app id sent in UpdateLocalDeviceMetadata() (which is called
every time the service is started up). The manager app id and the account name (which is stored in the already cached Metadata) is needed to fetch the credentials used during connection authentication.

See [Anay's one pager](https://docs.google.com/document/d/1bffDNH-he4qteN3MxkbUz-P2xFoIniO088sRiTc-kkE/edit?usp=sharing) for more details.

PiperOrigin-RevId: 572067964
2023-10-12 04:48:25 +00:00
Anay Wadhera 71e2555d50 silly season
PiperOrigin-RevId: 563903303
2023-09-08 18:43:14 -07:00
hai007 e186ef6232 Internal refactor
PiperOrigin-RevId: 563205643
2023-09-09 00:12:49 +00:00
Anthony Rueda 96750db706 [Presence] Renamemetadata_encryption_key_tag fields in shared credential proto to differentiate between V0/V1 unsigned adv key tags
PiperOrigin-RevId: 558919544
2023-08-21 15:39:35 -07:00
Joy Babafemi bf78f30792 Modify UwbControleeCapabilities to support multi-chip environment.
PiperOrigin-RevId: 557244065
2023-08-15 14:06:06 -07:00
Joy Babafemi 85bf78ef70 Add sensor fusion implementation to presence C++
PiperOrigin-RevId: 555676715
2023-08-10 15:24:29 -07:00
Janusz Sobczak 5393daf9f1 Merge logging and types build targets
Both "types" and "logging" build targets included "logging.h"
Merging them together avoids circular dependencies.

PiperOrigin-RevId: 555262816
2023-08-09 19:13:12 -07:00
hai007 9c6a11eff1 [NP] Remove metadata creation from FakePresenceClient
To make the nearby_presence_unittests.cc more percise, the test should create the metadata and pass it to the fake client instead of the client creating it.  This change also allows for the unittests to use RunLoop instead of RunUntilIdeal in multiple places.

Bug: b/285015071
PiperOrigin-RevId: 553297388
2023-08-09 19:05:34 -07:00
hai007 b6459434a2 Update ranging interval from update rates.
PiperOrigin-RevId: 553250662
2023-08-10 00:37:35 +00:00
Hai Shang 0e7a8181b0 internal clean up
PiperOrigin-RevId: 551292810
2023-07-26 13:06:09 -07:00
Hai Shang 562483cb44 update sensor fusion api to favor std::optional over absl::optional
PiperOrigin-RevId: 551257674
2023-07-26 11:02:06 -07:00
Joy Babafemi 5b605b2426 Refactor std::function usage to absl::AnyInvocable for ZoneTransitionCallback
PiperOrigin-RevId: 550959839
2023-07-25 12:16:20 -07:00
Anay Wadhera 33faa84aca add shared credential to PresenceDevice.
This field stores the shared credential that this PresenceDevice was decrypted with (if applicable).

PiperOrigin-RevId: 549720833
2023-07-20 13:20:21 -07:00
Crisrael Lucero 0e44ed626d Refactor crypto/ directory into crypto_cros/ and crypto/
PiperOrigin-RevId: 549467911
2023-07-19 17:12:52 -07:00
Anay Wadhera 2dcfe66f2e update device provider api for multi-identity auth
PiperOrigin-RevId: 548767413
2023-07-17 12:30:34 -07:00
Crisrael Lucero 8007e15d86 Use absl::variant in ConnectionAuthenticator
PiperOrigin-RevId: 548173211
2023-07-14 11:13:56 -07:00
Anay Wadhera 770f59b748 Update connection authenticator to account for multi-identity support.
PiperOrigin-RevId: 547880233
2023-07-13 12:18:05 -07:00
Hai Shang 2420c083b8 Add more test coverage for credential manager
PiperOrigin-RevId: 547245712
2023-07-11 11:22:29 -07:00
Crisrael Lucero 001069faa1 Convert std::variant usage to absl::variant
PiperOrigin-RevId: 546987633
2023-07-10 14:43:27 -07:00
Anay Wadhera 6624dd003e Implement NearbyDevice::ToProto() for PresenceDevice
PiperOrigin-RevId: 546372521
2023-07-07 13:40:13 -07:00
Anay Wadhera f830eaddf0 disable rust ldt by default
PiperOrigin-RevId: 546127141
2023-07-06 16:52:17 -07:00
Hai Shang e949d922de Refill creds if needed in getting shared & local creds.
PiperOrigin-RevId: 546093134
2023-07-06 14:28:58 -07:00
Anay Wadhera 4a185d0317 Add NearbyDevice::ToProto() API
PiperOrigin-RevId: 546055852
2023-07-06 12:07:01 -07:00
Anay Wadhera 0bf74cb376 fix asan error in connection authenticator
PiperOrigin-RevId: 545783166
2023-07-05 14:15:37 -07:00
hai007 0b3e42a511 Change PresenceAuthenticationFrame to differentiate two types of credential ID hash.
PiperOrigin-RevId: 544803920
2023-06-30 20:05:33 -07:00
Joy Babafemi f0f0643754 FPPRust - Implement FPP Manager class in C++
PiperOrigin-RevId: 544182126
2023-06-28 15:48:35 -07:00