Skip to content

Commit

Permalink
[FIX] Auth desktop icons and steam code (#1783)
Browse files Browse the repository at this point in the history
## Description

## Tests
  • Loading branch information
prateekmedia authored May 20, 2024
2 parents 9c667ef + 4289ab2 commit 13f9358
Show file tree
Hide file tree
Showing 15 changed files with 44 additions and 4 deletions.
2 changes: 1 addition & 1 deletion auth/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<application android:name="${applicationName}"
android:label="auth"
android:label="Auth"
android:icon="@mipmap/launcher_icon"
android:usesCleartextTraffic="true"
android:requestLegacyExternalStorage="true"
Expand Down
Binary file modified auth/assets/icons/auth-icon.ico
Binary file not shown.
Binary file modified auth/assets/icons/auth-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion auth/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<string>es</string>
</array>
<key>CFBundleName</key>
<string>auth</string>
<string>Auth</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
Expand Down
2 changes: 1 addition & 1 deletion auth/lib/ui/code_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ class _CodeWidgetState extends State<CodeWidget> {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
if (widget.code.type == Type.totp)
if (widget.code.type.isTOTPCompatible)
CodeTimerProgress(
period: widget.code.period,
),
Expand Down
15 changes: 15 additions & 0 deletions auth/lib/utils/totp_util.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import 'package:ente_auth/models/code.dart';
import 'package:flutter/foundation.dart';
import 'package:otp/otp.dart' as otp;
import 'package:steam_totp/steam_totp.dart';

String getOTP(Code code) {
if (code.issuer.toLowerCase() == 'steam') {
return _getSteamCode(code);
}
if (code.type == Type.hotp) {
return _getHOTPCode(code);
}
Expand All @@ -26,7 +30,18 @@ String _getHOTPCode(Code code) {
);
}

String _getSteamCode(Code code, [bool isNext = false]) {
final SteamTOTP steamtotp = SteamTOTP(secret: code.secret);

return steamtotp.generate(
DateTime.now().millisecondsSinceEpoch ~/ 1000 + (isNext ? code.period : 0),
);
}

String getNextTotp(Code code) {
if (code.issuer.toLowerCase() == 'steam') {
return _getSteamCode(code, true);
}
return otp.OTP.generateTOTPCodeString(
getSanitizedSecret(code.secret),
DateTime.now().millisecondsSinceEpoch + code.period * 1000,
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified auth/macos/Runner/Assets.xcassets/AppIcon.appiconset/128-mac.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified auth/macos/Runner/Assets.xcassets/AppIcon.appiconset/16-mac.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified auth/macos/Runner/Assets.xcassets/AppIcon.appiconset/256-mac.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified auth/macos/Runner/Assets.xcassets/AppIcon.appiconset/32-mac.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified auth/macos/Runner/Assets.xcassets/AppIcon.appiconset/64-mac.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions auth/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.0"
hashlib:
dependency: transitive
description:
name: hashlib
sha256: "67e640e19cc33070113acab3125cd48ebe480a0300e15554dec089b8878a729f"
url: "https://pub.dev"
source: hosted
version: "1.16.0"
hashlib_codecs:
dependency: transitive
description:
name: hashlib_codecs
sha256: "49e2a471f74b15f1854263e58c2ac11f2b631b5b12c836f9708a35397d36d626"
url: "https://pub.dev"
source: hosted
version: "2.2.0"
hex:
dependency: transitive
description:
Expand Down Expand Up @@ -1439,6 +1455,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.11.1"
steam_totp:
dependency: "direct main"
description:
name: steam_totp
sha256: "3c09143c983f6bb05bb53e9232f9d40bbcc01c596ba0273c3e6bb246729abfa1"
url: "https://pub.dev"
source: hosted
version: "0.0.1"
step_progress_indicator:
dependency: "direct main"
description:
Expand Down
3 changes: 2 additions & 1 deletion auth/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: ente_auth
description: ente two-factor authenticator
version: 3.0.2+302
version: 3.0.3+303
publish_to: none

environment:
Expand Down Expand Up @@ -94,6 +94,7 @@ dependencies:
sqflite_common_ffi: ^2.3.0+4
sqlite3: ^2.1.0
sqlite3_flutter_libs: ^0.5.19+1
steam_totp: ^0.0.1
step_progress_indicator: ^1.0.2
styled_text: ^8.1.0
tray_manager: ^0.2.1
Expand Down

0 comments on commit 13f9358

Please sign in to comment.