-
-
Notifications
You must be signed in to change notification settings - Fork 877
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
751db8b
commit b35d942
Showing
13 changed files
with
334 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import 'package:ente_auth/core/network.dart'; | ||
import 'package:url_launcher/url_launcher_string.dart'; | ||
|
||
class PasskeyService { | ||
PasskeyService._privateConstructor(); | ||
static final PasskeyService instance = PasskeyService._privateConstructor(); | ||
|
||
final _enteDio = Network.instance.enteDio; | ||
|
||
Future<String?> getJwtToken() async { | ||
try { | ||
final response = await _enteDio.get( | ||
"/users/accounts-token", | ||
); | ||
if (response.data?["accountsToken"] == null) return null; | ||
return response.data["accountsToken"] as String?; | ||
} catch (e) { | ||
return null; | ||
} | ||
} | ||
|
||
Future<void> openPasskeyPage() async { | ||
final jwtToken = await getJwtToken(); | ||
|
||
final url = jwtToken != null | ||
? "https://accounts.ente.io/account-handoff?token=$jwtToken" | ||
: "https://accounts.ente.io/"; | ||
await launchUrlString( | ||
url, | ||
mode: LaunchMode.externalApplication, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.