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

Add device info records #182

Closed
3 tasks done
Tracked by #204
gmaclennan opened this issue Aug 16, 2023 · 2 comments
Closed
3 tasks done
Tracked by #204

Add device info records #182

gmaclennan opened this issue Aug 16, 2023 · 2 comments
Assignees

Comments

@gmaclennan
Copy link
Member

gmaclennan commented Aug 16, 2023

Description

The purpose of a device info record is to store metadata about a particular device. Currently this is a human-friendly name. In the future we might want to add additional metadata based on user requirements.

The device info records should be stored in the 'config' namespace so that they are not readable by someone who has only the auth namespace encryption key, but so that they are synchronized before sync of data and blobs, which allows us to display a device name in the UI before a user decides to sync.

Who can write device info records (e.g. who can name a device)?

This hasn't been fully discussed with the co-design team, but initially I think it makes sense to only allow the device owner to write a device info record. We might want to in the future only allow admins to write device info records for devices in a project, or treat a device info record written just by the device itself as "unverified" and a record written by an admin as "verified". For the MVP let's not check / control who can write this, in the app we'll only allow the device itself to write this record.

The schema type is simple:

type DeviceInfo = {
  name: string,
}

The docId should be the identity public key (which we are using as the device ID).

In the future we can lookup where a device info record comes from:

const { coreKey } = parseVersionId(deviceInfo.versionId)
const deviceKey = coreOwnership.getOwnerKey(coreKey)
if (deviceKey.toString('hex') === deviceInfo.docId) {
  // record is written by "self" e.g. device has written its own device info
} else {
  // look up role from deviceKey and decide what to do with the record based on that info.
}

Tasks

@achou11
Copy link
Member

achou11 commented Aug 21, 2023

lgtm!

This hasn't been fully discussed with the co-design team, but initially I think it makes sense to only allow the device owner to write a device info record. We might want to in the future only allow admins to write device info records for devices in a project, or treat a device info record written just by the device itself as "unverified" and a record written by an admin as "verified". For the MVP let's not check / control who can write this, in the app we'll only allow the device itself to write this record.

I agree with this 👍

gmaclennan added a commit to digidem/comapeo-schema that referenced this issue Aug 23, 2023
* feat: Add updated `Role` data type

Fixes #124
For details see digidem/comapeo-core#189

* Update & add tests; fix things

* feat: device -> deviceInfo & new schema

Fixes #126

For more info see digidem/comapeo-core#182

* add tests
@gmaclennan gmaclennan self-assigned this Aug 24, 2023
@gmaclennan
Copy link
Member Author

Completed in #250

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

No branches or pull requests

2 participants