File tree Expand file tree Collapse file tree 1 file changed +4
-10
lines changed
crates/matrix-sdk-crypto/src/olm/signing Expand file tree Collapse file tree 1 file changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -272,16 +272,7 @@ impl SelfSigning {
272
272
}
273
273
274
274
pub async fn sign_device ( & self , device_keys : & mut DeviceKeys ) -> Result < ( ) , SignatureError > {
275
- // Create a copy of the device keys containing only fields that will
276
- // get signed.
277
- let json_device = json ! ( {
278
- "user_id" : device_keys. user_id,
279
- "device_id" : device_keys. device_id,
280
- "algorithms" : device_keys. algorithms,
281
- "keys" : device_keys. keys,
282
- } ) ;
283
-
284
- let signature = self . sign_device_helper ( json_device) . await ?;
275
+ let signature = self . sign_device_helper ( serde_json:: to_value ( & device_keys) ?) . await ?;
285
276
286
277
device_keys
287
278
. signatures
@@ -419,8 +410,11 @@ impl Signing {
419
410
pub async fn sign_json ( & self , mut json : Value ) -> Result < Signature , SignatureError > {
420
411
let json_object = json. as_object_mut ( ) . ok_or ( SignatureError :: NotAnObject ) ?;
421
412
let _ = json_object. remove ( "signatures" ) ;
413
+ let _ = json_object. remove ( "unsigned" ) ;
414
+
422
415
let canonical_json: CanonicalJsonValue =
423
416
json. try_into ( ) . expect ( "Can't canonicalize the json value" ) ;
417
+
424
418
Ok ( self . sign ( & canonical_json. to_string ( ) ) . await )
425
419
}
426
420
You can’t perform that action at this time.
0 commit comments