Skip to content

Commit

Permalink
Merge branch 'main' into TALAO
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkbee1 committed May 27, 2024
2 parents bd5049c + 53a1fd4 commit 944fc8d
Show file tree
Hide file tree
Showing 96 changed files with 1,493 additions and 779 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/credential_manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ on: [ pull_request, push ]

jobs:
build:
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/flutter_package.yml@v1
uses: TalaoDAO/AltMe/.github/workflows/flutter_package.yaml@main
with:
flutter_channel: stable
flutter_version: 2.10.0
min_coverage: 95
flutter_version: 3.19.6
min_coverage: 30
working_directory: packages/credential_manifest
dart_sdk: 3.3.4
7 changes: 4 additions & 3 deletions .github/workflows/cryptocurrency_keys.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ on: [ pull_request, push ]

jobs:
build:
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/flutter_package.yml@v1
uses: TalaoDAO/AltMe/.github/workflows/flutter_package.yaml@main
with:
flutter_channel: stable
flutter_version: 2.10.0
min_coverage: 95
flutter_version: 3.19.6
min_coverage: 30
working_directory: packages/cryptocurrency_keys
dart_sdk: 3.3.4
12 changes: 0 additions & 12 deletions .github/workflows/didkit.yaml

This file was deleted.

134 changes: 134 additions & 0 deletions .github/workflows/flutter_package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
name: Flutter Package Workflow

on:
workflow_call:
inputs:
analyze_directories:
required: false
type: string
default: "lib test"
concurrency:
required: false
type: number
default: 4
coverage_excludes:
required: false
type: string
default: ""
flutter_channel:
required: false
type: string
default: "stable"
dart_sdk:
required: false
type: string
default: ""
flutter_version:
required: false
type: string
default: ""
format_directories:
required: false
type: string
default: "lib test"
format_line_length:
required: false
type: string
default: "80"
min_coverage:
required: false
type: number
default: 100
runs_on:
required: false
type: string
default: "ubuntu-latest"
setup:
required: false
type: string
default: ""
test_optimization:
required: false
type: boolean
default: true
test_recursion:
required: false
type: boolean
default: false
working_directory:
required: false
type: string
default: "."
package_get_excludes:
required: false
type: string
default: "!*"
build_runner:
required: false
type: boolean
default: true
secrets:
ssh_key:
required: false

jobs:
build:
defaults:
run:
working-directory: ${{inputs.working_directory}}

runs-on: ${{inputs.runs_on}}

steps:
- name: 📚 Git Checkout
uses: actions/checkout@v4

- name: 🐦 Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{inputs.flutter_version}}
channel: ${{inputs.flutter_channel}}
cache: true
cache-key: flutter-:os:-:channel:-:version:-:arch:-:hash:-${{ hashFiles('**/pubspec.lock') }}

- name: 🤫 Set SSH Key
env:
ssh_key: ${{secrets.ssh_key}}
if: env.ssh_key != null
uses: webfactory/[email protected]
with:
ssh-private-key: ${{secrets.ssh_key}}

- name: 📦 Install Dependencies
run: |
flutter pub global activate very_good_cli
very_good packages get --recursive --ignore=${{inputs.package_get_excludes}}
- name: ⚙️ Run Setup
if: "${{inputs.setup != ''}}"
run: ${{inputs.setup}}

- name: ✨ Check Formatting
run: dart format --line-length ${{inputs.format_line_length}} --set-exit-if-changed ${{inputs.format_directories}}

- name: 🎯 Setup Dart
uses: dart-lang/setup-dart@v1
with:
sdk: ${{inputs.dart_sdk}}

- name: ⚙️ build with build_runner
if: ${{inputs.build_runner}}
run: dart run build_runner build --delete-conflicting-outputs

- name: 🕵️ Analyze
run: flutter analyze ${{inputs.analyze_directories}}

- name: 🧪 Run Tests
run: very_good test -j ${{inputs.concurrency}} ${{(inputs.test_recursion && '--recursive') || ''}} ${{(inputs.test_optimization && '--optimization') || '--no-optimization'}} --coverage --test-randomize-ordering-seed random

- name: 📊 Check Code Coverage
uses: VeryGoodOpenSource/very_good_coverage@v3
with:
path: ${{inputs.working_directory}}/coverage/lcov.info
exclude: ${{inputs.coverage_excludes}}
min_coverage: ${{inputs.min_coverage}}
19 changes: 0 additions & 19 deletions .github/workflows/issues.yml

This file was deleted.

8 changes: 5 additions & 3 deletions .github/workflows/jwt_decode.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ on: [ pull_request, push ]

jobs:
build:
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/flutter_package.yml@v1
uses: TalaoDAO/AltMe/.github/workflows/flutter_package.yaml@main
with:
flutter_channel: stable
flutter_version: 2.10.0
min_coverage: 95
flutter_version: 3.19.6
min_coverage: 30
working_directory: packages/jwt_decode
dart_sdk: 3.3.4
build_runner: false
14 changes: 14 additions & 0 deletions .github/workflows/key_generator.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: key_generator

