Skip to content

Commit

Permalink
Merge branch 'main' into main_android
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkbee1 committed Jun 10, 2024
2 parents c0ef3d8 + 1df4df0 commit 979166e
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 32 deletions.
16 changes: 15 additions & 1 deletion .github/workflows/flutter_package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,23 @@ jobs:

- name: 📦 Install Dependencies
run: |
if grep -q 'path: ../../../didkit/lib/flutter' ../did_kit/pubspec.yaml; then
sed -i 's|path: ../../../didkit/lib/flutter|git:\n url: https://github.com/spruceid/didkit.git\n path: lib/flutter|' ../did_kit/pubspec.yaml
fi
flutter pub global activate very_good_cli
very_good packages get --recursive --ignore=${{inputs.package_get_excludes}}
- name: 📦 Run build_runner for nested package if necessary
run: |
if grep -q 'path: ../credential_manifest' pubspec.yaml; then
initial_dir=$(pwd)
echo $initial_dir
cd ../credential_manifest
flutter pub get
dart pub run build_runner build --delete-conflicting-outputs
cd $initial_dir
fi
- name: ⚙️ Run Setup
if: "${{inputs.setup != ''}}"
run: ${{inputs.setup}}
Expand Down Expand Up @@ -131,4 +145,4 @@ jobs:
with:
path: ${{inputs.working_directory}}/coverage/lcov.info
exclude: ${{inputs.coverage_excludes}}
min_coverage: ${{inputs.min_coverage}}
min_coverage: ${{inputs.min_coverage}}
3 changes: 1 addition & 2 deletions lib/dashboard/drawer/src/view/drawer_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@ class DrawerView extends StatelessWidget {
],

