From bb7a8d54a0378bcec01ffc297fa66ef44f44d22a Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Sun, 22 Sep 2024 10:37:14 +0200 Subject: [PATCH 1/3] MSC4197: Copy Paste Hints!!! --- proposals/4197-copy-hints.md | 63 ++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 proposals/4197-copy-hints.md diff --git a/proposals/4197-copy-hints.md b/proposals/4197-copy-hints.md new file mode 100644 index 00000000000..8ddb477cc65 --- /dev/null +++ b/proposals/4197-copy-hints.md @@ -0,0 +1,63 @@ +# MSC4197: Copy-Paste Hints + +In Matrix today, it can be used for communication. One thing that is communicated is two-factor auth codes. In other platforms, one convenience is being able to quickly copy-paste two factor auth codes. This is not possible in Matrix today. + +When sending a message, my message could contain a hint to the user's client that they should copy some particular part of the message. I propose to add a new field to `m.room.message` events that will hint to clients what text they could facilitating the user to copy. + +### Proposal + +* technical details +* describe the solution (This is the solution. Be assertive.) + +`m.room.message` contains a new field, `copy_hint`, under the existing `content` dictionary. This new field will contain a string representing text that the client could present to the user to copy. + +An example is below: + + +```json5 +{ + "content": { + "body": "DO NOT SHARE THIS WITH ANYONE!!! Your 2FA code is: 100000", + "m.mentions": {}, + "msgtype": "m.text", + "copy_hint": [23, 29] + }, + "origin_server_ts": 1726936182830, + "sender": "@andrewm:element.io", + "type": "m.room.message", + "unsigned": { + "membership": "join", + "age": 54359693, + "transaction_id": "m1726936182657.27" + }, + "event_id": "$4WvO6_skvEIibdffnDKdTkFHtOKUZaPFLm8HJuXcz7E", + "room_id": "!jWkHTegEyVsdPJkjHA:element.io" +} +``` + +### Potential Issues + +None considered! + +### Alternatives + +1. `hints` dictionary. +2. Leave things as is (please don't!) +3. boolean `copy_hint` field (hint to client to copy the whole message) +4. give up (similar to 2.) +5. Use indexes in the message + * Harder to implement + * Use bandwidth +6. If the event is encrypted, leave the 2FA code out of the encryption + +### Security Considerations + +TODO. + +### Unstable prefix + +What is this. + +### Dependencies + +I do not build on any giant's shoulders. From e2f6046f9ee6fb13b31a42d77ff64e91f6c877c5 Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Sun, 22 Sep 2024 10:45:43 +0200 Subject: [PATCH 2/3] Fix the example --- proposals/4197-copy-hints.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proposals/4197-copy-hints.md b/proposals/4197-copy-hints.md index 8ddb477cc65..a1e134acc98 100644 --- a/proposals/4197-copy-hints.md +++ b/proposals/4197-copy-hints.md @@ -20,7 +20,7 @@ An example is below: "body": "DO NOT SHARE THIS WITH ANYONE!!! Your 2FA code is: 100000", "m.mentions": {}, "msgtype": "m.text", - "copy_hint": [23, 29] + "copy_hint": "100000" }, "origin_server_ts": 1726936182830, "sender": "@andrewm:element.io", From 303b7d76272152493ecb5431dff168266c5ebd03 Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Sun, 22 Sep 2024 10:56:17 +0200 Subject: [PATCH 3/3] Add an unstable prefix --- proposals/4197-copy-hints.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/proposals/4197-copy-hints.md b/proposals/4197-copy-hints.md index a1e134acc98..3ae8354cc55 100644 --- a/proposals/4197-copy-hints.md +++ b/proposals/4197-copy-hints.md @@ -35,6 +35,8 @@ An example is below: } ``` +Clients MAY automatically copy the contents of `copy_hint` to the clipboard without asking the user. This is an implementation detail. + ### Potential Issues None considered! @@ -56,7 +58,7 @@ TODO. ### Unstable prefix -What is this. +While this MSC is unstable, all instances of the field name `copy_hint` must be replaced with `org.matrix.msc4197.copy_hint`. ### Dependencies