Skip to content

MSC4331: Device Account Data#4331

Open
jevolk wants to merge 3 commits intomatrix-org:mainfrom
matrix-construct:device-account-data
Open

MSC4331: Device Account Data#4331
jevolk wants to merge 3 commits intomatrix-org:mainfrom
matrix-construct:device-account-data

Conversation

@jevolk
Copy link
Copy Markdown
Contributor

@jevolk jevolk commented Aug 26, 2025

Signed-off-by: Jason Volk <jason@zemos.net>
@turt2live turt2live added proposal A matrix spec change proposal client-server Client-Server API kind:feature MSC for not-core and not-maintenance stuff needs-implementation This MSC does not have a qualifying implementation for the SCT to review. The MSC cannot enter FCP. labels Aug 26, 2025
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation requirements:

  • Client
  • Server

It is possible to add an `account_data` field to the v1.15 §
[10.11.1](https://spec.matrix.org/v1.15/client-server-api/#get_matrixclientv3devices)
response's `Device` object as a convenience, but that will not be
mandated by this proposal without feedback.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devices can already have metadata https://spec.matrix.org/v1.15/client-server-api/#put_matrixclientv3devicesdeviceid, why not add fields to that mechanism rather than adding a new one? The example use cases seem like they'd fit in device metadata just fine

Copy link
Copy Markdown
Contributor Author

@jevolk jevolk Aug 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the semantics of the metadata are satisfactory (and appear so) we could just pivot this MSC to minimally replace #4292 by specifying supported_room_versions as another metadata field, and maybe client_version for fun.

Metadata isn't a granular key-store though, but it doesn't seem hard to extend those endpoints with another path component e.g. GET /_matrix/client/v3/devices/{deviceId}/display_name which would basically supersede the full functionality of the Account Data approach. This might be mission-creep though.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another alternative is a little more radical: deprecate the device metadata suite itself in favor of Device Account Data which has resemblance to other Account Data. One thing missing from the existing proposal is the fact that account_data should come down through /sync which other devices can react to. AFAIK not possible with device metadata?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to be missing the potential issues, alternatives and security considerations sections

- Client software version identifier.
- Encryption metadatas.

## Client-server endpoints
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the device account data get deleted when the device is logged out?

similar characteristics as the other two but with a `device_id`
division. Device Account Data acts as an arbitrary server-side
key+value store for each of a user's devices. Writes to this store are
only permitted by the device with a matching `device_id`. Reads from
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If any of the user's devices is allowed to write to any other device's account data, it could be used for things like MSC3890 (and, in fact, that MSC calls out per-device account data as an alternative).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same-device-writer clause is intended to prevent ABA issues out-of-the-box. The cited case is certainly compelling though. I think a solution would be to allow type-specific semantics, but defaulting to the proposed same-device-writer if the type doesn't specify otherwise. In many cases a single-writer can be specified to mitigate ABA's just as well, even if that single-writer isn't the same device.

Add updates via /sync semantic.

Add alternatives, security considerations, potential issues sections.

Fix trailing whitespace errors.
@jevolk jevolk force-pushed the device-account-data branch from 046199c to 5189c27 Compare September 23, 2025 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

client-server Client-Server API kind:feature MSC for not-core and not-maintenance stuff needs-implementation This MSC does not have a qualifying implementation for the SCT to review. The MSC cannot enter FCP. proposal A matrix spec change proposal

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants