Skip to content

Commit eaf1b93

Browse files
committed
add pgp_key support contact field for /.well-known/matrix/support (MSC4439)
matrix-org/matrix-spec-proposals#4439 Signed-off-by: June Strawberry <june@girlboss.ceo>
1 parent 82a2735 commit eaf1b93

4 files changed

Lines changed: 38 additions & 20 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ features = [
392392
"unstable-msc4310",
393393
"unstable-msc4311",
394394
"unstable-msc4383",
395+
"unstable-msc4439",
395396
"unstable-msc4466",
396397
"unstable-extensible-events",
397398
]

src/api/client/well_known.rs

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -38,38 +38,24 @@ pub(crate) async fn well_known_support(
3838
_body: Ruma<discover_support::Request>,
3939
) -> Result<discover_support::Response> {
4040
let support_page = services
41-
.server
4241
.config
4342
.well_known
4443
.support_page
4544
.as_ref()
4645
.map(ToString::to_string);
4746

48-
let role = services
49-
.server
50-
.config
51-
.well_known
52-
.support_role
53-
.clone();
47+
let role = services.config.well_known.support_role.clone();
5448

5549
// support page or role must be either defined for this to be valid
5650
if support_page.is_none() && role.is_none() {
5751
return Err!(Request(NotFound("Not found.")));
5852
}
5953

60-
let email_address = services
61-
.server
62-
.config
63-
.well_known
64-
.support_email
65-
.clone();
54+
let email_address = services.config.well_known.support_email.clone();
6655

67-
let matrix_id = services
68-
.server
69-
.config
70-
.well_known
71-
.support_mxid
72-
.clone();
56+
let matrix_id = services.config.well_known.support_mxid.clone();
57+
58+
let pgp_key = services.config.well_known.support_pgp_key.clone();
7359

7460
// if a role is specified, an email address or matrix id is required
7561
if role.is_some() && (email_address.is_none() && matrix_id.is_none()) {
@@ -80,7 +66,7 @@ pub(crate) async fn well_known_support(
8066
let mut contacts: Vec<Contact> = vec![];
8167

8268
if let Some(role) = role {
83-
let contact = Contact { role, email_address, matrix_id };
69+
let contact = Contact { role, email_address, matrix_id, pgp_key };
8470

8571
contacts.push(contact);
8672
}

src/core/config/mod.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2811,6 +2811,21 @@ pub struct WellKnownConfig {
28112811
/// reloadable: yes
28122812
pub support_mxid: Option<OwnedUserId>,
28132813

2814+
/// The PGP key (i.e. OpenPGP) that one may use for encrypted communications
2815+
/// for the above support role. No specific format is mandated for this
2816+
/// field or by the spec proposal. This field can contain a URL to a PGP
2817+
/// key, the 64-bit long ID, the OPENPGPKEY DNS record, or just the full
2818+
/// fingerprint.
2819+
///
2820+
/// Full/raw key content must not be here.
2821+
///
2822+
/// As this is a spec proposal (MSC4439), the identifier/prefix for this
2823+
/// field is currently "dev.zirco.msc4439.pgp_key"
2824+
///
2825+
/// reloadable: yes
2826+
/// example: "openpgp4fpr:8B77919975EAFA5E2456EE03665FE73077489DB0"
2827+
pub support_pgp_key: Option<String>,
2828+
28142829
/// LiveKit JWT endpoint.
28152830
/// Required for Element Call / MatrixRTC (MSC4143).
28162831
///

tuwunel-example.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2462,6 +2462,22 @@
24622462
#
24632463
#support_mxid =
24642464

2465+
# The PGP key (i.e. OpenPGP) that one may use for encrypted communications
2466+
# for the above support role. No specific format is mandated for this
2467+
# field or by the spec proposal. This field can contain a URL to a PGP
2468+
# key, the 64-bit long ID, the OPENPGPKEY DNS record, or just the full
2469+
# fingerprint.
2470+
#
2471+
# Full/raw key content must not be here.
2472+
#
2473+
# As this is a spec proposal (MSC4439), the identifier/prefix for this
2474+
# field is currently "dev.zirco.msc4439.pgp_key"
2475+
#
2476+
# reloadable: yes
2477+
# example: "openpgp4fpr:8B77919975EAFA5E2456EE03665FE73077489DB0"
2478+
#
2479+
#support_pgp_key =
2480+
24652481
# LiveKit JWT endpoint.
24662482
# Required for Element Call / MatrixRTC (MSC4143).
24672483
#

0 commit comments

Comments
 (0)