uploadKeysForDevice method
Publishes end-to-end encryption keys for the specified device. https://github.com/sdn-org/sdn-spec-proposals/pull/3814
Implementation
Future<Map<String, int>> uploadKeysForDevice(String device,
{SDNDeviceKeys? deviceKeys,
Map<String, dynamic>? oneTimeKeys,
Map<String, dynamic>? fallbackKeys}) async {
final response = await request(
RequestType.POST,
'/client/v3/keys/upload/${Uri.encodeComponent(device)}',
data: {
if (deviceKeys != null) 'device_keys': deviceKeys.toJson(),
if (oneTimeKeys != null) 'one_time_keys': oneTimeKeys,
if (fallbackKeys != null) ...{
'fallback_keys': fallbackKeys,
'org.sdn.msc2732.fallback_keys': fallbackKeys,
},
},
);
return Map<String, int>.from(
response.tryGetMap<String, Object?>('one_time_key_counts') ??
<String, int>{});
}