Skip to content

Commit 476c476

Browse files
committed
Work around ruma/ruma#1940 by calculating key_name manually
1 parent f0a82d3 commit 476c476

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/identifiers.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,16 @@ impl DeviceKeyId {
120120
/// Returns device ID of the device key ID.
121121
#[wasm_bindgen(getter, js_name = "deviceId")]
122122
pub fn device_id(&self) -> DeviceId {
123-
self.inner.device_id().to_owned().into()
123+
// TODO: when https://github.com/ruma/ruma/issues/1940 is fixed,
124+
// this should just be:
125+
//self.inner.key_name().to_owned().into()
126+
127+
let key_id = self.inner.to_string();
128+
129+
let colon_pos =
130+
key_id.find(":").expect("Key should not have parsed if it did not contain ':'");
131+
132+
DeviceId::new(&key_id[(colon_pos + 1)..])
124133
}
125134

126135
/// Return the device key ID as a string.

0 commit comments

Comments
 (0)