Skip to content

Commit

Permalink
Merge branch 'main' into google_mlkit_barcode_scanning
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkbee1 committed Jul 29, 2023
2 parents b435a9d + 5e88dbc commit 97501d8
Show file tree
Hide file tree
Showing 66 changed files with 1,254 additions and 856 deletions.
6 changes: 6 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="wc" />
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="wc-altme" />
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
Expand Down
10 changes: 10 additions & 0 deletions ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,16 @@
<string>openid</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>wc-altme</string>
<key>CFBundleURLSchemes</key>
<array>
<string>wc-altme</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
Expand Down
2 changes: 2 additions & 0 deletions lib/app/shared/constants/secure_storage_keys.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,6 @@ class SecureStorageKeys {
static const String buildNumber = 'buildNumber';

static const String hasVerifiedMnemonics = 'hasVerifiedMnemonics';

static const String oidc4vcType = 'oidc4vcType';
}
210 changes: 210 additions & 0 deletions lib/app/shared/enum/type/oidc4vc_type.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
import 'package:dio/dio.dart';
import 'package:oidc4vc/oidc4vc.dart';

enum OIDC4VCType {
EBSIV2(
issuerVcType: 'jwt_vc',
verifierVpType: 'jwt_vp',
offerPrefix: 'openid://initiate_issuance',
presentationPrefix: 'openid-vc://',
cryptographicBindingMethodsSupported: ['DID'],
cryptographicSuitesSupported: [
'ES256K',
'ES256',
'ES384',
'ES512',
'RS256'
],
subjectSyntaxTypesSupported: ['did:ebsi'],
grantTypesSupported: [
'authorization_code',
'urn:ietf:params:oauth:grant-type:pre-authorized_code'
],
credentialSupported: ['VerifiableDiploma', 'VerifiableId'],
schemaForType: true,
oidc4VciDraft:
'https://openid.net/specs/openid-connect-4-verifiable-credential-issuance-1_0-05.html#abstract',
siopv2Draft: '',
serviceDocumentation:
'It is the profile of the EBSI V2 compliant test. DID for natural person is did:ebsi. The schema url is used as the VC type in the credential offer QR code. The prefix openid_initiate_issuance://',
),

EBSIV3(
issuerVcType: 'jwt_vc',
verifierVpType: 'jwt_vp',
offerPrefix: 'openid://initiate_issuance',
presentationPrefix: 'openid-vc://',
cryptographicBindingMethodsSupported: ['DID'],
credentialSupported: ['VerifiableDiploma', 'VerifiableId'],
grantTypesSupported: [
'authorization_code',
'urn:ietf:params:oauth:grant-type:pre-authorized_code'
],
cryptographicSuitesSupported: [
'ES256K',
'ES256',
'ES384',
'ES512',
'RS256'
],
subjectSyntaxTypesSupported: ['did:key'],
schemaForType: false,
oidc4VciDraft:
'https://openid.net/specs/openid-4-verifiable-credential-issuance-1_0.html',
siopv2Draft: '',
serviceDocumentation: '',
),

GAIAX(
issuerVcType: 'ldp_vc',
verifierVpType: 'ldp_vp',
offerPrefix: 'openid-initiate-issuance://',
presentationPrefix: 'openid-vc://',
cryptographicBindingMethodsSupported: ['DID'],
credentialSupported: ['EmployeeCredential'],
grantTypesSupported: [
'authorization_code',
'urn:ietf:params:oauth:grant-type:pre-authorized_code'
],
cryptographicSuitesSupported: [
'ES256K',
'ES256',
'ES384',
'ES512',
'RS256'
],
subjectSyntaxTypesSupported: ['did:key'],
schemaForType: false,
oidc4VciDraft:
'https://openid.net/specs/openid-4-verifiable-credential-issuance-1_0.html',
siopv2Draft: '',
serviceDocumentation: 'Issuer pour projet Docaposte Gaia-X',
),

DEFAULT(
issuerVcType: 'ldp_vc',
verifierVpType: 'ldp_vp',
offerPrefix: 'openid-credential-offer://',
presentationPrefix: 'openid-vc://',
cryptographicBindingMethodsSupported: ['DID'],
credentialSupported: [],
grantTypesSupported: [
'authorization_code',
'urn:ietf:params:oauth:grant-type:pre-authorized_code'
],
cryptographicSuitesSupported: [
'ES256K',
'ES256',
'ES384',
'ES512',
'RS256'
],
subjectSyntaxTypesSupported: ['did:ebsi', 'did:key', 'did:ethr', 'did:tz'],
schemaForType: false,
oidc4VciDraft:
'https://openid.net/specs/openid-4-verifiable-credential-issuance-1_0.html',
siopv2Draft: '',
serviceDocumentation: 'Last release of the OIDC4VC documentation',
),

ARF(
issuerVcType: 'jwt_vc',
verifierVpType: 'jwt_vp',
offerPrefix: 'openid-credential-offer://',
presentationPrefix: 'openid-vc://',
cryptographicBindingMethodsSupported: ['DID'],
credentialSupported: [],
grantTypesSupported: [
'authorization_code',
'urn:ietf:params:oauth:grant-type:pre-authorized_code'
],
cryptographicSuitesSupported: [
'ES256K',
'ES256',
'ES384',
'ES512',
'RS256'
],
subjectSyntaxTypesSupported: ['did:ebsi', 'did:key', 'did:ethr', 'did:tz'],
schemaForType: false,
oidc4VciDraft: '',
siopv2Draft: '',
serviceDocumentation: '',
),

JWTVC(
issuerVcType: 'jwt_vc',
offerPrefix: '',
verifierVpType: 'jwt_vp',
presentationPrefix: 'openid-vc://',
cryptographicBindingMethodsSupported: ['DID'],
credentialSupported: [],
grantTypesSupported: [],
cryptographicSuitesSupported: [
'ES256K',
'ES256',
'ES384',
'ES512',
'RS256'
],
subjectSyntaxTypesSupported: ['did:ion'],
schemaForType: false,
oidc4VciDraft: '',
siopv2Draft: '',
serviceDocumentation: '',
);

const OIDC4VCType({
required this.issuerVcType,
required this.verifierVpType,
required this.offerPrefix,
required this.presentationPrefix,
required this.cryptographicBindingMethodsSupported,
required this.cryptographicSuitesSupported,
required this.subjectSyntaxTypesSupported,
required this.grantTypesSupported,
required this.credentialSupported,
required this.schemaForType,
required this.oidc4VciDraft,
required this.siopv2Draft,
required this.serviceDocumentation,
});

final String issuerVcType;
final String verifierVpType;
final String offerPrefix;
final String presentationPrefix;
final List<String> cryptographicBindingMethodsSupported;
final List<String> cryptographicSuitesSupported;
final List<String> subjectSyntaxTypesSupported;
final List<String> grantTypesSupported;
final List<String> credentialSupported;
final bool schemaForType;
final String oidc4VciDraft;
final String siopv2Draft;
final String serviceDocumentation;
}