if (profileModel
.profileSetting.settingsMenu.displayDeveloperMode &&
profileModel.profileType != ProfileType.defaultOne) ...[
.profileSetting.settingsMenu.displayDeveloperMode) ...[
DrawerCategoryItem(
title: l10n.developerMode,
subTitle: l10n.developerModeSubtitle,
Expand Down
12 changes: 9 additions & 3 deletions lib/oidc4vc/get_authorization_uri_for_issuer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,11 @@ Future<void> getAuthorizationUriForIssuer({

late Uri authorizationUri;

final (authorizationEndpoint, authorizationRequestParemeters) =
await oidc4vc.getAuthorizationData(
final (
authorizationEndpoint,
authorizationRequestParemeters,
openIdConfiguration
) = await oidc4vc.getAuthorizationData(
selectedCredentials: selectedCredentials,
clientId: clientId,
clientSecret: clientSecret,
Expand All @@ -97,7 +100,10 @@ Future<void> getAuthorizationUriForIssuer({
secureAuthorizedFlow: secureAuthorizedFlow,
);

if (secureAuthorizedFlow) {
final requirePushedAuthorizationRequests =
openIdConfiguration.requirePushedAuthorizationRequests;

if (requirePushedAuthorizationRequests || secureAuthorizedFlow) {
final headers = <String, dynamic>{
'Content-Type': 'application/x-www-form-urlencoded',
};
Expand Down
4 changes: 4 additions & 0 deletions packages/oidc4vc/lib/src/models/openid_configuration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ part 'openid_configuration.g.dart';
@JsonSerializable()
class OpenIdConfiguration extends Equatable {
const OpenIdConfiguration({
required this.requirePushedAuthorizationRequests,
this.authorizationServer,
this.credentialsSupported,
this.credentialConfigurationsSupported,
Expand Down Expand Up @@ -60,6 +61,8 @@ class OpenIdConfiguration extends Equatable {
final String? issuer;
@JsonKey(name: 'jwks_uri')
final String? jwksUri;
@JsonKey(name: 'require_pushed_authorization_requests', defaultValue: false)
final bool requirePushedAuthorizationRequests;
@JsonKey(name: 'grant_types_supported')
final List<String>? grantTypesSupported;

Expand All @@ -83,6 +86,7 @@ class OpenIdConfiguration extends Equatable {
credentialManifests,
issuer,
jwksUri,
requirePushedAuthorizationRequests,
grantTypesSupported,
];
}
Expand Down
45 changes: 33 additions & 12 deletions packages/oidc4vc/lib/src/oidc4vc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,10 @@ class OIDC4VC {
/// Received JWT is already filtered on required members
/// Received JWT keys are already sorted in lexicographic order
/// authorization endpoint, authorizationRequestParemeters
Future<(String, Map<String, dynamic>)> getAuthorizationData({
/// authorization endpoint, authorizationRequestParemeters,
/// OpenIdConfiguration
Future<(String, Map<String, dynamic>, OpenIdConfiguration)>
getAuthorizationData({
required List<dynamic> selectedCredentials,
required String? clientId,
required String? clientSecret,
Expand Down Expand Up @@ -181,7 +183,11 @@ class OIDC4VC {
secureAuthorizedFlow: secureAuthorizedFlow,
);

return (authorizationEndpoint, authorizationRequestParemeters);
return (
authorizationEndpoint,
authorizationRequestParemeters,
openIdConfiguration,
);
} catch (e) {
throw Exception('NOT_A_VALID_OPENID_URL');
}
Expand Down Expand Up @@ -331,8 +337,9 @@ class OIDC4VC {
if (secureAuthorizedFlow) {
myRequest['client_metadata'] =
Uri.encodeComponent(jsonEncode(clientMetaData));
} else {
} else if (clientAuthentication != ClientAuthentication.clientSecretJwt) {
myRequest['client_metadata'] = jsonEncode(clientMetaData);
// paramètre config du portail, on ne met pas si : client authentication :
}
switch (clientAuthentication) {
case ClientAuthentication.none:
Expand All @@ -347,9 +354,13 @@ class OIDC4VC {
myRequest['client_id'] = clientId;
case ClientAuthentication.clientSecretJwt:
myRequest['client_id'] = clientId;
myRequest['client_assertion'] = clientAssertion;
myRequest['client_assertion_type'] =
'urn:ietf:params:oauth:client-assertion-type:jwt-client-attestation';
if (secureAuthorizedFlow ||
openIdConfiguration.requirePushedAuthorizationRequests) {
myRequest['client_assertion'] = clientAssertion;
myRequest['client_assertion_type'] =
// ignore: lines_longer_than_80_chars
'urn:ietf:params:oauth:client-assertion-type:jwt-client-attestation';
}
}

if (scope) {
Expand Down Expand Up @@ -769,11 +780,21 @@ class OIDC4VC {

return response as Map<String, dynamic>;
} else {
final didDocument = await dio.get<dynamic>(
'https://unires:[email protected]/1.0/identifiers/$didKey',
);

return didDocument.data as Map<String, dynamic>;
try {
final didDocument = await dio.get<dynamic>(
'https://unires:[email protected]/1.0/identifiers/$didKey',
);
return didDocument.data as Map<String, dynamic>;
} catch (e) {
try {
final didDocument = await dio.get<dynamic>(
'https://dev.uniresolver.io/1.0/identifiers/$didKey',
);
return didDocument.data as Map<String, dynamic>;
} catch (e) {
rethrow;
}
}
}
} catch (e) {
rethrow;
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: altme
description: AltMe Flutter App
version: 2.6.0+460
version: 2.7.0+463

environment:
sdk: ">=3.1.0 <4.0.0"
Expand Down
26 changes: 13 additions & 13 deletions script.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@

function pub {
fvm flutter clean
flutter clean
for d in `ls packages`;
do
(
cd "packages/$d"
fvm flutter clean
fvm flutter pub get
fvm flutter pub upgrade
flutter clean
flutter pub get
flutter pub upgrade
)
done
fvm flutter pub get
fvm flutter pub upgrade
flutter pub get
flutter pub upgrade
}

function buildRunner {
Expand All @@ -21,10 +21,10 @@ function buildRunner {
(
echo "$d"
cd "packages/$d"
fvm flutter packages pub run build_runner build --delete-conflicting-outputs
dart pub run build_runner build --delete-conflicting-outputs
)
done
fvm flutter packages pub run build_runner build --delete-conflicting-outputs
dart pub run build_runner build --delete-conflicting-outputs
}

function podUpdate {
Expand All @@ -41,17 +41,17 @@ function podUpdate {
if [[ "$*" == *-runDev* ]];
then
echo "flutter run development"
fvm flutter run --flavor development --target lib/main_development.dart
flutter run --flavor development --target lib/main_development.dart

elif [[ "$*" == *-runstage* ]];
then
echo "flutter run staging"
fvm flutter run --flavor staging --target lib/main_staging.dart
flutter run --flavor staging --target lib/main_staging.dart

elif [[ "$*" == *-run* ]];
then
echo "flutter run production"
fvm flutter run --flavor production --target lib/main_production.dart
flutter run --flavor production --target lib/main_production.dart

elif [[ "$*" == *-pod* ]];
then
Expand All @@ -62,7 +62,7 @@ then
buildRunner
echo "deploy android"
echo "Make sure you are in right branch"
fvm flutter build appbundle --flavor "production" --target "lib/main_production.dart"
flutter build appbundle --flavor "production" --target "lib/main_production.dart"
# cd android
# fastlane deploy
echo "app bundle deployed on internal testing track"
Expand All @@ -74,7 +74,7 @@ then
podUpdate
echo "deploy ios"
echo "Make sure you are in right branch"
fvm flutter build ios --release --flavor "production" --target "lib/main_production.dart"
flutter build ios --release --flavor "production" --target "lib/main_production.dart"
cd ios
fastlane beta
elif [[ "$*" == *-pub* ]];
Expand Down

0 comments on commit 979166e

Please sign in to comment.