on: [ pull_request, push ]

jobs:
build:
uses: TalaoDAO/AltMe/.github/workflows/flutter_package.yaml@main
with:
flutter_channel: stable
flutter_version: 3.19.6
min_coverage: 30
working_directory: packages/key_generator
dart_sdk: 3.3.4
build_runner: false
12 changes: 0 additions & 12 deletions .github/workflows/main.yaml

This file was deleted.

14 changes: 14 additions & 0 deletions .github/workflows/polygonid.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: polygonid

on: [ pull_request, push ]

jobs:
build:
uses: TalaoDAO/AltMe/.github/workflows/flutter_package.yaml@main
with:
flutter_channel: stable
flutter_version: 3.19.6
min_coverage: 30
working_directory: packages/polygonid
dart_sdk: 3.3.4
build_runner: false
12 changes: 0 additions & 12 deletions .github/workflows/secure_storage.yaml

This file was deleted.

1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Talao

![coverage][coverage_badge]
[![style: very good analysis][very_good_analysis_badge]][very_good_analysis_link]
[![License: MIT][license_badge]][license_link]

Expand Down
2 changes: 1 addition & 1 deletion lib/app/shared/constants/parameters.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Parameters {
static const web3RpcMainnetUrl = 'https://mainnet.infura.io/v3/';

static const POLYGON_MAIN_NETWORK = 'main';
static const INFURA_URL = 'https://polygon-mainnet.infura.io/v3/';
static const POLYGON_INFURA_URL = 'https://polygon-mainnet.infura.io/v3/';
static const INFURA_RDP_URL = 'wss://polygon-mainnet.infura.io/v3/';
static const ID_STATE_CONTRACT_ADDR =
'0x624ce98D2d27b20b8f8d521723Df8fC4db71D79D';
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 @@ -37,6 +37,8 @@ class SecureStorageKeys {
static const String ssiKey = 'ssi/key';

static const String p256PrivateKeyForWallet = 'p256PrivateKeyForWallet';
static const String p256PrivateKeyToGetAndPresentVC =
'p256PrivateKeyToGetAndPresentVC';

static const String cryptoAccount = 'cryptoAccount';
static const String cryptoAccounTrackingIndex = 'cryptoAccounTrackingIndex';
Expand Down
14 changes: 12 additions & 2 deletions lib/app/shared/enum/type/blockchain_type.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,12 @@ extension BlockchainTypeX on BlockchainType {
String name = '';
switch (this) {
case BlockchainType.tezos:
throw Exception();
throw ResponseMessage(
data: {
'error': 'invalid_request',
'error_description': 'Chain is not supported for tezos.',
},
);

case BlockchainType.ethereum:
name = '1';
Expand All @@ -87,7 +92,12 @@ extension BlockchainTypeX on BlockchainType {
int get chainId {
switch (this) {
case BlockchainType.tezos:
throw Exception();
throw ResponseMessage(
data: {
'error': 'invalid_request',
'error_description': 'Chain is not supported for tezos.',
},
);

case BlockchainType.ethereum:
return 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,12 @@ extension CredentialSubjectTypeExtension on CredentialSubjectType {
} else if (this == CredentialSubjectType.ageRange) {
return Urls.ageRangeAIValidationUrl;
} else {
throw Exception();
throw ResponseMessage(
data: {
'error': 'invalid_request',
'error_description': 'Url is not specified for $name.',
},
);
}
}

Expand Down Expand Up @@ -672,6 +677,7 @@ extension CredentialSubjectTypeExtension on CredentialSubjectType {
VCFormatType.ldpVc,
VCFormatType.jwtVcJson,
VCFormatType.vcSdJWT,
VCFormatType.jwtVc,
];

case CredentialSubjectType.identityCredential:
Expand Down Expand Up @@ -894,6 +900,8 @@ extension CredentialSubjectTypeExtension on CredentialSubjectType {

if (vcFormatType == VCFormatType.vcSdJWT) {
type = 'identitycredential';
} else if (vcFormatType == VCFormatType.jwtVc) {
type = 'individualverifiableattestation';
}

link = '${Urls.id360Url}'
Expand Down
14 changes: 14 additions & 0 deletions lib/app/shared/extension/double_extension.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
extension DoubleExtension on double {
String decimalNumber(int n) {
int number = 1;
for (int i = 0; i < n; i++) {
if (i > toString().split('.').toList().last.length) {
break;
}
number *= 10;
}

final twoDecimalNumber = (this * number).floor() / number;
return twoDecimalNumber.toString();
}
}
1 change: 1 addition & 0 deletions lib/app/shared/extension/extension.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export 'bigint_extension.dart';
export 'credential_status.dart';
export 'double_extension.dart';
export 'iterable_extension.dart';
export 'string_extension.dart';
export 'unit8List_extension.dart';
Loading

0 comments on commit 944fc8d

Please sign in to comment.