-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2003 from TalaoDAO/october
October
- Loading branch information
Showing
15 changed files
with
312 additions
and
21 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
135 changes: 135 additions & 0 deletions
135
lib/dashboard/drawer/ssi/manage_did/view/did_p256/did_p256_private_key_page.dart
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,135 @@ | ||
import 'package:altme/app/app.dart'; | ||
import 'package:altme/l10n/l10n.dart'; | ||
import 'package:altme/theme/theme.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter/services.dart'; | ||
import 'package:oidc4vc/oidc4vc.dart'; | ||
import 'package:secure_storage/secure_storage.dart'; | ||
|
||
class DidP256PrivateKeyPage extends StatefulWidget { | ||
const DidP256PrivateKeyPage({super.key}); | ||
|
||
static Route<dynamic> route() { | ||
return MaterialPageRoute<void>( | ||
builder: (_) => const DidP256PrivateKeyPage(), | ||
settings: const RouteSettings(name: '/DidP256PrivateKeyPage'), | ||
); | ||
} | ||
|
||
@override | ||
State<DidP256PrivateKeyPage> createState() => _DidP256PrivateKeyPageState(); | ||
} | ||
|
||
class _DidP256PrivateKeyPageState extends State<DidP256PrivateKeyPage> | ||
with SingleTickerProviderStateMixin { | ||
late Animation<double> animation; | ||
late AnimationController animationController; | ||
|
||
Future<String> getKey() async { | ||
final privateKey = await getP256PrivateKey(getSecureStorage); | ||
return privateKey; | ||
} | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
animationController = AnimationController( | ||
vsync: this, | ||
duration: const Duration(seconds: 20), | ||
); | ||
|
||
final Tween<double> rotationTween = Tween(begin: 20, end: 0); | ||
|
||
animation = rotationTween.animate(animationController) | ||
..addStatusListener((status) { | ||
if (status == AnimationStatus.completed) { | ||
Navigator.pop(context); | ||
} | ||
}); | ||
animationController.forward(); | ||
} | ||
|
||
@override | ||
void dispose() { | ||
animationController.dispose(); | ||
super.dispose(); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final l10n = context.l10n; | ||
return BasePage( | ||
scrollView: false, | ||
title: l10n.decentralizedIDKey, | ||
titleAlignment: Alignment.topCenter, | ||
titleLeading: const BackLeadingButton(), | ||
secureScreen: true, | ||
body: BackgroundCard( | ||
width: double.infinity, | ||
height: double.infinity, | ||
child: Column( | ||
mainAxisSize: MainAxisSize.max, | ||
mainAxisAlignment: MainAxisAlignment.start, | ||
children: [ | ||
Text( | ||
l10n.didPrivateKey, | ||
style: Theme.of(context).textTheme.title, | ||
), | ||
const SizedBox( | ||
height: Sizes.spaceNormal, | ||
), | ||
FutureBuilder<String>( | ||
future: getKey(), | ||
builder: (context, snapshot) { | ||
switch (snapshot.connectionState) { | ||
case ConnectionState.done: | ||
return Column( | ||
children: [ | ||
Text( | ||
snapshot.data!, | ||
textAlign: TextAlign.center, | ||
style: Theme.of(context).textTheme.titleMedium, | ||
), | ||
const SizedBox(height: Sizes.spaceXLarge), | ||
CopyButton( | ||
onTap: () async { | ||
await Clipboard.setData( | ||
ClipboardData(text: snapshot.data!), | ||
); | ||
AlertMessage.showStateMessage( | ||
context: context, | ||
stateMessage: StateMessage.success( | ||
stringMessage: l10n.copiedToClipboard, | ||
), | ||
); | ||
}, | ||
), | ||
], | ||
); | ||
case ConnectionState.waiting: | ||
case ConnectionState.none: | ||
case ConnectionState.active: | ||
return const Text(''); | ||
} | ||
}, | ||
), | ||
Expanded( | ||
child: Center( | ||
child: AnimatedBuilder( | ||
animation: animation, | ||
builder: (BuildContext context, Widget? child) { | ||
return Text( | ||
timeFormatter(timeInSecond: animation.value.toInt()), | ||
textAlign: TextAlign.center, | ||
style: Theme.of(context).textTheme.displayMedium, | ||
); | ||
}, | ||
), | ||
), | ||
), | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} |
77 changes: 77 additions & 0 deletions
77
lib/dashboard/drawer/ssi/manage_did/view/did_p256/manage_did_p256_page.dart
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,77 @@ | ||
import 'package:altme/app/app.dart'; | ||
import 'package:altme/dashboard/dashboard.dart'; | ||
import 'package:altme/l10n/l10n.dart'; | ||
import 'package:did_kit/did_kit.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:oidc4vc/oidc4vc.dart'; | ||
import 'package:secure_storage/secure_storage.dart'; | ||
|
||
class ManageDidP256Page extends StatefulWidget { | ||
const ManageDidP256Page({super.key}); | ||
|
||
static Route<dynamic> route() { | ||
return MaterialPageRoute<void>( | ||
builder: (_) => const ManageDidP256Page(), | ||
settings: const RouteSettings(name: '/ManageDidP256Page'), | ||
); | ||
} | ||
|
||
@override | ||
State<ManageDidP256Page> createState() => _ManageDidP256PageState(); | ||
} | ||
|
||
class _ManageDidP256PageState extends State<ManageDidP256Page> { | ||
Future<String> getDid() async { | ||
final privateKey = await getP256PrivateKey(getSecureStorage); | ||
|
||
final (did, _) = await getDidAndKid( | ||
isEBSIV3: false, | ||
privateKey: privateKey, | ||
didKitProvider: DIDKitProvider(), | ||
); | ||
|
||
return did; | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final l10n = context.l10n; | ||
return BasePage( | ||
title: l10n.keyDecentralizedIDP256, | ||
titleAlignment: Alignment.topCenter, | ||
scrollView: false, | ||
titleLeading: const BackLeadingButton(), | ||
body: BackgroundCard( | ||
height: double.infinity, | ||
width: double.infinity, | ||
padding: const EdgeInsets.all(Sizes.spaceSmall), | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.start, | ||
crossAxisAlignment: CrossAxisAlignment.center, | ||
mainAxisSize: MainAxisSize.max, | ||
children: [ | ||
FutureBuilder<String>( | ||
future: getDid(), | ||
builder: (context, snapshot) { | ||
switch (snapshot.connectionState) { | ||
case ConnectionState.done: | ||
final did = snapshot.data!; | ||
return Did(did: did); | ||
case ConnectionState.waiting: | ||
case ConnectionState.none: | ||
case ConnectionState.active: | ||
return const SizedBox(); | ||
} | ||
}, | ||
), | ||
const Padding( | ||
padding: EdgeInsets.symmetric(horizontal: Sizes.spaceNormal), | ||
child: Divider(), | ||
), | ||
DidPrivateKey(route: DidP256PrivateKeyPage.route()), | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} |
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
Oops, something went wrong.