Page MenuHomePhabricator

[identity] Introduce types for DeviceList DDB table
ClosedPublic

Authored by bartek on Dec 7 2023, 12:02 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Jun 29, 3:04 PM
Unknown Object (File)
Wed, Jun 26, 2:53 AM
Unknown Object (File)
Tue, Jun 25, 1:11 PM
Unknown Object (File)
Tue, Jun 25, 1:11 PM
Unknown Object (File)
Tue, Jun 25, 1:11 PM
Unknown Object (File)
Tue, Jun 25, 1:11 PM
Unknown Object (File)
Tue, Jun 25, 1:10 PM
Unknown Object (File)
Mon, Jun 24, 6:25 PM
Subscribers

Details

Summary

Introduced structs representing rows/items in the identity-devices DDB table.

Depends on D10153

Test Plan

None yet

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bartek held this revision as a draft.
bartek published this revision for review.Dec 7 2023, 1:04 AM
bartek added inline comments.
services/identity/src/constants.rs
69–70 ↗(On Diff #34363)

Used in D10216

services/identity/src/database.rs
52–53 ↗(On Diff #34363)

I've decided to create a submodule of database just not to mess this file more (it has 1.5k lines already and my code is 600 more in total)

services/identity/src/database/device_list.rs
25–33 ↗(On Diff #34363)

Wondering if it wouldn't be better to introduce types like IdentityKeyInfo and PreKey and make this a nested structure:

struct PreKey {
  prekey: String,
  prekey_signature: String
}

struct IdentityKeyInfo {
  key_payload: String,
  key_payload_signature: String,
  social_proof: Option<String>,
}

struct DeviceRow {
  pub user_id: String,
  pub device_id: String,
  pub device_type: DeviceType,
  pub identity_keys: IdentityKeyInfo,
  pub content_prekey: PreKey,
  pub notif_prekey: PreKey,
}

We could use proto-generated types directly, but I found this in our code - probably could reuse this and add From traits for AttributeValue (see two child diffs of this).

From the perspective of DDB structure, this doesn't matter (we're not going to index on keys so no downsides).
What do you think?

varun added inline comments.
services/identity/src/database/device_list.rs
25–33 ↗(On Diff #34363)

nested structure makes sense to me

This revision is now accepted and ready to land.Dec 7 2023, 8:25 PM

Use nested types for prekeys / identity keys