-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
31 changed files
with
850 additions
and
394 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
export 'cubit/did_private_key_cubit.dart'; | ||
export 'cubit/did_private_key_dialog_cubit.dart'; | ||
export 'view/did/did_private_key_page.dart'; | ||
export 'view/did/manage_did_page.dart'; | ||
export 'view/did_ebsi/did_ebsi_private_key_page.dart'; | ||
export 'view/did_ebsi/manage_did_ebsi_page.dart'; | ||
export 'view/did_ebsi_v2/did_ebsi_v2_private_key_page.dart'; | ||
export 'view/did_ebsi_v2/manage_did_ebsi_v2_page.dart'; | ||
export 'view/did_edDSA/did_edDSA_private_key_page.dart'; | ||
export 'view/did_edDSA/manage_did_edDSA_page.dart'; | ||
export 'view/did_polygon_id/manage_did_polygon_id_page.dart'; | ||
export 'view/did_secp256k1/did_secp256k1_private_key_page.dart'; | ||
export 'view/did_secp256k1/manage_did_secp256k1_page.dart'; | ||
export 'widgets/widgets.dart'; |
24 changes: 12 additions & 12 deletions
24
...w/did_ebsi/did_ebsi_private_key_page.dart → ...ebsi_v2/did_ebsi_v2_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
81 changes: 81 additions & 0 deletions
81
lib/dashboard/drawer/ssi/manage_did/view/did_ebsi_v2/manage_did_ebsi_v2_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,81 @@ | ||
import 'package:altme/app/app.dart'; | ||
import 'package:altme/dashboard/dashboard.dart'; | ||
import 'package:altme/ebsi/initiate_ebsi_credential_issuance.dart'; | ||
import 'package:altme/l10n/l10n.dart'; | ||
import 'package:fast_base58/fast_base58.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:secure_storage/secure_storage.dart'; | ||
|
||
class ManageDidEbsiV2Page extends StatefulWidget { | ||
const ManageDidEbsiV2Page({super.key}); | ||
|
||
static Route<dynamic> route() { | ||
return MaterialPageRoute<void>( | ||
builder: (_) => const ManageDidEbsiV2Page(), | ||
settings: const RouteSettings(name: '/ManageDidEbsiV2Page'), | ||
); | ||
} | ||
|
||
@override | ||
State<ManageDidEbsiV2Page> createState() => _ManageDidEbsiPageState(); | ||
} | ||
|
||
class _ManageDidEbsiPageState extends State<ManageDidEbsiV2Page> { | ||
Future<String> getDid() async { | ||
final oidc4vc = OIDC4VCType.EBSIV2.getOIDC4VC; | ||
final mnemonic = await getSecureStorage.get(SecureStorageKeys.ssiMnemonic); | ||
|
||
final privateKey = await oidc4vc.privateKeyFromMnemonic( | ||
mnemonic: mnemonic!, | ||
index: OIDC4VCType.EBSIV2.index, | ||
); | ||
|
||
final private = await oidc4vc.getPrivateKey(mnemonic, privateKey); | ||
|
||
final thumbprint = getThumbprint(private); | ||
final encodedAddress = Base58Encode([2, ...thumbprint]); | ||
return 'did:ebsi:z$encodedAddress'; | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final l10n = context.l10n; | ||
return BasePage( | ||
title: l10n.manageEbsiV2DecentralizedId, | ||
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: DidEbsiV2PrivateKeyPage.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
Oops, something went wrong.