extension OIDC4VCTypeX on OIDC4VCType {
OIDC4VC get getOIDC4VC {
return OIDC4VC(
client: Dio(),
oidc4vcModel: OIDC4VCModel(
issuerVcType: issuerVcType,
verifierVpType: verifierVpType,
offerPrefix: offerPrefix,
presentationPrefix: presentationPrefix,
cryptographicBindingMethodsSupported:
cryptographicBindingMethodsSupported,
cryptographicSuitesSupported: cryptographicSuitesSupported,
subjectSyntaxTypesSupported: subjectSyntaxTypesSupported,
grantTypesSupported: grantTypesSupported,
credentialSupported: credentialSupported,
schemaForType: schemaForType,
oidc4VciDraft: oidc4VciDraft,
siopv2Draft: siopv2Draft,
serviceDocumentation: serviceDocumentation,
),
);
}
}
1 change: 1 addition & 0 deletions lib/app/shared/enum/type/type.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ export 'credential_subject_type/credential_subject_type.dart';
export 'import_wallet_types.dart';
export 'kyc_vc_type.dart';
export 'message_type/message_type.dart';
export 'oidc4vc_type.dart';
export 'wallet_route_type.dart';
export 'wallet_type.dart';
File renamed without changes.
3 changes: 2 additions & 1 deletion lib/app/shared/widget/widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ export 'dialog/dialog.dart';
export 'dialog_close_button.dart';
export 'display_terms.dart';
export 'error_view.dart';
export 'grouped_section.dart';
export 'hero_workaround.dart';
export 'image_card_text.dart';
export 'imported_tag.dart';
export 'imported_tag.dart';
export 'm_webview/m_webview.dart';
export 'mnemonic.dart';
export 'my_rich_text.dart';
Expand Down
3 changes: 1 addition & 2 deletions lib/app/view/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import 'package:beacon_flutter/beacon_flutter.dart';
import 'package:device_preview/device_preview.dart';
import 'package:did_kit/did_kit.dart';
import 'package:dio/dio.dart';
import 'package:ebsi/ebsi.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
Expand Down Expand Up @@ -144,7 +143,7 @@ class App extends StatelessWidget {
credentialsCubit: context.read<CredentialsCubit>(),
didKitProvider: DIDKitProvider(),
secureStorageProvider: secure_storage.getSecureStorage,
ebsi: Ebsi(Dio()),
profileCubit: context.read<ProfileCubit>(),
),
),
BlocProvider<QRCodeScanCubit>(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import 'package:altme/app/app.dart';
import 'package:altme/dashboard/dashboard.dart';
import 'package:altme/l10n/l10n.dart';
import 'package:altme/theme/theme.dart';
import 'package:dio/dio.dart';
import 'package:ebsi/ebsi.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:secure_storage/secure_storage.dart';

class DidEbsiPrivateKeyPage extends StatefulWidget {
Expand All @@ -27,9 +27,11 @@ class _DidEbsiPrivateKeyPageState extends State<DidEbsiPrivateKeyPage>
late AnimationController animationController;

Future<String> getPrivateKey() async {
final ebsi = Ebsi(Dio());
final oidc4vc =
context.read<ProfileCubit>().state.model.oidc4vcType.getOIDC4VC;
final mnemonic = await getSecureStorage.get(SecureStorageKeys.ssiMnemonic);
final privateKey = await ebsi.privateKeyFromMnemonic(mnemonic: mnemonic!);
final privateKey =
await oidc4vc.privateKeyFromMnemonic(mnemonic: mnemonic!);
return privateKey;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import 'package:altme/app/app.dart';
import 'package:altme/dashboard/drawer/drawer.dart';
import 'package:altme/dashboard/dashboard.dart';
import 'package:altme/l10n/l10n.dart';
import 'package:dio/dio.dart';
import 'package:ebsi/ebsi.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:secure_storage/secure_storage.dart';

class ManageDidEbsiPage extends StatelessWidget {
class ManageDidEbsiPage extends StatefulWidget {
const ManageDidEbsiPage({super.key});

static Route<dynamic> route() {
Expand All @@ -16,11 +15,18 @@ class ManageDidEbsiPage extends StatelessWidget {
);
}

@override
State<ManageDidEbsiPage> createState() => _ManageDidEbsiPageState();
}

class _ManageDidEbsiPageState extends State<ManageDidEbsiPage> {
Future<String> getDid() async {
final ebsi = Ebsi(Dio());
final oidc4vc =
context.read<ProfileCubit>().state.model.oidc4vcType.getOIDC4VC;
final mnemonic = await getSecureStorage.get(SecureStorageKeys.ssiMnemonic);
final privateKey = await ebsi.privateKeyFromMnemonic(mnemonic: mnemonic!);
final did = await ebsi.getDidFromMnemonic(null, privateKey);
final privateKey =
await oidc4vc.privateKeyFromMnemonic(mnemonic: mnemonic!);
final did = await oidc4vc.getDidFromMnemonic(null, privateKey);
return did;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export 'grouped_section.dart';
export 'issuer_verifier_selector.dart';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export 'view/oidc4vc_profile_page.dart';
Loading

0 comments on commit 97501d8

Please sign in to comment.