mirror of
https://github.com/jagandeepbrar/lunasea.git
synced 2026-08-31 12:42:34 +00:00
* [iOS/Build] Add GoogleUtilities pod to prevent archive errors * (chore) version bump * [Git] Initialize blackbox * [Git] Initialize blackbox * [Git/Blackbox] Add me@jagandeepbrar.io as admin * registered in blackbox: ios/ExportOptions.plist * registered in blackbox: ios/GoogleService-Info.plist * registered in blackbox: android/key.properties * registered in blackbox: android/app/google-services.json * Re-encrypted keys * registered in blackbox: android/key.jks * Updated key.properties, re-encrypted * [Android/Keystore] Update same key.properties * [Tautulli/Activity] Incorrectly localized "Transcodes" string * [Radarr, UI] Implemented quick manual import, Implemented new design of ExpandableTile across UI (#378) * Use local path for radarr package * [Radarr/Manual Import] Browse filesystem, trigger quick import * [UI/Buttons] Normalize the height of all buttons * Update packages * [ListView] Exposed itemExtent property * [Lidarr/Releases] Move from LSExpandable to LunaExpandableListTile implementation * [Tautulli/Logs] Use the new expandable table card styling * [SABnzbd/History] Use the newer expandable table card styling * [NZBGet/History] Use the newer expandable table card styling * [UI/Button] Reduce size of the loader and icon to closer match text size * [Sonarr/Releases] Use the newer expandable table card styling * [Sonarr/Episodes] Use the newer expandable table card styling * [UI/Table] Safe-guard title and body text, show emdash when receiving null data * [Radarr/Details] Show monitor status and properly update the overview table on edit or monitor status changes * Updated changelog * [Sonarr/Queue & Episodes] Cleaned up implementation of expandable tile * Translated using Weblate (Norwegian Bokmål) Currently translated at 100.0% (14 of 14 strings) Translation: LunaSea/LunaSea Translate-URL: https://hosted.weblate.org/projects/lunasea/lunasea/nb_NO/ * Translated using Weblate (Swedish) Currently translated at 100.0% (14 of 14 strings) Translation: LunaSea/LunaSea Translate-URL: https://hosted.weblate.org/projects/lunasea/lunasea/sv/ * Translated using Weblate (German) Currently translated at 100.0% (68 of 68 strings) Translation: LunaSea/Tautulli Translate-URL: https://hosted.weblate.org/projects/lunasea/tautulli/de/ * Translated using Weblate (Norwegian Bokmål) Currently translated at 80.8% (55 of 68 strings) Translation: LunaSea/Tautulli Translate-URL: https://hosted.weblate.org/projects/lunasea/tautulli/nb_NO/ * Translated using Weblate (Swedish) Currently translated at 100.0% (68 of 68 strings) Translation: LunaSea/Tautulli Translate-URL: https://hosted.weblate.org/projects/lunasea/tautulli/sv/ * Translated using Weblate (Russian) Currently translated at 57.3% (39 of 68 strings) Translation: LunaSea/Tautulli Translate-URL: https://hosted.weblate.org/projects/lunasea/tautulli/ru/ * (chore) Build localizations * [Tautulli/Webhooks] Implement webhook data handlers for all Tautulli webhooks (#380) * [Tautulli/Webhooks] Handle transcode decision change and watched event types * [Radarr/Sonarr] Safe-guard webhooks by pushing the home route on invalid received data blocks * [Tautulli/Webhooks] Implemented all webhooks * Translated using Weblate (French) Currently translated at 100.0% (78 of 78 strings) Translation: LunaSea/Radarr Translate-URL: https://hosted.weblate.org/projects/lunasea/radarr/fr/ * Translated using Weblate (German) Currently translated at 100.0% (78 of 78 strings) Translation: LunaSea/Radarr Translate-URL: https://hosted.weblate.org/projects/lunasea/radarr/de/ * Translated using Weblate (Russian) Currently translated at 92.8% (13 of 14 strings) Translation: LunaSea/LunaSea Translate-URL: https://hosted.weblate.org/projects/lunasea/lunasea/ru/ * [Release] (chore): Dirty v5.0.0+50000013 (#382) * [Radarr/Manual Import] Add search bar for host system path, add stub manual import page * [Radarr/Manual Import] Change path bar text to "File Browser..." * [Radarr/Manual Import] Pass "/" if textController text is null * [Radarr/Import] Stub details state * [Database] Correctly register LunaIndexerIcon hive adapter * [Radarr/Import] Filter directories when typing path, Fetch manual import results with stub cards * [UI/Bottom Bar] Abstract bottom action bar, use on add movie page * [UI/Navigation Bar] Add option to attach stickied top actions to navigation bar * [Radarr/Edit] Use stickied bottom action bar for buttons * [Radarr/Details] use sticky navigation actions for interactive and automatic search * [Dialogs] CheckboxTiles were padded too aggressively in the X-axis * [Sentry] Remove remaining references to Sentry * (chore) Build localizations * (chore) Update changelog * Preparing to shift GitHub repository structure Co-authored-by: Allan Nordhøy <epost@anotheragency.no> Co-authored-by: Patrik Hauguth <patrik.hauguth@gmail.com> Co-authored-by: cpt-kuesel <jln.sltr@pm.me> Co-authored-by: Artem <KovalevArtem.ru@gmail.com> Co-authored-by: Antoine C <contact+weblate@antoinecardon.fr>
43 lines
1.9 KiB
Dart
43 lines
1.9 KiB
Dart
import 'package:encrypt/encrypt.dart';
|
|
import 'package:lunasea/core.dart';
|
|
|
|
class LunaEncryption {
|
|
static const int _IV_LENGTH = 16;
|
|
static const int _KEY_LENGTH = 32;
|
|
static const String _PAD_VALUE = '0';
|
|
static const String ENCRYPTION_FAILURE = '<<INVALID_ENCRYPTION>>';
|
|
|
|
/// Encrypt a given string using a given encryption key, and return the encrypted string.
|
|
///
|
|
/// The key is duped, and either trimmed or padded (with _PAD_VALUE) to 32 characters.
|
|
String encrypt(String encryptionKey, String data) {
|
|
try {
|
|
String morphedKey = (encryptionKey+encryptionKey).padRight(_KEY_LENGTH, _PAD_VALUE).substring(0, _KEY_LENGTH);
|
|
Key key = Key.fromUtf8(morphedKey);
|
|
IV iv = IV.fromLength(_IV_LENGTH);
|
|
final _encrypter = Encrypter(AES(key));
|
|
final _encrypted = _encrypter.encrypt(data, iv: iv).base64;
|
|
return _encrypted;
|
|
} catch (error, stack) {
|
|
LunaLogger().error('Failed to decrypted "$data" with using key "$encryptionKey"', error, stack);
|
|
}
|
|
return ENCRYPTION_FAILURE;
|
|
}
|
|
|
|
/// Decrypt a given string using a given encryption key, and return the decrypted string.
|
|
///
|
|
/// The key is duped, and either trimmed or padded (with _PAD_VALUE) to 32 characters.
|
|
String decrypt(String decryptionKey, String data) {
|
|
try {
|
|
String morphedKey = (decryptionKey+decryptionKey).padRight(_KEY_LENGTH, _PAD_VALUE).substring(0, _KEY_LENGTH);
|
|
Key key = Key.fromUtf8(morphedKey);
|
|
IV iv = IV.fromLength(_IV_LENGTH);
|
|
final _encrypter = Encrypter(AES(key));
|
|
return _encrypter.decrypt64(data, iv: iv);
|
|
} catch (error) {
|
|
LunaLogger().warning('LunaEncryption', 'decrypt', 'Failed to decrypted "$data" with using key "$decryptionKey"');
|
|
}
|
|
return ENCRYPTION_FAILURE;
|
|
}
|
|
}
|