Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SK-246 added device_id field for encryption device record #129

Merged
merged 2 commits into from
Aug 23, 2024

Conversation

Oleksandr1414
Copy link
Collaborator

  • delete an encryption record for a device with a user logout request

@IgorKhomenko
Copy link
Contributor

IgorKhomenko commented Aug 22, 2024

So we have a device_id field now.

I propose to integrate it further:

  1. when list own devices, return device_id field instead of id
  2. when delete device, also pass device_id instead of id
  3. when list other user's keys - also return device_id instead of id

With this changes, it will be more consistent and users do not need to think what to use - device_id or id field.

Also, this index could be updated from

await db.collection("encrypted_devices").createIndex({ user_id: 1, identity_key: 1 }, { unique: true })

to

await db.collection("encrypted_devices").createIndex({ user_id: 1, device_id: 1 }, { unique: true })

Also, I see we have this request now const device = await this.findOne({ device_id }),
so it worth adding another index await db.collection("encrypted_devices").createIndex({ device_id: 1 }) so the query will be fast

WDYT?

@Oleksandr1414 Oleksandr1414 merged commit 6290a9b into encryption Aug 23, 2024
@Oleksandr1414 Oleksandr1414 deleted the SK-246-add-device-id branch August 23, 2024 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants