@@ -3,6 +3,7 @@ import 'dart:convert';
3
3
import 'dart:ui' ;
4
4
5
5
import 'package:crypto/crypto.dart' ;
6
+ import 'package:crypton/crypton.dart' ;
6
7
import 'package:flutter/foundation.dart' ;
7
8
import 'package:flutter/widgets.dart' ;
8
9
import 'package:flutter_local_notifications/flutter_local_notifications.dart' ;
@@ -37,19 +38,19 @@ class PushUtils {
37
38
/// The callback will only be set if the current flutter engine was opened in the foreground.
38
39
static Future <void > Function (PushNotification notification)? onLocalNotificationClicked;
39
40
40
- static notifications. RSAKeypair loadRSAKeypair () {
41
+ static RSAKeypair loadRSAKeypair () {
41
42
const storage = AppStorage (StorageKeys .notifications);
42
43
const keyDevicePrivateKey = 'device-private-key' ;
43
44
44
- final notifications. RSAKeypair keypair;
45
+ final RSAKeypair keypair;
45
46
if (! storage.containsKey (keyDevicePrivateKey) || (storage.getString (keyDevicePrivateKey)! .isEmpty)) {
46
47
debugPrint ('Generating RSA keys for push notifications' );
47
48
// The key size has to be 2048, other sizes are not accepted by Nextcloud (at the moment at least)
48
49
// ignore: avoid_redundant_argument_values
49
- keypair = notifications. RSAKeypair .fromRandom (keySize: 2048 );
50
+ keypair = RSAKeypair .fromRandom (keySize: 2048 );
50
51
unawaited (storage.setString (keyDevicePrivateKey, keypair.privateKey.toPEM ()));
51
52
} else {
52
- keypair = notifications. RSAKeypair (notifications. RSAPrivateKey .fromPEM (storage.getString (keyDevicePrivateKey)! ));
53
+ keypair = RSAKeypair (RSAPrivateKey .fromPEM (storage.getString (keyDevicePrivateKey)! ));
53
54
}
54
55
55
56
return keypair;
0 commit comments