Skip to content

Commit c7218fb

Browse files
committed
fix(nextcloud): Stop exporting the crypton package
Signed-off-by: provokateurin <kate@provokateurin.de>
1 parent 237b170 commit c7218fb

File tree

5 files changed

+9
-7
lines changed

5 files changed

+9
-7
lines changed

packages/neon_framework/lib/src/models/push_notification.dart

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
import 'package:crypton/crypton.dart';
12
import 'package:json_annotation/json_annotation.dart';
23
import 'package:meta/meta.dart';
3-
import 'package:nextcloud/notifications.dart' show DecryptedSubject, RSAPrivateKey, decryptPushNotificationSubject;
4+
import 'package:nextcloud/notifications.dart' show DecryptedSubject, decryptPushNotificationSubject;
45

56
part 'push_notification.g.dart';
67

packages/neon_framework/lib/src/utils/push_utils.dart

+5-4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import 'dart:convert';
33
import 'dart:ui';
44

55
import 'package:crypto/crypto.dart';
6+
import 'package:crypton/crypton.dart';
67
import 'package:flutter/foundation.dart';
78
import 'package:flutter/widgets.dart';
89
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
@@ -37,19 +38,19 @@ class PushUtils {
3738
/// The callback will only be set if the current flutter engine was opened in the foreground.
3839
static Future<void> Function(PushNotification notification)? onLocalNotificationClicked;
3940

40-
static notifications.RSAKeypair loadRSAKeypair() {
41+
static RSAKeypair loadRSAKeypair() {
4142
const storage = AppStorage(StorageKeys.notifications);
4243
const keyDevicePrivateKey = 'device-private-key';
4344

44-
final notifications.RSAKeypair keypair;
45+
final RSAKeypair keypair;
4546
if (!storage.containsKey(keyDevicePrivateKey) || (storage.getString(keyDevicePrivateKey)!.isEmpty)) {
4647
debugPrint('Generating RSA keys for push notifications');
4748
// The key size has to be 2048, other sizes are not accepted by Nextcloud (at the moment at least)
4849
// ignore: avoid_redundant_argument_values
49-
keypair = notifications.RSAKeypair.fromRandom(keySize: 2048);
50+
keypair = RSAKeypair.fromRandom(keySize: 2048);
5051
unawaited(storage.setString(keyDevicePrivateKey, keypair.privateKey.toPEM()));
5152
} else {
52-
keypair = notifications.RSAKeypair(notifications.RSAPrivateKey.fromPEM(storage.getString(keyDevicePrivateKey)!));
53+
keypair = RSAKeypair(RSAPrivateKey.fromPEM(storage.getString(keyDevicePrivateKey)!));
5354
}
5455

5556
return keypair;

packages/neon_framework/pubspec.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ dependencies:
1212
collection: ^1.0.0
1313
cookie_jar: ^4.0.0
1414
crypto: ^3.0.0
15+
crypton: ^2.0.0
1516
cupertino_icons: ^1.0.0
1617
dynamic_color: ^1.0.0
1718
emoji_picker_flutter: ^2.0.0

packages/nextcloud/lib/src/helpers/notifications.dart

-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import 'package:crypto/crypto.dart';
66
import 'package:crypton/crypton.dart';
77
import 'package:json_annotation/json_annotation.dart';
88

9-
export 'package:crypton/crypton.dart' show RSAKeypair, RSAPrivateKey, RSAPublicKey;
10-
119
part 'notifications.g.dart';
1210

1311
/// Generates the push token hash which is just sha512

packages/nextcloud/test/notifications_test.dart

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'dart:async';
22

3+
import 'package:crypton/crypton.dart';
34
import 'package:nextcloud/nextcloud.dart';
45
import 'package:nextcloud/notifications.dart';
56
import 'package:nextcloud_test/nextcloud_test.dart';

0 commit comments

Comments
 (0)