├── .gitattributes ├── .gitignore ├── .gitlab-ci.yml ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── magic-dart-auth-sdk ├── .firebaserc ├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── bin │ └── main.dart ├── build.yaml ├── coverage │ └── test │ │ ├── app_test.dart.vm.json │ │ └── firebase_dart_auth_test.dart.vm.json ├── example │ ├── .DS_Store │ ├── README.md │ ├── magic--dart-auth-sdk-react-app │ │ └── placeholder.txt │ ├── magic-dart-auth-sdk-compose-app │ │ └── placeholder.txt │ ├── magic-dart-auth-sdk-dart-web-app │ │ └── placeholder.txt │ ├── magic-dart-auth-sdk-flutter-desktop-app │ │ └── placeholder.txt │ ├── magic-dart-auth-sdk-flutter-games-app │ │ └── placeholder.txt │ ├── magic-dart-auth-sdk-flutter-mobile-app │ │ ├── .fvm │ │ │ ├── flutter_sdk │ │ │ ├── flutter_sdk~origin_development │ │ │ ├── fvm_config.json │ │ │ ├── release │ │ │ ├── version │ │ │ └── versions │ │ │ │ ├── 3.22.3 │ │ │ │ └── 3.22.3~origin_development │ │ ├── .fvmrc │ │ ├── .gitignore │ │ ├── .metadata │ │ ├── Dockerfile │ │ ├── README.md │ │ ├── analysis_options.yaml │ │ ├── android │ │ │ ├── .gitignore │ │ │ ├── app │ │ │ │ ├── build.gradle.kts │ │ │ │ ├── oldbuild.gradle │ │ │ │ └── src │ │ │ │ │ ├── debug │ │ │ │ │ └── AndroidManifest.xml │ │ │ │ │ ├── main │ │ │ │ │ ├── AndroidManifest.xml │ │ │ │ │ ├── kotlin │ │ │ │ │ │ └── com │ │ │ │ │ │ │ └── aortem │ │ │ │ │ │ │ └── firebase │ │ │ │ │ │ │ └── dart │ │ │ │ │ │ │ └── admin │ │ │ │ │ │ │ └── auth │ │ │ │ │ │ │ └── sample │ │ │ │ │ │ │ └── app │ │ │ │ │ │ │ └── MainActivity.kt │ │ │ │ │ └── res │ │ │ │ │ │ ├── drawable-v21 │ │ │ │ │ │ └── launch_background.xml │ │ │ │ │ │ ├── drawable │ │ │ │ │ │ └── launch_background.xml │ │ │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ │ ├── values-night │ │ │ │ │ │ └── styles.xml │ │ │ │ │ │ └── values │ │ │ │ │ │ └── styles.xml │ │ │ │ │ └── profile │ │ │ │ │ └── AndroidManifest.xml │ │ │ ├── build.gradle │ │ │ ├── gradle.properties │ │ │ ├── gradle │ │ │ │ └── wrapper │ │ │ │ │ └── gradle-wrapper.properties │ │ │ └── settings.gradle │ │ ├── assets │ │ │ └── service_account.json │ │ ├── build.yaml │ │ ├── ios │ │ │ ├── .gitignore │ │ │ ├── Flutter │ │ │ │ ├── AppFrameworkInfo.plist │ │ │ │ ├── Debug.xcconfig │ │ │ │ └── Release.xcconfig │ │ │ ├── Podfile │ │ │ ├── Podfile.lock │ │ │ ├── Runner.xcodeproj │ │ │ │ ├── project.pbxproj │ │ │ │ ├── project.xcworkspace │ │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ │ └── xcshareddata │ │ │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ │ │ └── WorkspaceSettings.xcsettings │ │ │ │ └── xcshareddata │ │ │ │ │ └── xcschemes │ │ │ │ │ └── Runner.xcscheme │ │ │ ├── Runner.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcshareddata │ │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ │ └── WorkspaceSettings.xcsettings │ │ │ ├── Runner │ │ │ │ ├── AppDelegate.swift │ │ │ │ ├── Assets.xcassets │ │ │ │ │ ├── AppIcon.appiconset │ │ │ │ │ │ ├── Contents.json │ │ │ │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ │ │ │ ├── Icon-App-20x20@1x.png │ │ │ │ │ │ ├── Icon-App-20x20@2x.png │ │ │ │ │ │ ├── Icon-App-20x20@3x.png │ │ │ │ │ │ ├── Icon-App-29x29@1x.png │ │ │ │ │ │ ├── Icon-App-29x29@2x.png │ │ │ │ │ │ ├── Icon-App-29x29@3x.png │ │ │ │ │ │ ├── Icon-App-40x40@1x.png │ │ │ │ │ │ ├── Icon-App-40x40@2x.png │ │ │ │ │ │ ├── Icon-App-40x40@3x.png │ │ │ │ │ │ ├── Icon-App-60x60@2x.png │ │ │ │ │ │ ├── Icon-App-60x60@3x.png │ │ │ │ │ │ ├── Icon-App-76x76@1x.png │ │ │ │ │ │ ├── Icon-App-76x76@2x.png │ │ │ │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ │ │ │ └── LaunchImage.imageset │ │ │ │ │ │ ├── Contents.json │ │ │ │ │ │ ├── LaunchImage.png │ │ │ │ │ │ ├── LaunchImage@2x.png │ │ │ │ │ │ ├── LaunchImage@3x.png │ │ │ │ │ │ └── README.md │ │ │ │ ├── Base.lproj │ │ │ │ │ ├── LaunchScreen.storyboard │ │ │ │ │ └── Main.storyboard │ │ │ │ └── Runner-Bridging-Header.h │ │ │ └── RunnerTests │ │ │ │ └── RunnerTests.swift │ │ ├── linux │ │ │ ├── .gitignore │ │ │ ├── CMakeLists.txt │ │ │ ├── flutter │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── generated_plugin_registrant.cc │ │ │ │ ├── generated_plugin_registrant.h │ │ │ │ └── generated_plugins.cmake │ │ │ ├── main.cc │ │ │ ├── my_application.cc │ │ │ └── my_application.h │ │ ├── macos │ │ │ ├── .gitignore │ │ │ ├── Flutter │ │ │ │ ├── Flutter-Debug.xcconfig │ │ │ │ ├── Flutter-Release.xcconfig │ │ │ │ └── GeneratedPluginRegistrant.swift │ │ │ ├── Podfile │ │ │ ├── Runner.xcodeproj │ │ │ │ ├── project.pbxproj │ │ │ │ ├── project.xcworkspace │ │ │ │ │ └── xcshareddata │ │ │ │ │ │ └── IDEWorkspaceChecks.plist │ │ │ │ └── xcshareddata │ │ │ │ │ └── xcschemes │ │ │ │ │ └── Runner.xcscheme │ │ │ ├── Runner.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcshareddata │ │ │ │ │ └── IDEWorkspaceChecks.plist │ │ │ ├── Runner │ │ │ │ ├── AppDelegate.swift │ │ │ │ ├── Assets.xcassets │ │ │ │ │ └── AppIcon.appiconset │ │ │ │ │ │ ├── Contents.json │ │ │ │ │ │ ├── app_icon_1024.png │ │ │ │ │ │ ├── app_icon_128.png │ │ │ │ │ │ ├── app_icon_16.png │ │ │ │ │ │ ├── app_icon_256.png │ │ │ │ │ │ ├── app_icon_32.png │ │ │ │ │ │ ├── app_icon_512.png │ │ │ │ │ │ └── app_icon_64.png │ │ │ │ ├── Base.lproj │ │ │ │ │ └── MainMenu.xib │ │ │ │ ├── Configs │ │ │ │ │ ├── AppInfo.xcconfig │ │ │ │ │ ├── Debug.xcconfig │ │ │ │ │ ├── Release.xcconfig │ │ │ │ │ └── Warnings.xcconfig │ │ │ │ ├── DebugProfile.entitlements │ │ │ │ ├── Info.plist │ │ │ │ ├── MainFlutterWindow.swift │ │ │ │ └── Release.entitlements │ │ │ └── RunnerTests │ │ │ │ └── RunnerTests.swift │ │ ├── pubspec.yaml │ │ ├── test │ │ │ └── widget_test.dart │ │ ├── web │ │ │ ├── favicon.png │ │ │ ├── icons │ │ │ │ ├── Icon-192.png │ │ │ │ ├── Icon-512.png │ │ │ │ ├── Icon-maskable-192.png │ │ │ │ └── Icon-maskable-512.png │ │ │ ├── index.html │ │ │ ├── manifest.json │ │ │ └── oauth_redirect.html │ │ └── windows │ │ │ ├── .gitignore │ │ │ ├── CMakeLists.txt │ │ │ ├── flutter │ │ │ ├── CMakeLists.txt │ │ │ ├── generated_plugin_registrant.cc │ │ │ ├── generated_plugin_registrant.h │ │ │ └── generated_plugins.cmake │ │ │ └── runner │ │ │ ├── CMakeLists.txt │ │ │ ├── Runner.rc │ │ │ ├── flutter_window.cpp │ │ │ ├── flutter_window.h │ │ │ ├── main.cpp │ │ │ ├── resource.h │ │ │ ├── resources │ │ │ └── app_icon.ico │ │ │ ├── runner.exe.manifest │ │ │ ├── utils.cpp │ │ │ ├── utils.h │ │ │ ├── win32_window.cpp │ │ │ └── win32_window.h │ ├── magic-dart-auth-sdk-flutter-web-app │ │ └── placeholder.txt │ ├── magic-dart-auth-sdk-svelte-app │ │ └── placeholder.txt │ └── magic-dart-auth-sdk-vue-app │ │ └── placeholder.txt ├── firebase-debug.log ├── firebase.json ├── lib │ ├── magic_dart_auth_sdk.dart │ └── src │ │ ├── auth │ │ ├── aortem_magic_issuer.dart │ │ ├── aortem_magic_public_address.dart │ │ ├── aortem_magic_token_decode.dart │ │ └── aortem_magic_token_validation.dart │ │ ├── core │ │ ├── aortem_magic_api_key_manager.dart │ │ └── aortem_magic_constructor.dart │ │ ├── logout │ │ ├── aortem_magic_logout_address.dart │ │ ├── aortem_magic_logout_issuer.dart │ │ └── aortem_magic_logout_token.dart │ │ ├── metadata │ │ ├── aortem_magic_address_metadata.dart │ │ ├── aortem_magic_issuer_metadata.dart │ │ └── aortem_magic_token_metadata.dart │ │ ├── multichain │ │ └── aortem_magic_multichain_metadata.dart │ │ └── utils │ │ ├── aortem_magic_parse_auth_header.dart │ │ └── aortem_magic_secure_storage.dart ├── local_dev_tools │ ├── README.md │ ├── validate_branch.dart │ ├── validate_commit.dart │ └── validate_commit_msg.dart ├── pubspec.yaml ├── test.json ├── test │ └── unit │ │ ├── auth │ │ ├── aortem_magic_issuer_test.dart │ │ ├── aortem_magic_public_address_test.dart │ │ ├── aortem_magic_token_decode_test.dart │ │ └── aortem_magic_token_validation_test.dart │ │ ├── core │ │ ├── aortem_magic_api_key_manager_test.dart │ │ └── aortem_magic_constructor_test.dart │ │ ├── logout │ │ ├── aortem_magic_logout_address_test.dart │ │ ├── aortem_magic_logout_issuer_test.dart │ │ └── aortem_magic_logout_token_test.dart │ │ ├── metadata │ │ ├── aortem_magic_address_metadata_test.dart │ │ ├── aortem_magic_issuer_metadata_test.dart │ │ └── aortem_magic_token_metadata_test.dart │ │ ├── multichain │ │ └── aortem_magic_multichain_metadata_test.dart │ │ └── utils │ │ └── aortem_magic_parse_auth_header_test.dart └── ui-debug.log └── tools ├── README.md └── pipelines ├── backend ├── child-ci-development.yml ├── child-ci-full-lifecycle.yml ├── child-ci-integration-tests.yml ├── child-ci-production.yml ├── child-ci-setup-pre-dev.yml ├── child-ci-setup-validation.yml └── child-ci-unit-tests.yml └── frontend └── child-ci-analyze-flutter-mobile.yml /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Global Repo Rules 2 | 3 | # Ignore all IDE settings 4 | .idea/ 5 | .vscode/ 6 | 7 | # Ignore Dart clocal build tools 8 | .dart_tool/ 9 | pubspec.lock 10 | 11 | -------------------------------------------------------------------------------- /.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | stages: 2 | - setup 3 | - validation 4 | - unit_testing 5 | - analyze_sample_apps 6 | 7 | # The pipeline covers a series of triggers to ensure full testing and coverage 8 | 9 | # Debug Stage 10 | debug_merge_request: 11 | stage: setup 12 | script: 13 | - echo "Basic Merge Request Variables..." 14 | - echo "CI_MERGE_REQUEST_IID is '$CI_MERGE_REQUEST_IID'" 15 | - echo "CI_MERGE_REQUEST_SOURCE_BRANCH_NAME is $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME" 16 | - echo "CI_MERGE_REQUEST_TARGET_BRANCH_NAME is $CI_MERGE_REQUEST_TARGET_BRANCH_NAME" 17 | - echo "CI_MERGE_REQUEST_EVENT_TYPE is $CI_MERGE_REQUEST_EVENT_TYPE" 18 | 19 | - echo "Commit Information Variables..." 20 | - echo "CI_COMMIT_REF_NAME is $CI_COMMIT_REF_NAME" 21 | - echo "CI_COMMIT_BRANCH is $CI_COMMIT_BRANCH" 22 | - echo "CI_COMMIT_MESSAGE is $CI_COMMIT_MESSAGE" 23 | 24 | - echo "Determining branch name..." 25 | - BRANCH_NAME=${CI_COMMIT_BRANCH:-${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME:-$CI_COMMIT_REF_NAME}} 26 | - echo "Branch name determined $BRANCH_NAME" 27 | 28 | - echo "Pipeline Metadata..." 29 | - echo "CI_PIPELINE_SOURCE is $CI_PIPELINE_SOURCE" 30 | rules: 31 | - if: '$CI_PIPELINE_SOURCE' # Forces execution in ALL scenarios 32 | when: always 33 | 34 | # Validate Conditional Triggers 35 | validation_trigger: 36 | stage: validation 37 | trigger: 38 | include: tools/pipelines/backend/child-ci-setup-validation.yml 39 | rules: 40 | # Condition 1: Branch is not main, qa, or development 41 | - if: '$CI_COMMIT_REF_NAME != "main" && $CI_COMMIT_REF_NAME != "qa" && $CI_COMMIT_REF_NAME != "development"' 42 | when: always 43 | 44 | # Condition 2: Triggered by a push event 45 | - if: '$CI_PIPELINE_SOURCE == "push"' 46 | when: always 47 | 48 | # Condition 3: Triggered by a merge request event (source branch is not "development") 49 | - if: '$CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME != "development"' 50 | when: always 51 | 52 | # Condition 4: Triggered by a merge request event (source branch is "development", "qa", or "main") 53 | - if: '$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME == "development" || $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME == "qa" || $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME == "main"' 54 | when: always 55 | 56 | # Fallback: Skip if no condition matches 57 | - when: never 58 | 59 | # Unit Test Conditional Triggers 60 | unit_test_trigger: 61 | stage: unit_testing 62 | trigger: 63 | include: tools/pipelines/backend/child-ci-unit-tests.yml 64 | needs: 65 | - job: validation_trigger 66 | rules: 67 | # Always runs after validation trigger 68 | - when: always 69 | 70 | # Analyze Conditional Triggers 71 | analyze_flutter_mobile: 72 | stage: analyze_sample_apps 73 | trigger: 74 | include: tools/pipelines/frontend/child-ci-analyze-flutter-mobile.yml 75 | needs: 76 | - job: unit_test_trigger 77 | rules: 78 | # Always runs after unit_test trigger 79 | - when: always -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2023, Aortem 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | 3. Neither the name of the copyright holder nor the names of its 16 | contributors may be used to endorse or promote products derived from 17 | this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 23 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 26 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 27 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/.firebaserc: -------------------------------------------------------------------------------- 1 | { 2 | "projects": { 3 | "default": "fire-base-dart-admin-auth-sdk" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/.gitignore: -------------------------------------------------------------------------------- 1 | # Add your own git ignore rules. 2 | 3 | # Ignore Flutter plugin files in example project 4 | /magic_dart_auth_sdk/example/magic-dart-auth-sdk-sample-app/.flutter-plugins 5 | /magic_dart_auth_sdk/example/magic-dart-auth-sdk-sample-app/.flutter-plugins-dependencies 6 | 7 | # Ignore macOS generated files in example project 8 | /magic_dart_auth_sdk/example/magic-dart-auth-sdk-sample-app/macos/Flutter/GeneratedPluginRegistrant.swift 9 | 10 | #Ignore Release Key 11 | /magic_dart_auth_sdk/example/magic-dart-auth-sdk-sample-app/magic_dart_auth_sdk-release-key.jks 12 | 13 | #Ignore Service Account JSON Key 14 | /magic_dart_auth_sdk/example/magic-dart-auth-sdk-sample-app/assets/service_account.json 15 | 16 | #Ignore Gradle Properties 17 | /magic_dart_auth_sdk/example/magic-dart-auth-sdk-sample-app/android/gradle.properties 18 | 19 | #Ignore Gradle Wrapper Properties 20 | /magic_dart_auth_sdk/example/magic-dart-auth-sdk-sample-app/android/gradle/wrapper/gradle-wrapper.properties -------------------------------------------------------------------------------- /magic-dart-auth-sdk/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 0.0.1-pre+2 2 | 3 | - update readme 4 | 5 | ## 0.0.1-pre+1 6 | 7 | - Add all methods 8 | - Resolve all issues detected by dart analyze. 9 | 10 | ## 0.0.1-pre 11 | 12 | - Initial pre-release version of the magic Dart Auth SDK. 13 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2023, Aortem 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | 3. Neither the name of the copyright holder nor the names of its 16 | contributors may be used to endorse or promote products derived from 17 | this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 23 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 26 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 27 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the static analysis results for your project (errors, 2 | # warnings, and lints). 3 | # 4 | # This enables the 'recommended' set of lints from `package:lints`. 5 | # This set helps identify many issues that may lead to problems when running 6 | # or consuming Dart code, and enforces writing Dart using a single, idiomatic 7 | # style and format. 8 | # 9 | # If you want a smaller set of lints you can change this to specify 10 | # 'package:lints/core.yaml'. These are just the most critical lints 11 | # (the recommended set includes the core lints). 12 | # The core lints are also what is used by pub.dev for scoring packages. 13 | 14 | include: package:lints/recommended.yaml 15 | 16 | # Uncomment the following section to specify additional rules. 17 | 18 | linter: 19 | rules: 20 | - public_member_api_docs 21 | 22 | # analyzer: 23 | # exclude: 24 | # - path/to/excluded/files/** 25 | 26 | # For more information about the core and recommended set of lints, see 27 | # https://dart.dev/go/core-lints 28 | 29 | # For additional information about configuring this file, see 30 | # https://dart.dev/guides/language/analysis-options 31 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/bin/main.dart: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/build.yaml: -------------------------------------------------------------------------------- 1 | #This file targets the root folder. The example folder contains it's own root. 2 | targets: 3 | $default: 4 | sources: 5 | include: 6 | - lib/** 7 | - test/** 8 | - bin/** 9 | exclude: 10 | - example/** 11 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/.DS_Store -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/README.md: -------------------------------------------------------------------------------- 1 | # Magic Dart Auth SDK 2 | 3 | Magic Dart Auth SDK provides seamless authentication with Transmit Security for Dart applications. It offers an intuitive setup process with API key management, environment switching, and secure configuration handling. 4 | 5 | ## Features 6 | - Easy authentication with Transmit Security 7 | - API key-based and configurable setup 8 | - Secure environment management 9 | - Token generation and validation 10 | - Support for multiple authentication flows 11 | 12 | ## Installation 13 | 14 | Add `magic_dart_auth_sdk` to your Dart project's dependencies: 15 | 16 | ```sh 17 | flutter pub add magic_dart_auth_sdk 18 | ``` 19 | 20 | or manually add it to `pubspec.yaml`: 21 | 22 | ```yaml 23 | dependencies: 24 | magic_dart_auth_sdk: latest_version 25 | ``` 26 | 27 | ## Usage 28 | 29 | ### Import the package 30 | 31 | ```dart 32 | import 'package:magic_dart_auth_sdk/magic_dart_auth_sdk.dart'; 33 | ``` 34 | 35 | ### Initialize the SDK 36 | 37 | ```dart 38 | final auth = MagicAuth( 39 | apiKey: 'your-api-key', 40 | environment: AuthEnvironment.production, 41 | ); 42 | ``` 43 | 44 | ### Authenticate User 45 | 46 | ```dart 47 | final authResponse = await auth.authenticate(username: 'user@example.com', password: 'password123'); 48 | 49 | if (authResponse.isSuccess) { 50 | print('User authenticated: ${authResponse.token}'); 51 | } else { 52 | print('Authentication failed: ${authResponse.error}'); 53 | } 54 | ``` 55 | 56 | ### Token Validation 57 | 58 | ```dart 59 | bool isValid = auth.validateToken('your-jwt-token'); 60 | print(isValid ? 'Token is valid' : 'Token is invalid'); 61 | ``` 62 | 63 | ## Configuration 64 | You can also configure the SDK using environment variables: 65 | 66 | ```dart 67 | final auth = MagicAuth.fromEnv(); 68 | ``` 69 | 70 | Set up environment variables: 71 | 72 | ```sh 73 | export MAGIC_AUTH_API_KEY='your-api-key' 74 | export MAGIC_AUTH_ENV='production' 75 | ``` 76 | 77 | ## License 78 | This project is licensed under the MIT License. 79 | 80 | --- 81 | 82 | For more details, check the official documentation or reach out for support. 83 | 84 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic--dart-auth-sdk-react-app/placeholder.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic--dart-auth-sdk-react-app/placeholder.txt -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-compose-app/placeholder.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic-dart-auth-sdk-compose-app/placeholder.txt -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-dart-web-app/placeholder.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic-dart-auth-sdk-dart-web-app/placeholder.txt -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-desktop-app/placeholder.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-desktop-app/placeholder.txt -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-games-app/placeholder.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-games-app/placeholder.txt -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/.fvm/flutter_sdk: -------------------------------------------------------------------------------- 1 | /Users/farimahpirahmadi/fvm/versions/3.22.3 -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/.fvm/flutter_sdk~origin_development: -------------------------------------------------------------------------------- 1 | /Users/farimahpirahmadi/fvm/versions/3.22.3 -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/.fvm/fvm_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "flutterSdkVersion": "3.22.3" 3 | } -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/.fvm/release: -------------------------------------------------------------------------------- 1 | 3.22.3 -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/.fvm/version: -------------------------------------------------------------------------------- 1 | 3.22.3 -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/.fvm/versions/3.22.3: -------------------------------------------------------------------------------- 1 | /Users/farimahpirahmadi/fvm/versions/3.22.3 -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/.fvm/versions/3.22.3~origin_development: -------------------------------------------------------------------------------- 1 | /Users/farimahpirahmadi/fvm/versions/3.22.3 -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/.fvmrc: -------------------------------------------------------------------------------- 1 | { 2 | "flutter": "3.22.3" 3 | } -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | **/doc/api/ 26 | **/ios/Flutter/.last_build_id 27 | .dart_tool/ 28 | .flutter-plugins 29 | .flutter-plugins-dependencies 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Symbolication related 35 | app.*.symbols 36 | 37 | # Obfuscation related 38 | app.*.map.json 39 | 40 | # Android Studio will place build artifacts here 41 | /android/app/debug 42 | /android/app/profile 43 | /android/app/release 44 | 45 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: "761747bfc538b5af34aa0d3fac380f1bc331ec49" 8 | channel: "stable" 9 | 10 | project_type: app 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 17 | base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 18 | - platform: android 19 | create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 20 | base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 21 | - platform: ios 22 | create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 23 | base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 24 | - platform: linux 25 | create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 26 | base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 27 | - platform: macos 28 | create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 29 | base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 30 | - platform: web 31 | create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 32 | base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 33 | - platform: windows 34 | create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 35 | base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49 36 | 37 | # User provided section 38 | 39 | # List of Local paths (relative to this file) that should be 40 | # ignored by the migrate tool. 41 | # 42 | # Files that are not part of the templates will be ignored by default. 43 | unmanaged_files: 44 | - 'lib/main.dart' 45 | - 'ios/Runner.xcodeproj/project.pbxproj' 46 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/Dockerfile: -------------------------------------------------------------------------------- 1 | # Use latest stable channel SDK. 2 | FROM dart:stable AS build 3 | 4 | # Resolve app dependencies. 5 | WORKDIR /app 6 | COPY pubspec.* ./ 7 | RUN dart pub get 8 | 9 | # Copy app source code (except anything in .dockerignore) and AOT compile app. 10 | COPY . . 11 | RUN dart compile exe bin/server.dart -o bin/server 12 | 13 | # Build minimal serving image from AOT-compiled `/server` 14 | # and the pre-built AOT-runtime in the `/runtime/` directory of the base image. 15 | FROM scratch 16 | COPY --from=build /runtime/ / 17 | COPY --from=build /app/bin/server /app/bin/ 18 | 19 | # Start server. 20 | EXPOSE 8000 21 | CMD ["/app/bin/server"] -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer, which statically analyzes Dart code to 2 | # check for errors, warnings, and lints. 3 | # 4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled 5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be 6 | # invoked from the command line by running `flutter analyze`. 7 | 8 | # The following line activates a set of recommended lints for Flutter apps, 9 | # packages, and plugins designed to encourage good coding practices. 10 | analyzer: 11 | errors: 12 | use_build_context_synchronously: ignore 13 | include: package:flutter_lints/flutter.yaml 14 | 15 | linter: 16 | # The lint rules applied to this project can be customized in the 17 | # section below to disable rules from the `package:flutter_lints/flutter.yaml` 18 | # included above or to enable additional rules. A list of all available lints 19 | # and their documentation is published at https://dart.dev/lints. 20 | # 21 | # Instead of disabling a lint rule for the entire project in the 22 | # section below, it can also be suppressed for a single line of code 23 | # or a specific dart file by using the `// ignore: name_of_lint` and 24 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 25 | # producing the lint. 26 | rules: 27 | # avoid_print: false # Uncomment to disable the `avoid_print` rule 28 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 29 | 30 | # Additional information about this file can be found at 31 | # https://dart.dev/guides/language/analysis-options 32 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/android/app/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import java.util.Properties 2 | import org.gradle.api.JavaVersion 3 | 4 | plugins { 5 | id("com.android.application") 6 | id("kotlin-android") 7 | id("dev.flutter.flutter-gradle-plugin") 8 | id("com.google.gms.google-services") version "4.4.2" apply false 9 | } 10 | 11 | // Load local properties from the local.properties file 12 | val localProperties = Properties() 13 | val localPropertiesFile = rootProject.file("local.properties") 14 | if (localPropertiesFile.exists()) { 15 | localPropertiesFile.reader(Charsets.UTF_8).use { reader -> 16 | localProperties.load(reader) 17 | } 18 | } 19 | 20 | // Set the Flutter version code and name from local properties, with default values if not defined 21 | val flutterVersionCode = localProperties.getProperty("flutter.versionCode")?.toIntOrNull() ?: 1 22 | val flutterVersionName = localProperties.getProperty("flutter.versionName") ?: "1.0" 23 | 24 | // Retrieve compileSdk, ndkVersion, minSdk, and targetSdk with default values in case they are not defined 25 | val compileSdkVersion = (project.findProperty("flutter.compileSdkVersion") as? String)?.toIntOrNull() ?: 35 // Default SDK version 26 | val ndkVersion = project.findProperty("flutter.ndkVersion") as? String ?: "21.1.6352462" // Default NDK version 27 | val minSdkVersion = (project.findProperty("flutter.minSdkVersion") as? String)?.toIntOrNull() ?: 33 28 | val targetSdkVersion = (project.findProperty("flutter.targetSdkVersion") as? String)?.toIntOrNull() ?: 35 29 | 30 | android { 31 | namespace = "com.aortem.firebase.dart.admin.auth.sample.app" 32 | compileSdk = compileSdkVersion?.toInt() ?: 34 33 | ndkVersion = ndkVersion 34 | 35 | compileOptions { 36 | sourceCompatibility = JavaVersion.VERSION_17 37 | targetCompatibility = JavaVersion.VERSION_17 38 | } 39 | 40 | kotlinOptions { 41 | jvmTarget = "17" 42 | } 43 | 44 | defaultConfig { 45 | applicationId = "com.aortem.firebase.dart.admin.auth.sample.app" 46 | minSdk = minSdkVersion 47 | targetSdk = targetSdkVersion 48 | versionCode = flutterVersionCode 49 | versionName = flutterVersionName 50 | } 51 | 52 | buildTypes { 53 | getByName("release") { 54 | signingConfig = signingConfigs.getByName("debug") 55 | } 56 | } 57 | } 58 | 59 | flutter { 60 | source = "../.." 61 | } 62 | 63 | dependencies { 64 | // Import the Firebase BoM 65 | implementation(platform("com.google.firebase:firebase-bom:33.5.1")) 66 | 67 | 68 | // TODO: Add the dependencies for Firebase products you want to use 69 | // When using the BoM, don't specify versions in Firebase dependencies 70 | implementation("com.google.firebase:firebase-analytics") 71 | 72 | 73 | // Add the dependencies for any other desired Firebase products 74 | // https://firebase.google.com/docs/android/setup#available-libraries 75 | } 76 | 77 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/android/app/oldbuild.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "com.android.application" 3 | id "kotlin-android" 4 | // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. 5 | id "dev.flutter.flutter-gradle-plugin" 6 | } 7 | 8 | def localProperties = new Properties() 9 | def localPropertiesFile = rootProject.file("local.properties") 10 | if (localPropertiesFile.exists()) { 11 | localPropertiesFile.withReader("UTF-8") { reader -> 12 | localProperties.load(reader) 13 | } 14 | } 15 | 16 | def flutterVersionCode = localProperties.getProperty("flutter.versionCode") 17 | if (flutterVersionCode == null) { 18 | flutterVersionCode = "1" 19 | } 20 | 21 | def flutterVersionName = localProperties.getProperty("flutter.versionName") 22 | if (flutterVersionName == null) { 23 | flutterVersionName = "1.0" 24 | } 25 | 26 | android { 27 | namespace = "com.aortem.firebase_dart_admin_auth_sample_app" 28 | compileSdk = flutter.compileSdkVersion 29 | ndkVersion = flutter.ndkVersion 30 | 31 | compileOptions { 32 | sourceCompatibility = JavaVersion.VERSION_17 33 | targetCompatibility = JavaVersion.VERSION_17 34 | } 35 | 36 | kotlinOptions { 37 | jvmTarget = JavaVersion.VERSION_17 38 | } 39 | 40 | defaultConfig { 41 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 42 | applicationId = "com.aortem.firebase_dart_admin_auth_sample_app" 43 | // You can update the following values to match your application needs. 44 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. 45 | minSdk = flutter.minSdkVersion 46 | targetSdk = flutter.targetSdkVersion 47 | versionCode = flutterVersionCode.toInteger() 48 | versionName = flutterVersionName 49 | } 50 | 51 | buildTypes { 52 | release { 53 | // TODO: Add your own signing config for the release build. 54 | // Signing with the debug keys for now, so `flutter run --release` works. 55 | signingConfig = signingConfigs.debug 56 | } 57 | } 58 | } 59 | 60 | flutter { 61 | source = "../.." 62 | } 63 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 18 | 19 | 23 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/android/app/src/main/kotlin/com/aortem/firebase/dart/admin/auth/sample/app/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.aortem.firebase.dart.admin.auth.sample.app 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() 6 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/android/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("com.google.gms.google-services") version "4.4.2" apply false 3 | } 4 | 5 | allprojects { 6 | repositories { 7 | google() 8 | mavenCentral() 9 | } 10 | } 11 | 12 | rootProject.buildDir = "../build" 13 | subprojects { 14 | project.buildDir = "${rootProject.buildDir}/${project.name}" 15 | } 16 | subprojects { 17 | project.evaluationDependsOn(":app") 18 | } 19 | 20 | tasks.register("clean", Delete) { 21 | delete rootProject.buildDir 22 | } 23 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx4G -XX:+HeapDumpOnOutOfMemoryError 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-all.zip -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/android/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | def flutterSdkPath = { 3 | def properties = new Properties() 4 | file("local.properties").withInputStream { properties.load(it) } 5 | def flutterSdkPath = properties.getProperty("flutter.sdk") 6 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 7 | return flutterSdkPath 8 | }() 9 | 10 | includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") 11 | 12 | repositories { 13 | google() 14 | mavenCentral() 15 | gradlePluginPortal() 16 | } 17 | } 18 | 19 | plugins { 20 | id "dev.flutter.flutter-plugin-loader" version "1.0.0" 21 | id "com.android.application" version "8.7.2" apply false 22 | id "org.jetbrains.kotlin.android" version "1.8.22" apply false 23 | } 24 | 25 | 26 | include ":app" 27 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/assets/service_account.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "service_account", 3 | "project_id": "Your Project ID", 4 | "private_key_id": "Your Private Key Id", 5 | "private_key": "Your Private key", 6 | "client_email": "Your Client Email", 7 | "client_id": "Your Client Id", 8 | "auth_uri": "Your auth Uri", 9 | "token_uri": "Your Token Uri", 10 | "auth_provider_x509_cert_url": "Your Auth Provider", 11 | "client_x509_cert_url": "Your Client Cert Url", 12 | "universe_domain": "Your Universe Domain" 13 | } -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/build.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/build.yaml -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 12.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '12.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def flutter_root 14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) 15 | unless File.exist?(generated_xcode_build_settings_path) 16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" 17 | end 18 | 19 | File.foreach(generated_xcode_build_settings_path) do |line| 20 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 21 | return matches[1].strip if matches 22 | end 23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" 24 | end 25 | 26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 27 | 28 | flutter_ios_podfile_setup 29 | 30 | target 'Runner' do 31 | use_frameworks! 32 | use_modular_headers! 33 | 34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 35 | target 'RunnerTests' do 36 | inherit! :search_paths 37 | end 38 | end 39 | 40 | post_install do |installer| 41 | installer.pods_project.targets.each do |target| 42 | flutter_additional_ios_build_settings(target) 43 | end 44 | end 45 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - AppAuth (1.7.5): 3 | - AppAuth/Core (= 1.7.5) 4 | - AppAuth/ExternalUserAgent (= 1.7.5) 5 | - AppAuth/Core (1.7.5) 6 | - AppAuth/ExternalUserAgent (1.7.5): 7 | - AppAuth/Core 8 | - DKImagePickerController/Core (4.3.9): 9 | - DKImagePickerController/ImageDataManager 10 | - DKImagePickerController/Resource 11 | - DKImagePickerController/ImageDataManager (4.3.9) 12 | - DKImagePickerController/PhotoGallery (4.3.9): 13 | - DKImagePickerController/Core 14 | - DKPhotoGallery 15 | - DKImagePickerController/Resource (4.3.9) 16 | - DKPhotoGallery (0.0.19): 17 | - DKPhotoGallery/Core (= 0.0.19) 18 | - DKPhotoGallery/Model (= 0.0.19) 19 | - DKPhotoGallery/Preview (= 0.0.19) 20 | - DKPhotoGallery/Resource (= 0.0.19) 21 | - SDWebImage 22 | - SwiftyGif 23 | - DKPhotoGallery/Core (0.0.19): 24 | - DKPhotoGallery/Model 25 | - DKPhotoGallery/Preview 26 | - SDWebImage 27 | - SwiftyGif 28 | - DKPhotoGallery/Model (0.0.19): 29 | - SDWebImage 30 | - SwiftyGif 31 | - DKPhotoGallery/Preview (0.0.19): 32 | - DKPhotoGallery/Model 33 | - DKPhotoGallery/Resource 34 | - SDWebImage 35 | - SwiftyGif 36 | - DKPhotoGallery/Resource (0.0.19): 37 | - SDWebImage 38 | - SwiftyGif 39 | - file_picker (0.0.1): 40 | - DKImagePickerController/PhotoGallery 41 | - Flutter 42 | - Flutter (1.0.0) 43 | - flutter_web_auth (0.5.0): 44 | - Flutter 45 | - google_sign_in_ios (0.0.1): 46 | - AppAuth (>= 1.7.4) 47 | - Flutter 48 | - FlutterMacOS 49 | - GoogleSignIn (~> 7.1) 50 | - GTMSessionFetcher (>= 3.4.0) 51 | - GoogleSignIn (7.1.0): 52 | - AppAuth (< 2.0, >= 1.7.3) 53 | - GTMAppAuth (< 5.0, >= 4.1.1) 54 | - GTMSessionFetcher/Core (~> 3.3) 55 | - GTMAppAuth (4.1.1): 56 | - AppAuth/Core (~> 1.7) 57 | - GTMSessionFetcher/Core (< 4.0, >= 3.3) 58 | - GTMSessionFetcher (3.5.0): 59 | - GTMSessionFetcher/Full (= 3.5.0) 60 | - GTMSessionFetcher/Core (3.5.0) 61 | - GTMSessionFetcher/Full (3.5.0): 62 | - GTMSessionFetcher/Core 63 | - SDWebImage (5.19.4): 64 | - SDWebImage/Core (= 5.19.4) 65 | - SDWebImage/Core (5.19.4) 66 | - SwiftyGif (5.4.5) 67 | 68 | DEPENDENCIES: 69 | - file_picker (from `.symlinks/plugins/file_picker/ios`) 70 | - Flutter (from `Flutter`) 71 | - flutter_web_auth (from `.symlinks/plugins/flutter_web_auth/ios`) 72 | - google_sign_in_ios (from `.symlinks/plugins/google_sign_in_ios/darwin`) 73 | 74 | SPEC REPOS: 75 | trunk: 76 | - AppAuth 77 | - DKImagePickerController 78 | - DKPhotoGallery 79 | - GoogleSignIn 80 | - GTMAppAuth 81 | - GTMSessionFetcher 82 | - SDWebImage 83 | - SwiftyGif 84 | 85 | EXTERNAL SOURCES: 86 | file_picker: 87 | :path: ".symlinks/plugins/file_picker/ios" 88 | Flutter: 89 | :path: Flutter 90 | flutter_web_auth: 91 | :path: ".symlinks/plugins/flutter_web_auth/ios" 92 | google_sign_in_ios: 93 | :path: ".symlinks/plugins/google_sign_in_ios/darwin" 94 | 95 | SPEC CHECKSUMS: 96 | AppAuth: 501c04eda8a8d11f179dbe8637b7a91bb7e5d2fa 97 | DKImagePickerController: 946cec48c7873164274ecc4624d19e3da4c1ef3c 98 | DKPhotoGallery: b3834fecb755ee09a593d7c9e389d8b5d6deed60 99 | file_picker: 09aa5ec1ab24135ccd7a1621c46c84134bfd6655 100 | Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 101 | flutter_web_auth: c25208760459cec375a3c39f6a8759165ca0fa4d 102 | google_sign_in_ios: 07375bfbf2620bc93a602c0e27160d6afc6ead38 103 | GoogleSignIn: d4281ab6cf21542b1cfaff85c191f230b399d2db 104 | GTMAppAuth: f69bd07d68cd3b766125f7e072c45d7340dea0de 105 | GTMSessionFetcher: 5aea5ba6bd522a239e236100971f10cb71b96ab6 106 | SDWebImage: 066c47b573f408f18caa467d71deace7c0f8280d 107 | SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4 108 | 109 | PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796 110 | 111 | COCOAPODS: 1.15.2 112 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 43 | 49 | 50 | 51 | 52 | 53 | 63 | 65 | 71 | 72 | 73 | 74 | 80 | 82 | 88 | 89 | 90 | 91 | 93 | 94 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | 4 | @main 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/ios/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/linux/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.10) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | 12 | # Serves the same purpose as list(TRANSFORM ... PREPEND ...), 13 | # which isn't available in 3.10. 14 | function(list_prepend LIST_NAME PREFIX) 15 | set(NEW_LIST "") 16 | foreach(element ${${LIST_NAME}}) 17 | list(APPEND NEW_LIST "${PREFIX}${element}") 18 | endforeach(element) 19 | set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) 20 | endfunction() 21 | 22 | # === Flutter Library === 23 | # System-level dependencies. 24 | find_package(PkgConfig REQUIRED) 25 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 26 | pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) 27 | pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) 28 | 29 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") 30 | 31 | # Published to parent scope for install step. 32 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 33 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 34 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 35 | set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) 36 | 37 | list(APPEND FLUTTER_LIBRARY_HEADERS 38 | "fl_basic_message_channel.h" 39 | "fl_binary_codec.h" 40 | "fl_binary_messenger.h" 41 | "fl_dart_project.h" 42 | "fl_engine.h" 43 | "fl_json_message_codec.h" 44 | "fl_json_method_codec.h" 45 | "fl_message_codec.h" 46 | "fl_method_call.h" 47 | "fl_method_channel.h" 48 | "fl_method_codec.h" 49 | "fl_method_response.h" 50 | "fl_plugin_registrar.h" 51 | "fl_plugin_registry.h" 52 | "fl_standard_message_codec.h" 53 | "fl_standard_method_codec.h" 54 | "fl_string_codec.h" 55 | "fl_value.h" 56 | "fl_view.h" 57 | "flutter_linux.h" 58 | ) 59 | list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") 60 | add_library(flutter INTERFACE) 61 | target_include_directories(flutter INTERFACE 62 | "${EPHEMERAL_DIR}" 63 | ) 64 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") 65 | target_link_libraries(flutter INTERFACE 66 | PkgConfig::GTK 67 | PkgConfig::GLIB 68 | PkgConfig::GIO 69 | ) 70 | add_dependencies(flutter flutter_assemble) 71 | 72 | # === Flutter tool backend === 73 | # _phony_ is a non-existent file to force this command to run every time, 74 | # since currently there's no way to get a full input/output list from the 75 | # flutter tool. 76 | add_custom_command( 77 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 78 | ${CMAKE_CURRENT_BINARY_DIR}/_phony_ 79 | COMMAND ${CMAKE_COMMAND} -E env 80 | ${FLUTTER_TOOL_ENVIRONMENT} 81 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" 82 | ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} 83 | VERBATIM 84 | ) 85 | add_custom_target(flutter_assemble DEPENDS 86 | "${FLUTTER_LIBRARY}" 87 | ${FLUTTER_LIBRARY_HEADERS} 88 | ) 89 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/linux/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | 11 | void fl_register_plugins(FlPluginRegistry* registry) { 12 | g_autoptr(FlPluginRegistrar) flutter_secure_storage_linux_registrar = 13 | fl_plugin_registry_get_registrar_for_plugin(registry, "FlutterSecureStorageLinuxPlugin"); 14 | flutter_secure_storage_linux_plugin_register_with_registrar(flutter_secure_storage_linux_registrar); 15 | } 16 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/linux/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void fl_register_plugins(FlPluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/linux/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | flutter_secure_storage_linux 7 | ) 8 | 9 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 10 | ) 11 | 12 | set(PLUGIN_BUNDLED_LIBRARIES) 13 | 14 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 15 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 16 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 19 | endforeach(plugin) 20 | 21 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 22 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) 23 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 24 | endforeach(ffi_plugin) 25 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/linux/main.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | int main(int argc, char** argv) { 4 | g_autoptr(MyApplication) app = my_application_new(); 5 | return g_application_run(G_APPLICATION(app), argc, argv); 6 | } 7 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/linux/my_application.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_MY_APPLICATION_H_ 2 | #define FLUTTER_MY_APPLICATION_H_ 3 | 4 | #include 5 | 6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, 7 | GtkApplication) 8 | 9 | /** 10 | * my_application_new: 11 | * 12 | * Creates a new Flutter-based application. 13 | * 14 | * Returns: a new #MyApplication. 15 | */ 16 | MyApplication* my_application_new(); 17 | 18 | #endif // FLUTTER_MY_APPLICATION_H_ 19 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | import file_picker 9 | import flutter_secure_storage_macos 10 | import google_sign_in_ios 11 | import path_provider_foundation 12 | import shared_preferences_foundation 13 | import sign_in_with_apple 14 | import webview_flutter_wkwebview 15 | 16 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 17 | FilePickerPlugin.register(with: registry.registrar(forPlugin: "FilePickerPlugin")) 18 | FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin")) 19 | FLTGoogleSignInPlugin.register(with: registry.registrar(forPlugin: "FLTGoogleSignInPlugin")) 20 | PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) 21 | SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) 22 | SignInWithApplePlugin.register(with: registry.registrar(forPlugin: "SignInWithApplePlugin")) 23 | WebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "WebViewFlutterPlugin")) 24 | } 25 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/macos/Podfile: -------------------------------------------------------------------------------- 1 | platform :osx, '10.14' 2 | 3 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 4 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 5 | 6 | project 'Runner', { 7 | 'Debug' => :debug, 8 | 'Profile' => :release, 9 | 'Release' => :release, 10 | } 11 | 12 | def flutter_root 13 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) 14 | unless File.exist?(generated_xcode_build_settings_path) 15 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" 16 | end 17 | 18 | File.foreach(generated_xcode_build_settings_path) do |line| 19 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 20 | return matches[1].strip if matches 21 | end 22 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" 23 | end 24 | 25 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 26 | 27 | flutter_macos_podfile_setup 28 | 29 | target 'Runner' do 30 | use_frameworks! 31 | use_modular_headers! 32 | 33 | flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) 34 | target 'RunnerTests' do 35 | inherit! :search_paths 36 | end 37 | end 38 | 39 | post_install do |installer| 40 | installer.pods_project.targets.each do |target| 41 | flutter_additional_macos_build_settings(target) 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 43 | 49 | 50 | 51 | 52 | 53 | 63 | 65 | 71 | 72 | 73 | 74 | 80 | 82 | 88 | 89 | 90 | 91 | 93 | 94 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @main 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "app_icon_16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "app_icon_32.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "app_icon_32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "app_icon_64.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "app_icon_128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "app_icon_256.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "app_icon_256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "app_icon_512.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "app_icon_512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "app_icon_1024.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = firebase_dart_admin_auth_sample_app 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.aortem.dartAdminAuthTestApp 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2024 com.aortem. All rights reserved. 15 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | $(PRODUCT_COPYRIGHT) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController() 7 | let windowFrame = self.frame 8 | self.contentViewController = flutterViewController 9 | self.setFrame(windowFrame, display: true) 10 | 11 | RegisterGeneratedPlugins(registry: flutterViewController) 12 | 13 | super.awakeFromNib() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/macos/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/test/widget_test.dart: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/web/favicon.png -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/web/icons/Icon-192.png -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/web/icons/Icon-512.png -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "firebase_dart_admin_auth_sample_app", 3 | "short_name": "firebase_dart_admin_auth_sample_app", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A new Flutter project.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | }, 22 | { 23 | "src": "icons/Icon-maskable-192.png", 24 | "sizes": "192x192", 25 | "type": "image/png", 26 | "purpose": "maskable" 27 | }, 28 | { 29 | "src": "icons/Icon-maskable-512.png", 30 | "sizes": "512x512", 31 | "type": "image/png", 32 | "purpose": "maskable" 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/web/oauth_redirect.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | OAuth Redirect 6 | 25 | 26 | 27 |

Authentication successful. You can close this window.

28 | 29 | 30 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/windows/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.14) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") 12 | 13 | # Set fallback configurations for older versions of the flutter tool. 14 | if (NOT DEFINED FLUTTER_TARGET_PLATFORM) 15 | set(FLUTTER_TARGET_PLATFORM "windows-x64") 16 | endif() 17 | 18 | # === Flutter Library === 19 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") 20 | 21 | # Published to parent scope for install step. 22 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 23 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 24 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 25 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) 26 | 27 | list(APPEND FLUTTER_LIBRARY_HEADERS 28 | "flutter_export.h" 29 | "flutter_windows.h" 30 | "flutter_messenger.h" 31 | "flutter_plugin_registrar.h" 32 | "flutter_texture_registrar.h" 33 | ) 34 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") 35 | add_library(flutter INTERFACE) 36 | target_include_directories(flutter INTERFACE 37 | "${EPHEMERAL_DIR}" 38 | ) 39 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") 40 | add_dependencies(flutter flutter_assemble) 41 | 42 | # === Wrapper === 43 | list(APPEND CPP_WRAPPER_SOURCES_CORE 44 | "core_implementations.cc" 45 | "standard_codec.cc" 46 | ) 47 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") 48 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN 49 | "plugin_registrar.cc" 50 | ) 51 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") 52 | list(APPEND CPP_WRAPPER_SOURCES_APP 53 | "flutter_engine.cc" 54 | "flutter_view_controller.cc" 55 | ) 56 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") 57 | 58 | # Wrapper sources needed for a plugin. 59 | add_library(flutter_wrapper_plugin STATIC 60 | ${CPP_WRAPPER_SOURCES_CORE} 61 | ${CPP_WRAPPER_SOURCES_PLUGIN} 62 | ) 63 | apply_standard_settings(flutter_wrapper_plugin) 64 | set_target_properties(flutter_wrapper_plugin PROPERTIES 65 | POSITION_INDEPENDENT_CODE ON) 66 | set_target_properties(flutter_wrapper_plugin PROPERTIES 67 | CXX_VISIBILITY_PRESET hidden) 68 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) 69 | target_include_directories(flutter_wrapper_plugin PUBLIC 70 | "${WRAPPER_ROOT}/include" 71 | ) 72 | add_dependencies(flutter_wrapper_plugin flutter_assemble) 73 | 74 | # Wrapper sources needed for the runner. 75 | add_library(flutter_wrapper_app STATIC 76 | ${CPP_WRAPPER_SOURCES_CORE} 77 | ${CPP_WRAPPER_SOURCES_APP} 78 | ) 79 | apply_standard_settings(flutter_wrapper_app) 80 | target_link_libraries(flutter_wrapper_app PUBLIC flutter) 81 | target_include_directories(flutter_wrapper_app PUBLIC 82 | "${WRAPPER_ROOT}/include" 83 | ) 84 | add_dependencies(flutter_wrapper_app flutter_assemble) 85 | 86 | # === Flutter tool backend === 87 | # _phony_ is a non-existent file to force this command to run every time, 88 | # since currently there's no way to get a full input/output list from the 89 | # flutter tool. 90 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") 91 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) 92 | add_custom_command( 93 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 94 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} 95 | ${CPP_WRAPPER_SOURCES_APP} 96 | ${PHONY_OUTPUT} 97 | COMMAND ${CMAKE_COMMAND} -E env 98 | ${FLUTTER_TOOL_ENVIRONMENT} 99 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" 100 | ${FLUTTER_TARGET_PLATFORM} $ 101 | VERBATIM 102 | ) 103 | add_custom_target(flutter_assemble DEPENDS 104 | "${FLUTTER_LIBRARY}" 105 | ${FLUTTER_LIBRARY_HEADERS} 106 | ${CPP_WRAPPER_SOURCES_CORE} 107 | ${CPP_WRAPPER_SOURCES_PLUGIN} 108 | ${CPP_WRAPPER_SOURCES_APP} 109 | ) 110 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | 11 | void RegisterPlugins(flutter::PluginRegistry* registry) { 12 | FlutterSecureStorageWindowsPluginRegisterWithRegistrar( 13 | registry->GetRegistrarForPlugin("FlutterSecureStorageWindowsPlugin")); 14 | } 15 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | flutter_secure_storage_windows 7 | ) 8 | 9 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 10 | ) 11 | 12 | set(PLUGIN_BUNDLED_LIBRARIES) 13 | 14 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 15 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 16 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 19 | endforeach(plugin) 20 | 21 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 22 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 23 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 24 | endforeach(ffi_plugin) 25 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/windows/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(runner LANGUAGES CXX) 3 | 4 | # Define the application target. To change its name, change BINARY_NAME in the 5 | # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer 6 | # work. 7 | # 8 | # Any new source files that you add to the application should be added here. 9 | add_executable(${BINARY_NAME} WIN32 10 | "flutter_window.cpp" 11 | "main.cpp" 12 | "utils.cpp" 13 | "win32_window.cpp" 14 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 15 | "Runner.rc" 16 | "runner.exe.manifest" 17 | ) 18 | 19 | # Apply the standard set of build settings. This can be removed for applications 20 | # that need different build settings. 21 | apply_standard_settings(${BINARY_NAME}) 22 | 23 | # Add preprocessor definitions for the build version. 24 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") 25 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") 26 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") 27 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") 28 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") 29 | 30 | # Disable Windows macros that collide with C++ standard library functions. 31 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 32 | 33 | # Add dependency libraries and include directories. Add any application-specific 34 | # dependencies here. 35 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 36 | target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") 37 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 38 | 39 | # Run the Flutter tool portions of the build. This must not be removed. 40 | add_dependencies(${BINARY_NAME} flutter_assemble) 41 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/windows/runner/Runner.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #pragma code_page(65001) 4 | #include "resource.h" 5 | 6 | #define APSTUDIO_READONLY_SYMBOLS 7 | ///////////////////////////////////////////////////////////////////////////// 8 | // 9 | // Generated from the TEXTINCLUDE 2 resource. 10 | // 11 | #include "winres.h" 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | #undef APSTUDIO_READONLY_SYMBOLS 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | // English (United States) resources 18 | 19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | 22 | #ifdef APSTUDIO_INVOKED 23 | ///////////////////////////////////////////////////////////////////////////// 24 | // 25 | // TEXTINCLUDE 26 | // 27 | 28 | 1 TEXTINCLUDE 29 | BEGIN 30 | "resource.h\0" 31 | END 32 | 33 | 2 TEXTINCLUDE 34 | BEGIN 35 | "#include ""winres.h""\r\n" 36 | "\0" 37 | END 38 | 39 | 3 TEXTINCLUDE 40 | BEGIN 41 | "\r\n" 42 | "\0" 43 | END 44 | 45 | #endif // APSTUDIO_INVOKED 46 | 47 | 48 | ///////////////////////////////////////////////////////////////////////////// 49 | // 50 | // Icon 51 | // 52 | 53 | // Icon with lowest ID value placed first to ensure application icon 54 | // remains consistent on all systems. 55 | IDI_APP_ICON ICON "resources\\app_icon.ico" 56 | 57 | 58 | ///////////////////////////////////////////////////////////////////////////// 59 | // 60 | // Version 61 | // 62 | 63 | #if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD) 64 | #define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD 65 | #else 66 | #define VERSION_AS_NUMBER 1,0,0,0 67 | #endif 68 | 69 | #if defined(FLUTTER_VERSION) 70 | #define VERSION_AS_STRING FLUTTER_VERSION 71 | #else 72 | #define VERSION_AS_STRING "1.0.0" 73 | #endif 74 | 75 | VS_VERSION_INFO VERSIONINFO 76 | FILEVERSION VERSION_AS_NUMBER 77 | PRODUCTVERSION VERSION_AS_NUMBER 78 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 79 | #ifdef _DEBUG 80 | FILEFLAGS VS_FF_DEBUG 81 | #else 82 | FILEFLAGS 0x0L 83 | #endif 84 | FILEOS VOS__WINDOWS32 85 | FILETYPE VFT_APP 86 | FILESUBTYPE 0x0L 87 | BEGIN 88 | BLOCK "StringFileInfo" 89 | BEGIN 90 | BLOCK "040904e4" 91 | BEGIN 92 | VALUE "CompanyName", "com.aortem" "\0" 93 | VALUE "FileDescription", "firebase_dart_admin_auth_sample_app" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "firebase_dart_admin_auth_sample_app" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2024 com.aortem. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "firebase_dart_admin_auth_sample_app.exe" "\0" 98 | VALUE "ProductName", "firebase_dart_admin_auth_sample_app" "\0" 99 | VALUE "ProductVersion", VERSION_AS_STRING "\0" 100 | END 101 | END 102 | BLOCK "VarFileInfo" 103 | BEGIN 104 | VALUE "Translation", 0x409, 1252 105 | END 106 | END 107 | 108 | #endif // English (United States) resources 109 | ///////////////////////////////////////////////////////////////////////////// 110 | 111 | 112 | 113 | #ifndef APSTUDIO_INVOKED 114 | ///////////////////////////////////////////////////////////////////////////// 115 | // 116 | // Generated from the TEXTINCLUDE 3 resource. 117 | // 118 | 119 | 120 | ///////////////////////////////////////////////////////////////////////////// 121 | #endif // not APSTUDIO_INVOKED 122 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/windows/runner/flutter_window.cpp: -------------------------------------------------------------------------------- 1 | #include "flutter_window.h" 2 | 3 | #include 4 | 5 | #include "flutter/generated_plugin_registrant.h" 6 | 7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project) 8 | : project_(project) {} 9 | 10 | FlutterWindow::~FlutterWindow() {} 11 | 12 | bool FlutterWindow::OnCreate() { 13 | if (!Win32Window::OnCreate()) { 14 | return false; 15 | } 16 | 17 | RECT frame = GetClientArea(); 18 | 19 | // The size here must match the window dimensions to avoid unnecessary surface 20 | // creation / destruction in the startup path. 21 | flutter_controller_ = std::make_unique( 22 | frame.right - frame.left, frame.bottom - frame.top, project_); 23 | // Ensure that basic setup of the controller was successful. 24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) { 25 | return false; 26 | } 27 | RegisterPlugins(flutter_controller_->engine()); 28 | SetChildContent(flutter_controller_->view()->GetNativeWindow()); 29 | 30 | flutter_controller_->engine()->SetNextFrameCallback([&]() { 31 | this->Show(); 32 | }); 33 | 34 | // Flutter can complete the first frame before the "show window" callback is 35 | // registered. The following call ensures a frame is pending to ensure the 36 | // window is shown. It is a no-op if the first frame hasn't completed yet. 37 | flutter_controller_->ForceRedraw(); 38 | 39 | return true; 40 | } 41 | 42 | void FlutterWindow::OnDestroy() { 43 | if (flutter_controller_) { 44 | flutter_controller_ = nullptr; 45 | } 46 | 47 | Win32Window::OnDestroy(); 48 | } 49 | 50 | LRESULT 51 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 52 | WPARAM const wparam, 53 | LPARAM const lparam) noexcept { 54 | // Give Flutter, including plugins, an opportunity to handle window messages. 55 | if (flutter_controller_) { 56 | std::optional result = 57 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 58 | lparam); 59 | if (result) { 60 | return *result; 61 | } 62 | } 63 | 64 | switch (message) { 65 | case WM_FONTCHANGE: 66 | flutter_controller_->engine()->ReloadSystemFonts(); 67 | break; 68 | } 69 | 70 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 71 | } 72 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/windows/runner/flutter_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_FLUTTER_WINDOW_H_ 2 | #define RUNNER_FLUTTER_WINDOW_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "win32_window.h" 10 | 11 | // A window that does nothing but host a Flutter view. 12 | class FlutterWindow : public Win32Window { 13 | public: 14 | // Creates a new FlutterWindow hosting a Flutter view running |project|. 15 | explicit FlutterWindow(const flutter::DartProject& project); 16 | virtual ~FlutterWindow(); 17 | 18 | protected: 19 | // Win32Window: 20 | bool OnCreate() override; 21 | void OnDestroy() override; 22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 23 | LPARAM const lparam) noexcept override; 24 | 25 | private: 26 | // The project to run. 27 | flutter::DartProject project_; 28 | 29 | // The Flutter instance hosted by this window. 30 | std::unique_ptr flutter_controller_; 31 | }; 32 | 33 | #endif // RUNNER_FLUTTER_WINDOW_H_ 34 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "utils.h" 7 | 8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 9 | _In_ wchar_t *command_line, _In_ int show_command) { 10 | // Attach to console when present (e.g., 'flutter run') or create a 11 | // new console when running with a debugger. 12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 13 | CreateAndAttachConsole(); 14 | } 15 | 16 | // Initialize COM, so that it is available for use in the library and/or 17 | // plugins. 18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 19 | 20 | flutter::DartProject project(L"data"); 21 | 22 | std::vector command_line_arguments = 23 | GetCommandLineArguments(); 24 | 25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 26 | 27 | FlutterWindow window(project); 28 | Win32Window::Point origin(10, 10); 29 | Win32Window::Size size(1280, 720); 30 | if (!window.Create(L"firebase_dart_admin_auth_sample_app", origin, size)) { 31 | return EXIT_FAILURE; 32 | } 33 | window.SetQuitOnClose(true); 34 | 35 | ::MSG msg; 36 | while (::GetMessage(&msg, nullptr, 0, 0)) { 37 | ::TranslateMessage(&msg); 38 | ::DispatchMessage(&msg); 39 | } 40 | 41 | ::CoUninitialize(); 42 | return EXIT_SUCCESS; 43 | } 44 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/windows/runner/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Runner.rc 4 | // 5 | #define IDI_APP_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/windows/runner/runner.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PerMonitorV2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/windows/runner/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | void CreateAndAttachConsole() { 11 | if (::AllocConsole()) { 12 | FILE *unused; 13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) { 14 | _dup2(_fileno(stdout), 1); 15 | } 16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) { 17 | _dup2(_fileno(stdout), 2); 18 | } 19 | std::ios::sync_with_stdio(); 20 | FlutterDesktopResyncOutputStreams(); 21 | } 22 | } 23 | 24 | std::vector GetCommandLineArguments() { 25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. 26 | int argc; 27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); 28 | if (argv == nullptr) { 29 | return std::vector(); 30 | } 31 | 32 | std::vector command_line_arguments; 33 | 34 | // Skip the first argument as it's the binary name. 35 | for (int i = 1; i < argc; i++) { 36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i])); 37 | } 38 | 39 | ::LocalFree(argv); 40 | 41 | return command_line_arguments; 42 | } 43 | 44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) { 45 | if (utf16_string == nullptr) { 46 | return std::string(); 47 | } 48 | unsigned int target_length = ::WideCharToMultiByte( 49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 50 | -1, nullptr, 0, nullptr, nullptr) 51 | -1; // remove the trailing null character 52 | int input_length = (int)wcslen(utf16_string); 53 | std::string utf8_string; 54 | if (target_length == 0 || target_length > utf8_string.max_size()) { 55 | return utf8_string; 56 | } 57 | utf8_string.resize(target_length); 58 | int converted_length = ::WideCharToMultiByte( 59 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 60 | input_length, utf8_string.data(), target_length, nullptr, nullptr); 61 | if (converted_length == 0) { 62 | return std::string(); 63 | } 64 | return utf8_string; 65 | } 66 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/windows/runner/win32_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_WIN32_WINDOW_H_ 2 | #define RUNNER_WIN32_WINDOW_H_ 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | // A class abstraction for a high DPI-aware Win32 Window. Intended to be 11 | // inherited from by classes that wish to specialize with custom 12 | // rendering and input handling 13 | class Win32Window { 14 | public: 15 | struct Point { 16 | unsigned int x; 17 | unsigned int y; 18 | Point(unsigned int x, unsigned int y) : x(x), y(y) {} 19 | }; 20 | 21 | struct Size { 22 | unsigned int width; 23 | unsigned int height; 24 | Size(unsigned int width, unsigned int height) 25 | : width(width), height(height) {} 26 | }; 27 | 28 | Win32Window(); 29 | virtual ~Win32Window(); 30 | 31 | // Creates a win32 window with |title| that is positioned and sized using 32 | // |origin| and |size|. New windows are created on the default monitor. Window 33 | // sizes are specified to the OS in physical pixels, hence to ensure a 34 | // consistent size this function will scale the inputted width and height as 35 | // as appropriate for the default monitor. The window is invisible until 36 | // |Show| is called. Returns true if the window was created successfully. 37 | bool Create(const std::wstring& title, const Point& origin, const Size& size); 38 | 39 | // Show the current window. Returns true if the window was successfully shown. 40 | bool Show(); 41 | 42 | // Release OS resources associated with window. 43 | void Destroy(); 44 | 45 | // Inserts |content| into the window tree. 46 | void SetChildContent(HWND content); 47 | 48 | // Returns the backing Window handle to enable clients to set icon and other 49 | // window properties. Returns nullptr if the window has been destroyed. 50 | HWND GetHandle(); 51 | 52 | // If true, closing this window will quit the application. 53 | void SetQuitOnClose(bool quit_on_close); 54 | 55 | // Return a RECT representing the bounds of the current client area. 56 | RECT GetClientArea(); 57 | 58 | protected: 59 | // Processes and route salient window messages for mouse handling, 60 | // size change and DPI. Delegates handling of these to member overloads that 61 | // inheriting classes can handle. 62 | virtual LRESULT MessageHandler(HWND window, 63 | UINT const message, 64 | WPARAM const wparam, 65 | LPARAM const lparam) noexcept; 66 | 67 | // Called when CreateAndShow is called, allowing subclass window-related 68 | // setup. Subclasses should return false if setup fails. 69 | virtual bool OnCreate(); 70 | 71 | // Called when Destroy is called. 72 | virtual void OnDestroy(); 73 | 74 | private: 75 | friend class WindowClassRegistrar; 76 | 77 | // OS callback called by message pump. Handles the WM_NCCREATE message which 78 | // is passed when the non-client area is being created and enables automatic 79 | // non-client DPI scaling so that the non-client area automatically 80 | // responds to changes in DPI. All other messages are handled by 81 | // MessageHandler. 82 | static LRESULT CALLBACK WndProc(HWND const window, 83 | UINT const message, 84 | WPARAM const wparam, 85 | LPARAM const lparam) noexcept; 86 | 87 | // Retrieves a class instance pointer for |window| 88 | static Win32Window* GetThisFromHandle(HWND const window) noexcept; 89 | 90 | // Update the window frame's theme to match the system theme. 91 | static void UpdateTheme(HWND const window); 92 | 93 | bool quit_on_close_ = false; 94 | 95 | // window handle for top level window. 96 | HWND window_handle_ = nullptr; 97 | 98 | // window handle for hosted content. 99 | HWND child_content_ = nullptr; 100 | }; 101 | 102 | #endif // RUNNER_WIN32_WINDOW_H_ 103 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-web-app/placeholder.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-web-app/placeholder.txt -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-svelte-app/placeholder.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic-dart-auth-sdk-svelte-app/placeholder.txt -------------------------------------------------------------------------------- /magic-dart-auth-sdk/example/magic-dart-auth-sdk-vue-app/placeholder.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aortem/magic-dart-auth-sdk/feed10b18aadc2f865f7bc05669bd77abe341447/magic-dart-auth-sdk/example/magic-dart-auth-sdk-vue-app/placeholder.txt -------------------------------------------------------------------------------- /magic-dart-auth-sdk/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "emulators": { 3 | "auth": { 4 | "port": 9099 5 | }, 6 | "functions": { 7 | "port": 5002 8 | }, 9 | "ui": { 10 | "enabled": true, 11 | "port": 5003 12 | }, 13 | "singleProjectMode": true 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/lib/magic_dart_auth_sdk.dart: -------------------------------------------------------------------------------- 1 | library; 2 | 3 | // Core 4 | export 'src/core/aortem_magic_api_key_manager.dart'; 5 | export 'src/core/aortem_magic_constructor.dart'; 6 | 7 | // Metadata 8 | export 'src/metadata/aortem_magic_issuer_metadata.dart'; 9 | export 'src/metadata/aortem_magic_address_metadata.dart'; 10 | export 'src/metadata/aortem_magic_token_metadata.dart'; 11 | 12 | // Authentication 13 | export 'src/auth/aortem_magic_token_validation.dart'; 14 | export 'src/auth/aortem_magic_token_decode.dart'; 15 | export 'src/auth/aortem_magic_issuer.dart'; 16 | export 'src/auth/aortem_magic_public_address.dart'; 17 | 18 | // Logout 19 | export 'src/logout/aortem_magic_logout_issuer.dart'; 20 | export 'src/logout/aortem_magic_logout_address.dart'; 21 | export 'src/logout/aortem_magic_logout_token.dart'; 22 | 23 | // Utilities 24 | export 'src/utils/aortem_magic_parse_auth_header.dart'; 25 | export 'src/utils/aortem_magic_secure_storage.dart'; 26 | 27 | // Multichain 28 | export 'src/multichain/aortem_magic_multichain_metadata.dart'; 29 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/lib/src/auth/aortem_magic_issuer.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | /// A utility class for extracting the issuer (`iss`) field from a Decentralized Identifier (DID) Token. 4 | /// This class provides strict and loose validation modes to ensure the extracted issuer follows the expected format. 5 | /// 6 | /// ## Features: 7 | /// - Extracts the `iss` field from a DID Token (JWT format). 8 | /// - Supports strict validation mode (must be a valid URL format). 9 | /// - Supports loose validation mode (only checks for a recognizable domain format). 10 | /// - Throws an error if the token is invalid or the issuer format is incorrect. 11 | /// 12 | /// ## Usage Example: 13 | /// ```dart 14 | /// String didToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2V4YW1wbGUuY29tIn0.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"; 15 | /// String issuer = AortemMagicIssuerExtractor.getIssuer(didToken, strict: true); 16 | /// print(issuer); // Outputs: https://example.com 17 | /// ``` 18 | 19 | class AortemMagicIssuerExtractor { 20 | /// Extracts the issuer (`iss`) from a DID Token. 21 | /// - [didToken]: The DID Token (JWT format). 22 | /// - [strict]: If `true`, enforces strict validation (must be a valid URL format). 23 | /// 24 | /// Throws an error if the token is invalid or the issuer format is incorrect. 25 | static String getIssuer(String didToken, {bool strict = true}) { 26 | if (didToken.isEmpty) { 27 | throw ArgumentError('DID Token cannot be empty.'); 28 | } 29 | 30 | try { 31 | // Decode JWT payload (second part of the token) 32 | Map payload = _decodeJwtPayload(didToken); 33 | 34 | // Extract issuer from "iss" field 35 | String? issuer = payload['iss']; 36 | 37 | if (issuer == null || issuer.isEmpty) { 38 | throw FormatException('Issuer (iss) is missing in the DID Token.'); 39 | } 40 | 41 | // Validate based on strict or loose mode 42 | if (strict) { 43 | if (!_isValidStrictIssuer(issuer)) { 44 | throw FormatException('Invalid issuer format in strict mode.'); 45 | } 46 | } else { 47 | if (!_isValidLooseIssuer(issuer)) { 48 | throw FormatException('Invalid issuer format in loose mode.'); 49 | } 50 | } 51 | 52 | return issuer; 53 | } catch (e) { 54 | throw FormatException('Invalid DID Token: ${e.toString()}'); 55 | } 56 | } 57 | 58 | /// Decodes a JWT and returns the payload as a Map. 59 | static Map _decodeJwtPayload(String token) { 60 | List parts = token.split('.'); 61 | if (parts.length != 3) { 62 | throw FormatException('Invalid JWT format'); 63 | } 64 | 65 | String payloadBase64 = parts[1]; 66 | String normalized = base64.normalize(payloadBase64); 67 | String decoded = utf8.decode(base64Url.decode(normalized)); 68 | 69 | return jsonDecode(decoded) as Map; 70 | } 71 | 72 | /// Strict validation: Must be a valid URL. 73 | static bool _isValidStrictIssuer(String issuer) { 74 | final uri = Uri.tryParse(issuer); 75 | return uri != null && uri.hasScheme && uri.hasAuthority; 76 | } 77 | 78 | /// Loose validation: Must be non-empty and contain a recognizable domain format. 79 | static bool _isValidLooseIssuer(String issuer) { 80 | return issuer.isNotEmpty && issuer.contains('.'); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/lib/src/auth/aortem_magic_public_address.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | /// AortemMagicPublicAddressExtractor 4 | /// 5 | /// A utility class for extracting the public address from a Decentralized Identifier (DID) Token. 6 | /// This class provides strict and loose validation modes to ensure the extracted address follows the expected format. 7 | /// 8 | /// ## Features: 9 | /// - Extracts the `sub` field from a DID Token (JWT format) to retrieve the public Ethereum address. 10 | /// - Supports strict validation mode (must be a valid Ethereum address format: `0x` followed by 40 hexadecimal characters). 11 | /// - Supports loose validation mode (only checks for the `0x` prefix and non-empty content). 12 | /// - Throws an error if the token is invalid or the address format is incorrect. 13 | /// 14 | /// ## Usage Example: 15 | /// ```dart 16 | /// String didToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIweDEyMzQ1Njc4OWFiY2RlZjAxMjM0NTY3ODlhYmNkZWYwIn0.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"; 17 | /// String publicAddress = AortemMagicPublicAddressExtractor.getPublicAddress(didToken, strict: true); 18 | /// print(publicAddress); // Outputs: 0x123456789abcdef0123456789abcdef0123456789 19 | /// ``` 20 | 21 | class AortemMagicPublicAddressExtractor { 22 | /// Extracts the public address from a DID Token without external dependencies. 23 | /// - [didToken]: The DID Token (JWT format). 24 | /// - [strict]: If `true`, enforces strict Ethereum address validation. 25 | /// 26 | /// Throws an error if the token is invalid or the address format is incorrect. 27 | static String getPublicAddress(String didToken, {bool strict = true}) { 28 | if (didToken.isEmpty) { 29 | throw ArgumentError('DID Token cannot be empty.'); 30 | } 31 | 32 | try { 33 | // Decode JWT payload (second part of the token) 34 | Map payload = _decodeJwtPayload(didToken); 35 | 36 | // Extract public address from "sub" field 37 | String? publicAddress = payload['sub']; 38 | 39 | if (publicAddress == null || publicAddress.isEmpty) { 40 | throw FormatException( 41 | 'Public address (sub) is missing in the DID Token.', 42 | ); 43 | } 44 | 45 | // Validate based on strict or loose mode 46 | if (strict) { 47 | if (!_isValidStrictEthereumAddress(publicAddress)) { 48 | throw FormatException( 49 | 'Invalid Ethereum address format in strict mode.', 50 | ); 51 | } 52 | } else { 53 | if (!_isValidLooseEthereumAddress(publicAddress)) { 54 | throw FormatException( 55 | 'Invalid Ethereum address format in loose mode.', 56 | ); 57 | } 58 | } 59 | 60 | return publicAddress; 61 | } catch (e) { 62 | throw FormatException('Invalid DID Token: ${e.toString()}'); 63 | } 64 | } 65 | 66 | /// Decodes a JWT and returns the payload as a Map. 67 | static Map _decodeJwtPayload(String token) { 68 | List parts = token.split('.'); 69 | if (parts.length != 3) { 70 | throw FormatException('Invalid JWT format'); 71 | } 72 | 73 | String payloadBase64 = parts[1]; 74 | String normalized = base64.normalize(payloadBase64); 75 | String decoded = utf8.decode(base64Url.decode(normalized)); 76 | 77 | return jsonDecode(decoded) as Map; 78 | } 79 | 80 | /// Strict validation: Must start with `0x` and be exactly 42 characters long (Ethereum address). 81 | static bool _isValidStrictEthereumAddress(String address) { 82 | final ethRegex = RegExp(r"^0x[a-fA-F0-9]{40}$"); 83 | return ethRegex.hasMatch(address); 84 | } 85 | 86 | /// Loose validation: Must start with `0x` and be non-empty. 87 | static bool _isValidLooseEthereumAddress(String address) { 88 | return address.startsWith('0x') && address.length > 2; 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/lib/src/auth/aortem_magic_token_decode.dart: -------------------------------------------------------------------------------- 1 | 2 | 3 | import 'dart:convert'; 4 | 5 | /// AortemMagicTokenDecoder 6 | /// 7 | /// A utility class for decoding Decentralized Identifier (DID) Tokens (JWT format). 8 | /// It extracts the payload and optionally verifies required claims. 9 | /// 10 | /// ## Features: 11 | /// - Decodes the payload of a DID Token. 12 | /// - Supports optional verification to ensure required fields (`iss`, `sub`) are present. 13 | /// - Throws an error if the token format is invalid or required fields are missing. 14 | /// 15 | /// ## Usage Example: 16 | /// ```dart 17 | /// String didToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2V4YW1wbGUuY29tIiwic3ViIjoiMHgxMjM0NTY3ODlhYmNkZWYiLCJleHAiOjE2NjAwMDAwMDB9.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"; 18 | /// Map payload = AortemMagicTokenDecoder.decode(didToken, verify: true); 19 | /// print(payload); // Outputs decoded payload 20 | /// ``` 21 | class AortemMagicTokenDecoder { 22 | /// Decodes a DID Token (JWT format) and returns the payload as a Map. 23 | /// - [didToken]: The DID Token (JWT format). 24 | /// - [verify]: If `true`, ensures required fields (`iss`, `sub`) are present. 25 | /// 26 | /// Throws an error if the token is invalid or verification fails. 27 | static Map decode(String didToken, {bool verify = false}) { 28 | if (didToken.isEmpty) { 29 | throw ArgumentError('DID Token cannot be empty.'); 30 | } 31 | 32 | try { 33 | // Decode JWT payload 34 | Map payload = _decodeJwtPayload(didToken); 35 | 36 | // Optional verification step 37 | if (verify) { 38 | _verifyRequiredFields(payload); 39 | } 40 | 41 | return payload; 42 | } catch (e) { 43 | throw FormatException('Invalid DID Token: ${e.toString()}'); 44 | } 45 | } 46 | 47 | /// Decodes a JWT and returns the payload as a Map. 48 | static Map _decodeJwtPayload(String token) { 49 | List parts = token.split('.'); 50 | if (parts.length != 3) { 51 | throw FormatException('Invalid JWT format'); 52 | } 53 | 54 | String payloadBase64 = parts[1]; 55 | String normalized = base64.normalize(payloadBase64); 56 | String decoded = utf8.decode(base64Url.decode(normalized)); 57 | 58 | return jsonDecode(decoded) as Map; 59 | } 60 | 61 | /// Verifies that required claims (`iss`, `sub`) are present in the payload. 62 | static void _verifyRequiredFields(Map payload) { 63 | if (!payload.containsKey('iss') || payload['iss'].toString().isEmpty) { 64 | throw FormatException('Missing or empty "iss" field.'); 65 | } 66 | if (!payload.containsKey('sub') || payload['sub'].toString().isEmpty) { 67 | throw FormatException('Missing or empty "sub" field.'); 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/lib/src/core/aortem_magic_api_key_manager.dart: -------------------------------------------------------------------------------- 1 | import '../utils/aortem_magic_secure_storage.dart'; 2 | 3 | /// AortemMagicAuthApiKeyManagement 4 | /// 5 | /// A class responsible for managing API keys securely within the Aortem Magic authentication system. 6 | /// It provides validation, hashing, and verification functionality. 7 | /// 8 | /// ## Features: 9 | /// - Stores API keys in a hashed format for security. 10 | /// - Validates API key format before storing. 11 | /// - Provides a method to verify if an input key matches the stored hash. 12 | /// 13 | /// ## Usage Example: 14 | /// ```dart 15 | /// var apiKeyManager = AortemMagicAuthApiKeyManagement('your-api-key'); 16 | /// bool isValid = apiKeyManager.verifyApiKey('your-api-key'); 17 | /// print(isValid); // Outputs: true if valid 18 | /// ``` 19 | 20 | class AortemMagicAuthApiKeyManagement { 21 | /// Stores the hashed version of the API key. 22 | late String _hashedApiKey; 23 | 24 | /// Constructor to initialize with a validated API key. 25 | /// - [apiKey]: The API key to be stored securely. 26 | AortemMagicAuthApiKeyManagement(String apiKey) { 27 | setApiKey(apiKey); 28 | } 29 | 30 | /// Validates and sets a new API key in a hashed format. 31 | /// - Throws an [ArgumentError] if the API key is invalid. 32 | void setApiKey(String apiKey) { 33 | if (apiKey.isEmpty || !_validateApiKey(apiKey)) { 34 | throw ArgumentError('Invalid API key.'); 35 | } 36 | _hashedApiKey = AortemMagicSecureStorage.hashApiKey(apiKey); 37 | } 38 | 39 | /// Verifies if the provided API key matches the stored hashed API key. 40 | /// - Returns `true` if the input key is valid, otherwise `false`. 41 | bool verifyApiKey(String inputKey) { 42 | return AortemMagicSecureStorage.validateApiKey(inputKey, _hashedApiKey); 43 | } 44 | 45 | /// Ensures the API key follows a strict format. 46 | /// - Returns `true` if the key follows the correct format, otherwise `false`. 47 | bool _validateApiKey(String key) { 48 | return RegExp(r'^[a-zA-Z0-9._-]+$').hasMatch(key); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/lib/src/core/aortem_magic_constructor.dart: -------------------------------------------------------------------------------- 1 | /// AortemMagicAuth 2 | /// 3 | /// A class responsible for handling API key authentication securely within the Aortem Magic authentication system. 4 | /// It ensures proper validation and allows secure storage and retrieval of API keys. 5 | /// 6 | /// ## Features: 7 | /// - Validates API keys against a defined pattern. 8 | /// - Stores API keys securely and allows updates. 9 | /// - Provides methods for retrieving and modifying API keys dynamically. 10 | /// 11 | /// ## Usage Example: 12 | /// ```dart 13 | /// var auth = AortemMagicAuth('your-api-key'); 14 | /// print(auth.apiKey); // Outputs the stored API key 15 | /// auth.updateApiKey('new-api-key'); 16 | /// ``` 17 | class AortemMagicAuth { 18 | /// Stores the API key securely. 19 | late String _apiKey; // Use 'late' to ensure it gets initialized 20 | 21 | /// Regular expression pattern for validating API keys. 22 | static final RegExp _apiKeyPattern = RegExp(r'^[a-zA-Z0-9._-]+$'); 23 | 24 | /// Constructor with API key validation. 25 | /// - Throws an [ArgumentError] if the API key is invalid. 26 | AortemMagicAuth(String apiKey) { 27 | if (apiKey.isEmpty || !_validateApiKey(apiKey)) { 28 | throw ArgumentError('Invalid API key.'); 29 | } 30 | _apiKey = apiKey; 31 | } 32 | 33 | /// Validates the API key format. 34 | /// - Returns `true` if the key follows the correct format, otherwise `false`. 35 | bool _validateApiKey(String key) { 36 | return _apiKeyPattern.hasMatch(key); 37 | } 38 | 39 | /// Retrieves the stored API key securely. 40 | String get apiKey => _apiKey; 41 | 42 | /// Dynamically updates the API key with validation. 43 | /// - Throws an [ArgumentError] if the new key is invalid. 44 | void updateApiKey(String newKey) { 45 | if (newKey.isEmpty || !_validateApiKey(newKey)) { 46 | throw ArgumentError('Invalid API key.'); 47 | } 48 | _apiKey = newKey; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/lib/src/logout/aortem_magic_logout_address.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'package:ds_standard_features/ds_standard_features.dart' as http; 3 | 4 | /// AortemMagicLogoutByPublicAddress 5 | /// 6 | /// A class responsible for logging out users based on their public Ethereum-style address. 7 | /// It securely communicates with the Magic API to perform the logout operation. 8 | /// 9 | /// ## Features: 10 | /// - Validates public addresses before sending requests. 11 | /// - Supports an optional stub mode for testing. 12 | /// - Handles API responses and errors gracefully. 13 | /// 14 | /// ## Usage Example: 15 | /// ```dart 16 | /// var logoutHandler = AortemMagicLogoutByPublicAddress(apiKey: 'your-api-key'); 17 | /// await logoutHandler.logoutByPublicAddress('0x1234567890abcdef1234567890abcdef12345678'); 18 | /// ``` 19 | class AortemMagicLogoutByPublicAddress { 20 | /// API key required for authentication. 21 | final String apiKey; 22 | 23 | /// Base URL of the API. 24 | final String apiBaseUrl; 25 | 26 | /// HTTP client for making API requests. 27 | final http.Client client; 28 | 29 | /// Flag to enable stub mode for testing without actual API calls. 30 | final bool useStub; 31 | 32 | /// Constructor for initializing the logout handler. 33 | /// - Accepts an optional `client` for dependency injection (useful for testing). 34 | /// - Defaults `apiBaseUrl` to "https://api.magic.com". 35 | AortemMagicLogoutByPublicAddress({ 36 | required this.apiKey, 37 | this.apiBaseUrl = "https://api.magic.com", 38 | http.Client? client, 39 | this.useStub = false, 40 | }) : client = client ?? http.Client(); 41 | 42 | /// Logs out a user based on their public Ethereum address. 43 | /// - Validates the address format before sending the request. 44 | /// - Uses a mock response if `useStub` is enabled. 45 | /// - Throws an exception if the API request fails. 46 | Future> logoutByPublicAddress( 47 | String publicAddress) async { 48 | if (!_isValidPublicAddress(publicAddress)) { 49 | throw ArgumentError("Invalid public address format."); 50 | } 51 | 52 | if (useStub) { 53 | return _mockLogoutResponse(publicAddress); 54 | } 55 | 56 | final uri = Uri.parse("$apiBaseUrl/v1/user/logout"); 57 | 58 | final response = await client.post( 59 | uri, 60 | headers: { 61 | "Authorization": "Bearer $apiKey", 62 | "Content-Type": "application/json", 63 | }, 64 | body: jsonEncode({"publicAddress": publicAddress}), 65 | ); 66 | 67 | if (response.statusCode == 200) { 68 | return jsonDecode(response.body); 69 | } else { 70 | throw Exception( 71 | "Failed to log out: ${response.statusCode} - ${response.body}"); 72 | } 73 | } 74 | 75 | /// Generates a mock response for logout operations (useful for testing). 76 | /// - Returns a success message for the provided `publicAddress`. 77 | Map _mockLogoutResponse(String publicAddress) { 78 | return { 79 | "success": true, 80 | "message": 81 | "User with public address $publicAddress logged out successfully.", 82 | }; 83 | } 84 | 85 | /// Validates an Ethereum-style public address. 86 | /// - The address must start with "0x" followed by 40 hexadecimal characters. 87 | /// - Returns `true` if the address is valid, otherwise `false`. 88 | bool _isValidPublicAddress(String address) { 89 | final regex = RegExp(r"^0x[a-fA-F0-9]{40}$"); 90 | return regex.hasMatch(address); 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/lib/src/logout/aortem_magic_logout_issuer.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'package:ds_standard_features/ds_standard_features.dart' as http; 3 | 4 | /// AortemMagicLogoutByIssuer 5 | /// 6 | /// A class responsible for logging out users based on their issuer identifier. 7 | /// It securely communicates with the Magic API to perform the logout operation. 8 | /// 9 | /// ## Features: 10 | /// - Ensures the issuer is valid before sending requests. 11 | /// - Supports an optional stub mode for testing. 12 | /// - Handles API responses and errors gracefully. 13 | /// 14 | /// ## Usage Example: 15 | /// ```dart 16 | /// var logoutHandler = AortemMagicLogoutByIssuer(apiKey: 'your-api-key'); 17 | /// await logoutHandler.logoutByIssuer('issuer-identifier'); 18 | /// ``` 19 | class AortemMagicLogoutByIssuer { 20 | /// API key required for authentication. 21 | final String apiKey; 22 | 23 | /// Base URL of the API. 24 | final String apiBaseUrl; 25 | 26 | /// HTTP client for making API requests. 27 | final http.Client client; 28 | 29 | /// Flag to enable stub mode for testing without actual API calls. 30 | final bool useStub; 31 | 32 | /// Constructor for initializing the logout handler. 33 | /// - Accepts an optional `client` for dependency injection (useful for testing). 34 | /// - Defaults `apiBaseUrl` to "https://api.magic.com". 35 | AortemMagicLogoutByIssuer({ 36 | required this.apiKey, 37 | this.apiBaseUrl = "https://api.magic.com", 38 | http.Client? client, 39 | this.useStub = false, 40 | }) : client = client ?? http.Client(); 41 | 42 | /// Logs out a user based on their issuer identifier. 43 | /// - Ensures the issuer is not empty before sending the request. 44 | /// - Uses a mock response if `useStub` is enabled. 45 | /// - Throws an exception if the API request fails. 46 | Future> logoutByIssuer(String issuer) async { 47 | if (issuer.isEmpty) { 48 | throw ArgumentError("Issuer cannot be empty."); 49 | } 50 | 51 | if (useStub) { 52 | return _mockLogoutResponse(issuer); 53 | } 54 | 55 | final uri = Uri.parse("$apiBaseUrl/v1/user/logout"); 56 | 57 | final response = await client.post( 58 | uri, 59 | headers: { 60 | "Authorization": "Bearer $apiKey", 61 | "Content-Type": "application/json", 62 | }, 63 | body: jsonEncode({"issuer": issuer}), 64 | ); 65 | 66 | if (response.statusCode == 200) { 67 | return jsonDecode(response.body); 68 | } else { 69 | throw Exception( 70 | "Failed to log out: ${response.statusCode} - ${response.body}"); 71 | } 72 | } 73 | 74 | /// Generates a mock response for logout operations (useful for testing). 75 | /// - Returns a success message for the provided `issuer`. 76 | Map _mockLogoutResponse(String issuer) { 77 | return { 78 | "success": true, 79 | "message": "User with issuer $issuer logged out successfully.", 80 | }; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/lib/src/logout/aortem_magic_logout_token.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'package:ds_standard_features/ds_standard_features.dart' as http; 3 | 4 | /// AortemMagicLogoutByToken 5 | /// 6 | /// A class responsible for logging out users based on their authentication token. 7 | /// It securely communicates with the Magic API to perform the logout operation. 8 | /// 9 | /// ## Features: 10 | /// - Ensures the token is valid before sending requests. 11 | /// - Supports an optional stub mode for testing. 12 | /// - Handles API responses and errors gracefully. 13 | /// 14 | /// ## Usage Example: 15 | /// ```dart 16 | /// var logoutHandler = AortemMagicLogoutByToken(apiKey: 'your-api-key'); 17 | /// await logoutHandler.logoutByToken('user-authentication-token'); 18 | /// ``` 19 | class AortemMagicLogoutByToken { 20 | /// API key required for authentication. 21 | final String apiKey; 22 | 23 | /// Base URL of the API. 24 | final String apiBaseUrl; 25 | 26 | /// HTTP client for making API requests. 27 | final http.Client client; 28 | 29 | /// Flag to enable stub mode for testing without actual API calls. 30 | final bool useStub; 31 | 32 | /// Constructor for initializing the logout handler. 33 | /// - Accepts an optional `client` for dependency injection (useful for testing). 34 | /// - Defaults `apiBaseUrl` to "https://api.magic.com". 35 | AortemMagicLogoutByToken({ 36 | required this.apiKey, 37 | this.apiBaseUrl = "https://api.magic.com", 38 | http.Client? client, 39 | this.useStub = false, 40 | }) : client = client ?? http.Client(); 41 | 42 | /// Logs out a user based on their authentication token. 43 | /// - Ensures the token is valid before sending the request. 44 | /// - Uses a mock response if `useStub` is enabled. 45 | /// - Throws an exception if the API request fails. 46 | Future> logoutByToken(String token) async { 47 | if (!_isValidToken(token)) { 48 | throw ArgumentError("Invalid token format."); 49 | } 50 | 51 | if (useStub) { 52 | return _mockLogoutResponse(token); 53 | } 54 | 55 | final uri = Uri.parse("$apiBaseUrl/v1/user/logout"); 56 | 57 | final response = await client.post( 58 | uri, 59 | headers: { 60 | "Authorization": "Bearer $apiKey", 61 | "Content-Type": "application/json", 62 | }, 63 | body: jsonEncode({"token": token}), 64 | ); 65 | 66 | if (response.statusCode == 200) { 67 | return jsonDecode(response.body); 68 | } else { 69 | throw Exception("Failed to log out: ${response.statusCode} - ${response.body}"); 70 | } 71 | } 72 | 73 | /// Generates a mock response for logout operations (useful for testing). 74 | /// - Returns a success message for the provided `token`. 75 | Map _mockLogoutResponse(String token) { 76 | return { 77 | "success": true, 78 | "message": "User with token $token logged out successfully.", 79 | }; 80 | } 81 | 82 | /// Validates the token format (basic check for non-empty string). 83 | bool _isValidToken(String token) { 84 | return token.isNotEmpty; 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/lib/src/metadata/aortem_magic_address_metadata.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'package:ds_standard_features/ds_standard_features.dart' as http; 3 | 4 | // UserMetadataByPublicAddress 5 | /// 6 | /// A class responsible for fetching user metadata based on their public address. 7 | /// It securely communicates with the Magic API to retrieve user details. 8 | /// 9 | /// ## Features: 10 | /// - Ensures the public address is valid before sending requests. 11 | /// - Supports an optional stub mode for testing. 12 | /// - Handles API responses and errors gracefully. 13 | /// 14 | /// ## Usage Example: 15 | /// ```dart 16 | /// var metadataHandler = UserMetadataByPublicAddress(apiKey: 'your-api-key'); 17 | /// var metadata = await metadataHandler.getMetadataByPublicAddress('user-public-address'); 18 | /// print(metadata); 19 | /// ``` 20 | class AortemMagicUserMetadataByPublicAddress { 21 | /// API key required for authentication. 22 | final String apiKey; 23 | 24 | /// Base URL of the API. 25 | final String apiBaseUrl; 26 | 27 | /// HTTP client for making API requests. 28 | final http.Client client; 29 | 30 | /// Constructor for initializing the metadata handler. 31 | /// - Accepts an optional `client` for dependency injection (useful for testing). 32 | /// - Defaults `apiBaseUrl` to "https://api.magic.com". 33 | AortemMagicUserMetadataByPublicAddress({ 34 | required this.apiKey, 35 | this.apiBaseUrl = "https://api.magic.com", 36 | http.Client? client, 37 | }) : client = client ?? http.Client(); 38 | 39 | /// Fetches user metadata by public address. 40 | /// - Ensures the public address is not empty before sending the request. 41 | /// - Uses a mock response if `useStub` is enabled. 42 | /// - Throws an exception if the API request fails. 43 | Future> getMetadataByPublicAddress(String publicAddress, 44 | {bool useStub = false}) async { 45 | if (publicAddress.isEmpty) { 46 | throw ArgumentError("Public address cannot be empty."); 47 | } 48 | 49 | // Return stub data for testing purposes 50 | if (useStub) { 51 | return { 52 | "issuer": "did:magic:$publicAddress", 53 | "email": "user@example.com", 54 | "publicAddress": publicAddress, 55 | "createdAt": DateTime.now().millisecondsSinceEpoch, 56 | }; 57 | } 58 | 59 | final uri = 60 | Uri.parse("$apiBaseUrl/v1/user/metadata?public_address=$publicAddress"); 61 | 62 | final response = await client.get( 63 | uri, 64 | headers: { 65 | "Authorization": "Bearer $apiKey", 66 | "Content-Type": "application/json", 67 | }, 68 | ); 69 | 70 | if (response.statusCode == 200) { 71 | return jsonDecode(response.body); 72 | } else { 73 | throw Exception( 74 | "Failed to fetch metadata: ${response.statusCode} - ${response.body}"); 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/lib/src/metadata/aortem_magic_issuer_metadata.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'package:ds_standard_features/ds_standard_features.dart' as http; 3 | 4 | /// UserMetaDataByIssuer 5 | /// 6 | /// A class responsible for fetching user metadata based on the issuer identifier. 7 | /// It securely communicates with the Magic API to retrieve user details. 8 | /// 9 | /// ## Features: 10 | /// - Ensures the issuer is valid before sending requests. 11 | /// - Handles API responses and errors gracefully. 12 | /// - Allows dependency injection for testing with mock clients. 13 | /// 14 | /// ## Usage Example: 15 | /// ```dart 16 | /// var metadataFetcher = UserMetaDataByIssuer(apiKey: 'your-api-key'); 17 | /// var userMetadata = await metadataFetcher.getMetadataByIssuer('issuer-identifier'); 18 | /// print(userMetadata); 19 | /// ``` 20 | class AortemMagicUserMetaDataByIssuer { 21 | /// API key required for authentication. 22 | final String apiKey; 23 | 24 | /// Base URL of the API. 25 | final String apiBaseUrl; 26 | 27 | /// HTTP client for making API requests. 28 | final http.Client client; 29 | 30 | /// Constructor for initializing the metadata fetcher. 31 | /// - Accepts an optional `client` for dependency injection (useful for testing). 32 | /// - Defaults `apiBaseUrl` to "https://api.magic.com". 33 | AortemMagicUserMetaDataByIssuer({ 34 | required this.apiKey, 35 | this.apiBaseUrl = "https://api.magic.com", 36 | http.Client? client, 37 | }) : client = client ?? http.Client(); // Allow passing a mock client 38 | 39 | /// Fetches metadata by issuer identifier. 40 | /// - Ensures the issuer is not empty before sending the request. 41 | /// - Throws an exception if the API request fails. 42 | Future> getMetadataByIssuer(String issuer) async { 43 | if (issuer.isEmpty) { 44 | throw ArgumentError("Issuer cannot be empty."); 45 | } 46 | 47 | final uri = Uri.parse("$apiBaseUrl/v1/user/metadata?issuer=$issuer"); 48 | final response = await client.get( 49 | uri, 50 | headers: { 51 | "Authorization": "Bearer $apiKey", 52 | "Content-Type": "application/json", 53 | }, 54 | ); 55 | 56 | if (response.statusCode == 200) { 57 | return jsonDecode(response.body); 58 | } else { 59 | throw Exception( 60 | "Failed to fetch metadata: ${response.statusCode} - ${response.body}"); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/lib/src/metadata/aortem_magic_token_metadata.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'package:ds_standard_features/ds_standard_features.dart' as http; 3 | 4 | /// UserMetadataByToken 5 | /// 6 | /// A class responsible for fetching user metadata using an authentication token. 7 | /// It securely communicates with the Magic API to retrieve user details. 8 | /// 9 | /// ## Features: 10 | /// - Ensures the token is valid before sending requests. 11 | /// - Fetches metadata including issuer, email, and creation timestamp. 12 | /// - Handles API responses and errors gracefully. 13 | /// 14 | /// ## Usage Example: 15 | /// ```dart 16 | /// var metadataHandler = UserMetadataByToken(apiKey: 'your-api-key'); 17 | /// var metadata = await metadataHandler.getMetadataByToken('user-authentication-token'); 18 | /// print(metadata); 19 | /// ``` 20 | class AortemMagicUserMetadataByToken { 21 | /// API key required for authentication. 22 | final String apiKey; 23 | 24 | /// Base URL of the API. 25 | final String apiBaseUrl; 26 | 27 | /// HTTP client for making API requests. 28 | final http.Client client; 29 | 30 | /// Constructor for initializing the metadata handler. 31 | /// - Accepts an optional `client` for dependency injection (useful for testing). 32 | /// - Defaults `apiBaseUrl` to "https://api.magic.com". 33 | AortemMagicUserMetadataByToken({ 34 | required this.apiKey, 35 | this.apiBaseUrl = "https://api.magic.com", 36 | http.Client? client, 37 | }) : client = client ?? http.Client(); 38 | 39 | /// Fetches metadata using a provided authentication token. 40 | /// - Ensures the token is not empty before sending the request. 41 | /// - Throws an exception if the API request fails. 42 | Future> getMetadataByToken(String token) async { 43 | if (token.isEmpty) { 44 | throw ArgumentError("Token cannot be empty."); 45 | } 46 | 47 | final uri = Uri.parse("$apiBaseUrl/v1/user/metadata?token=$token"); 48 | 49 | final response = await client.get( 50 | uri, 51 | headers: { 52 | "Authorization": "Bearer $apiKey", 53 | "Content-Type": "application/json", 54 | }, 55 | ); 56 | 57 | if (response.statusCode == 200) { 58 | return jsonDecode(response.body); 59 | } else { 60 | throw Exception( 61 | "Failed to fetch metadata: ${response.statusCode} - ${response.body}"); 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/lib/src/utils/aortem_magic_parse_auth_header.dart: -------------------------------------------------------------------------------- 1 | /// Utility class for handling Authorization headers. 2 | class AortemMagicAuthHeaderParse { 3 | /// Parses the [authorizationHeader] and extracts the token. 4 | /// 5 | /// This method expects the header to be in the format: `"Bearer "`. 6 | /// 7 | /// - If the header is empty, it throws an [ArgumentError]. 8 | /// - If the format is incorrect, it throws an [ArgumentError] indicating the expected format. 9 | /// 10 | /// Example: 11 | /// ```dart 12 | /// try { 13 | /// String token = MagicUtils.parseAuthorizationHeader("Bearer myAccessToken123"); 14 | /// print("Extracted Token: $token"); // Output: myAccessToken123 15 | /// } catch (e) { 16 | /// print("Error: $e"); 17 | /// } 18 | /// ``` 19 | /// 20 | /// Returns the extracted token as a [String]. 21 | static String parseAuthorizationHeader(String authorizationHeader) { 22 | if (authorizationHeader.isEmpty) { 23 | throw ArgumentError('Authorization header cannot be empty.'); 24 | } 25 | 26 | // Trim any leading or trailing spaces 27 | final trimmedHeader = authorizationHeader.trim(); 28 | 29 | // Simple String Splitting Approach 30 | final parts = trimmedHeader.split(' '); 31 | if (parts.length == 2 && parts[0].toLowerCase() == 'bearer') { 32 | return parts[1]; // Return the extracted token 33 | } 34 | 35 | // Regular Expression Approach (for extra robustness) 36 | final regex = RegExp(r'^[Bb]earer\s+(.+)$'); 37 | final match = regex.firstMatch(trimmedHeader); 38 | if (match != null && match.groupCount >= 1) { 39 | return match.group(1)!; // Extract token using regex 40 | } 41 | 42 | throw ArgumentError( 43 | 'Invalid Authorization header format. Expected "Bearer ".'); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/lib/src/utils/aortem_magic_secure_storage.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'package:ds_standard_features/ds_standard_features.dart'; 3 | 4 | /// A utility class for securely handling API keys using SHA-256 hashing. 5 | class AortemMagicSecureStorage { 6 | /// Hashes the given [apiKey] using the SHA-256 algorithm for secure storage. 7 | /// 8 | /// This method converts the API key into a SHA-256 hash, which ensures that 9 | /// the original key is not stored in plain text. 10 | /// 11 | /// Example: 12 | /// ```dart 13 | /// String hashedKey = SecureStorage.hashApiKey("my-secret-api-key"); 14 | /// print(hashedKey); // Outputs hashed representation of the key 15 | /// ``` 16 | /// 17 | /// Returns a hashed string representation of the API key. 18 | static String hashApiKey(String apiKey) { 19 | final bytes = utf8.encode(apiKey); 20 | final digest = sha256.convert(bytes); 21 | return digest.toString(); // Returns hashed API key 22 | } 23 | 24 | /// Validates if the given [inputKey] matches the [storedHash]. 25 | /// 26 | /// This method hashes the input key and compares it with the stored hash 27 | /// to verify if they are the same. 28 | /// 29 | /// Example: 30 | /// ```dart 31 | /// bool isValid = SecureStorage.validateApiKey("my-secret-api-key", storedHash); 32 | /// print(isValid); // Outputs true if the key matches the stored hash 33 | /// ``` 34 | /// 35 | /// Returns `true` if the input key matches the stored hash, otherwise `false`. 36 | static bool validateApiKey(String inputKey, String storedHash) { 37 | return hashApiKey(inputKey) == storedHash; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/local_dev_tools/validate_branch.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | void main(List args) { 4 | print('Validating branch name...'); 5 | 6 | // Retrieve the branch name 7 | final result = Process.runSync('git', ['rev-parse', '--abbrev-ref', 'HEAD']); 8 | final branchName = result.stdout.toString().trim(); 9 | 10 | if (branchName.isEmpty) { 11 | print('❌ Could not determine branch name.'); 12 | exit(1); 13 | } 14 | 15 | print('Branch name: $branchName'); 16 | 17 | final validBranches = RegExp(r'^(qa|beta|main)$'); 18 | final validFeatureBranch = 19 | RegExp(r'^(feat|fix|hotfix|chore|test|refactor|release)/[a-z0-9_-]+$'); 20 | 21 | if (validBranches.hasMatch(branchName) || 22 | validFeatureBranch.hasMatch(branchName)) { 23 | print('✅ Branch name is valid.'); 24 | } else { 25 | print( 26 | '❌ Branch name does not follow the required convention: /'); 27 | print( 28 | 'Valid types: feat, fix, hotfix, chore, test, refactor, release, qa, beta, main'); 29 | exit(1); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/local_dev_tools/validate_commit.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | void main(List args) { 4 | print('Validating commit...'); 5 | 6 | // Run dart analyze 7 | final analyzeResult = Process.runSync('dart', ['analyze']); 8 | if (analyzeResult.exitCode != 0) { 9 | print('❌ Dart analyze failed. Please fix the issues.'); 10 | print(analyzeResult.stdout); 11 | exit(1); 12 | } 13 | 14 | // Run dart format 15 | final formatResult = 16 | Process.runSync('dart', ['format', '--set-exit-if-changed', '.']); 17 | if (formatResult.exitCode != 0) { 18 | print('❌ Dart format failed. Please format your code.'); 19 | exit(1); 20 | } 21 | 22 | print('✅ Commit passed all validations.'); 23 | } 24 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/local_dev_tools/validate_commit_msg.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | void main(List args) { 4 | print('Validating commit message...'); 5 | 6 | if (args.isEmpty) { 7 | print('❌ No commit message file provided.'); 8 | exit(1); 9 | } 10 | 11 | final commitMessage = File(args[0]).readAsStringSync(); 12 | final regex = RegExp( 13 | r'^(feat|fix|hotfix|chore|test|refactor|release)(\([a-z0-9_-]+\))?: .{1,72}$'); 14 | 15 | if (!regex.hasMatch(commitMessage)) { 16 | print('❌ Commit message does not follow the required format.'); 17 | print('Format: (): '); 18 | print('Examples:'); 19 | print(' feat(auth): add OAuth 2.0 support'); 20 | print(' fix(payment): resolve rounding error'); 21 | exit(1); 22 | } 23 | 24 | print('✅ Commit message is valid.'); 25 | } 26 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: magic_dart_auth_sdk 2 | description: A Dart SDK for Magic Authentication, enabling secure server-side authentication and user management for Dart-based backend applications. 3 | version: 0.0.1-pre+2 4 | repository: https://github.com/aortem/magic-dart-auth-sdk 5 | 6 | environment: 7 | sdk: ^3.7.2 8 | 9 | # Add regular dependencies here. 10 | 11 | dependencies: 12 | #------------------ STANDARD FEATURES--------------------------------- 13 | ## There are three standard libraries. Each one can be used with a different xxx 14 | 15 | ds_standard_features: ^0.0.1-pre+11 #Standard Dart Team Utilities For HTTP //Default 16 | build_web_compilers: ^4.0.11 17 | jwt_generator: ^0.0.3 18 | logging: ^1.3.0 19 | 20 | 21 | #------------------ TESTING FEATURES--------------------------------- 22 | 23 | dev_dependencies: 24 | ds_tools_testing: ^0.0.1-pre+2 #Standard Dart Team Testing Tools 25 | test_reporter: any #required to generate JUnit report 26 | http: any 27 | git_hooks: any 28 | 29 | # Optional Local Hooks for development. 30 | git_hooks: 31 | hooks: 32 | pre-commit: ./local_dev_tools/validate_commit.dart 33 | commit-msg: ./local_dev_tools/validate_commit_msg.dart 34 | pre-push: ./local_dev_tools/validate_branch.dart -------------------------------------------------------------------------------- /magic-dart-auth-sdk/test.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "service_account", 3 | "project_id": "mock-project-id", 4 | "private_key_id": "mock-private-key-id", 5 | "private_key": "-----BEGIN PRIVATE KEY-----\\nmock-private-key\\n-----END PRIVATE KEY-----\\n", 6 | "client_email": "mock-client-email@mock-project-id.iam.gserviceaccount.com", 7 | "client_id": "mock-client-id", 8 | "auth_uri": "https://accounts.google.com/o/oauth2/auth", 9 | "token_uri": "https://oauth2.googleapis.com/token", 10 | "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", 11 | "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/mock-client-email" 12 | } 13 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/test/unit/auth/aortem_magic_issuer_test.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:ds_tools_testing/ds_tools_testing.dart'; 4 | import 'package:magic_dart_auth_sdk/src/auth/aortem_magic_issuer.dart'; 5 | 6 | void main() { 7 | group('IssuerExtractor.getIssuer', () { 8 | // Valid issuer 9 | const validIssuer = 'https://auth.magic.com'; 10 | 11 | // Helper function to generate a mock DID token 12 | String generateDidToken(String issuer) { 13 | final header = 14 | base64Url.encode(utf8.encode('{"alg":"HS256","typ":"JWT"}')); 15 | final payload = base64Url.encode(utf8.encode('{"iss":"$issuer"}')); 16 | return '$header.$payload.signature'; 17 | } 18 | 19 | test('Extracts issuer with strict validation - valid case', () { 20 | final didToken = generateDidToken(validIssuer); 21 | final result = 22 | AortemMagicIssuerExtractor.getIssuer(didToken, strict: true); 23 | expect(result, equals(validIssuer)); 24 | }); 25 | 26 | test('Extracts issuer with loose validation - valid case', () { 27 | final didToken = generateDidToken(validIssuer); 28 | final result = 29 | AortemMagicIssuerExtractor.getIssuer(didToken, strict: false); 30 | expect(result, equals(validIssuer)); 31 | }); 32 | 33 | test('Throws error for empty DID Token', () { 34 | expect(() => AortemMagicIssuerExtractor.getIssuer('', strict: true), 35 | throwsA(isA())); 36 | }); 37 | 38 | test('Throws error for invalid JWT format', () { 39 | expect( 40 | () => AortemMagicIssuerExtractor.getIssuer('invalid.token', 41 | strict: true), 42 | throwsA(isA())); 43 | }); 44 | 45 | test('Throws error when "iss" field is missing', () { 46 | final header = 47 | base64Url.encode(utf8.encode('{"alg":"HS256","typ":"JWT"}')); 48 | final payload = base64Url.encode(utf8.encode('{"other_field":"value"}')); 49 | final invalidToken = '$header.$payload.signature'; 50 | 51 | expect( 52 | () => 53 | AortemMagicIssuerExtractor.getIssuer(invalidToken, strict: true), 54 | throwsA(isA())); 55 | }); 56 | 57 | test('Throws error for invalid issuer format in strict mode', () { 58 | final didToken = generateDidToken('invalid_issuer'); 59 | expect(() => AortemMagicIssuerExtractor.getIssuer(didToken, strict: true), 60 | throwsA(isA())); 61 | }); 62 | 63 | test('Accepts loosely formatted issuer in loose mode', () { 64 | final looseIssuer = 'auth.magic.com'; 65 | final didToken = generateDidToken(looseIssuer); 66 | final result = 67 | AortemMagicIssuerExtractor.getIssuer(didToken, strict: false); 68 | expect(result, equals(looseIssuer)); 69 | }); 70 | 71 | test('Throws error for invalid issuer format in loose mode', () { 72 | final didToken = generateDidToken(''); 73 | expect( 74 | () => AortemMagicIssuerExtractor.getIssuer(didToken, strict: false), 75 | throwsA(isA())); 76 | }); 77 | }); 78 | } 79 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/test/unit/auth/aortem_magic_public_address_test.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:magic_dart_auth_sdk/src/auth/aortem_magic_public_address.dart'; 4 | import 'package:ds_tools_testing/ds_tools_testing.dart'; 5 | 6 | void main() { 7 | group('PublicAddressExtractor.getPublicAddress', () { 8 | // A valid Ethereum address 9 | const validEthAddress = '0x1234567890abcdef1234567890abcdef12345678'; 10 | 11 | // Helper function to generate a mock DID token 12 | String generateDidToken(String address) { 13 | final header = 14 | base64Url.encode(utf8.encode('{"alg":"HS256","typ":"JWT"}')); 15 | final payload = base64Url.encode(utf8.encode('{"sub":"$address"}')); 16 | return '$header.$payload.signature'; 17 | } 18 | 19 | test('Extracts public address with strict validation - valid case', () { 20 | final didToken = generateDidToken(validEthAddress); 21 | final result = AortemMagicPublicAddressExtractor.getPublicAddress( 22 | didToken, 23 | strict: true); 24 | expect(result, equals(validEthAddress)); 25 | }); 26 | 27 | test('Extracts public address with loose validation - valid case', () { 28 | final didToken = generateDidToken(validEthAddress); 29 | final result = AortemMagicPublicAddressExtractor.getPublicAddress( 30 | didToken, 31 | strict: false); 32 | expect(result, equals(validEthAddress)); 33 | }); 34 | 35 | test('Throws error for empty DID Token', () { 36 | expect( 37 | () => AortemMagicPublicAddressExtractor.getPublicAddress('', 38 | strict: true), 39 | throwsA(isA())); 40 | }); 41 | 42 | test('Throws error for invalid JWT format', () { 43 | expect( 44 | () => AortemMagicPublicAddressExtractor.getPublicAddress( 45 | 'invalid.token', 46 | strict: true), 47 | throwsA(isA())); 48 | }); 49 | 50 | test('Throws error when "sub" field is missing', () { 51 | final header = 52 | base64Url.encode(utf8.encode('{"alg":"HS256","typ":"JWT"}')); 53 | final payload = base64Url.encode(utf8.encode('{"other_field":"value"}')); 54 | final invalidToken = '$header.$payload.signature'; 55 | 56 | expect( 57 | () => AortemMagicPublicAddressExtractor.getPublicAddress(invalidToken, 58 | strict: true), 59 | throwsA(isA())); 60 | }); 61 | 62 | test('Throws error for invalid Ethereum address in strict mode', () { 63 | final didToken = generateDidToken('0xInvalidEthAddress'); 64 | expect( 65 | () => AortemMagicPublicAddressExtractor.getPublicAddress(didToken, 66 | strict: true), 67 | throwsA(isA())); 68 | }); 69 | 70 | test('Accepts loosely formatted Ethereum address in loose mode', () { 71 | final looseEthAddress = '0xabc'; 72 | final didToken = generateDidToken(looseEthAddress); 73 | final result = AortemMagicPublicAddressExtractor.getPublicAddress( 74 | didToken, 75 | strict: false); 76 | expect(result, equals(looseEthAddress)); 77 | }); 78 | 79 | test('Throws error for invalid Ethereum address in loose mode', () { 80 | final didToken = generateDidToken('InvalidAddress'); 81 | expect( 82 | () => AortemMagicPublicAddressExtractor.getPublicAddress(didToken, 83 | strict: false), 84 | throwsA(isA())); 85 | }); 86 | }); 87 | } 88 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/test/unit/auth/aortem_magic_token_decode_test.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:ds_tools_testing/ds_tools_testing.dart'; 4 | import 'package:magic_dart_auth_sdk/src/auth/aortem_magic_token_decode.dart'; 5 | 6 | void main() { 7 | group('TokenDecoder.decode', () { 8 | // Sample valid payload 9 | const validPayload = 10 | '{"iss":"https://auth.magic.com","sub":"0x123456789abcdef"}'; 11 | 12 | // Helper function to generate a mock DID token 13 | String generateDidToken(String payload) { 14 | final header = 15 | base64Url.encode(utf8.encode('{"alg":"HS256","typ":"JWT"}')); 16 | final encodedPayload = base64Url.encode(utf8.encode(payload)); 17 | return '$header.$encodedPayload.signature'; 18 | } 19 | 20 | test('Decodes valid DID Token without verification', () { 21 | final didToken = generateDidToken(validPayload); 22 | final result = AortemMagicTokenDecoder.decode(didToken); 23 | expect(result['iss'], equals('https://auth.magic.com')); 24 | expect(result['sub'], equals('0x123456789abcdef')); 25 | }); 26 | 27 | test('Decodes valid DID Token with verification', () { 28 | final didToken = generateDidToken(validPayload); 29 | final result = AortemMagicTokenDecoder.decode(didToken, verify: true); 30 | expect(result['iss'], equals('https://auth.magic.com')); 31 | expect(result['sub'], equals('0x123456789abcdef')); 32 | }); 33 | 34 | test('Throws error for empty DID Token', () { 35 | expect(() => AortemMagicTokenDecoder.decode(''), 36 | throwsA(isA())); 37 | }); 38 | 39 | test('Throws error for invalid JWT format', () { 40 | expect(() => AortemMagicTokenDecoder.decode('invalid.token'), 41 | throwsA(isA())); 42 | }); 43 | 44 | test('Throws error when "iss" field is missing with verification', () { 45 | final invalidPayload = '{"sub":"0x123456789abcdef"}'; 46 | final didToken = generateDidToken(invalidPayload); 47 | 48 | expect(() => AortemMagicTokenDecoder.decode(didToken, verify: true), 49 | throwsA(isA())); 50 | }); 51 | 52 | test('Throws error when "sub" field is missing with verification', () { 53 | final invalidPayload = '{"iss":"https://auth.magic.com"}'; 54 | final didToken = generateDidToken(invalidPayload); 55 | 56 | expect(() => AortemMagicTokenDecoder.decode(didToken, verify: true), 57 | throwsA(isA())); 58 | }); 59 | 60 | test( 61 | 'Decodes DID Token without required fields when verification is disabled', 62 | () { 63 | final invalidPayload = '{}'; 64 | final didToken = generateDidToken(invalidPayload); 65 | 66 | final result = AortemMagicTokenDecoder.decode(didToken, verify: false); 67 | expect(result, isEmpty); 68 | }); 69 | }); 70 | } 71 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/test/unit/auth/aortem_magic_token_validation_test.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:ds_tools_testing/ds_tools_testing.dart'; 4 | import 'package:magic_dart_auth_sdk/src/auth/aortem_magic_token_validation.dart'; 5 | 6 | void main() { 7 | group('TokenValidator.validate', () { 8 | // Sample valid payload 9 | final validPayload = 10 | '{"iss":"https://auth.magic.com","sub":"0x123456789abcdef","exp":${(DateTime.now().millisecondsSinceEpoch ~/ 1000) + 3600}}'; 11 | 12 | // Sample expired token payload 13 | final expiredPayload = 14 | '{"iss":"https://auth.magic.com","sub":"0x123456789abcdef","exp":${(DateTime.now().millisecondsSinceEpoch ~/ 1000) - 3600}}'; 15 | 16 | // Helper function to generate a mock DID token 17 | String generateDidToken(String payload) { 18 | final header = 19 | base64Url.encode(utf8.encode('{"alg":"HS256","typ":"JWT"}')); 20 | final encodedPayload = base64Url.encode(utf8.encode(payload)); 21 | return '$header.$encodedPayload.signature'; 22 | } 23 | 24 | test('Validates a properly formatted DID Token without additional checks', 25 | () { 26 | final didToken = generateDidToken(validPayload); 27 | expect(AortemMagicTokenValidator.validate(didToken), isTrue); 28 | }); 29 | 30 | test('Validates a DID Token with required claims', () { 31 | final didToken = generateDidToken(validPayload); 32 | expect(AortemMagicTokenValidator.validate(didToken, checkClaims: true), 33 | isTrue); 34 | }); 35 | 36 | test('Throws error if "iss" field is missing', () { 37 | final invalidPayload = '{"sub":"0x123456789abcdef"}'; 38 | final didToken = generateDidToken(invalidPayload); 39 | 40 | expect( 41 | () => AortemMagicTokenValidator.validate(didToken, checkClaims: true), 42 | throwsA(isA())); 43 | }); 44 | 45 | test('Throws error if "sub" field is missing', () { 46 | final invalidPayload = '{"iss":"https://auth.magic.com"}'; 47 | final didToken = generateDidToken(invalidPayload); 48 | 49 | expect( 50 | () => AortemMagicTokenValidator.validate(didToken, checkClaims: true), 51 | throwsA(isA())); 52 | }); 53 | 54 | test('Throws error if token is expired', () { 55 | final didToken = generateDidToken(expiredPayload); 56 | 57 | expect( 58 | () => AortemMagicTokenValidator.validate(didToken, 59 | checkExpiration: true), 60 | throwsA(isA())); 61 | }); 62 | 63 | test('Passes validation if token is not expired', () { 64 | final didToken = generateDidToken(validPayload); 65 | expect( 66 | AortemMagicTokenValidator.validate(didToken, checkExpiration: true), 67 | isTrue); 68 | }); 69 | 70 | test('Basic validation checks only format', () { 71 | final didToken = generateDidToken(validPayload); 72 | expect(AortemMagicTokenValidator.basicValidate(didToken), isTrue); 73 | }); 74 | 75 | test('Full validation checks format, claims, and expiration', () { 76 | final didToken = generateDidToken(validPayload); 77 | expect(AortemMagicTokenValidator.fullValidate(didToken), isTrue); 78 | }); 79 | }); 80 | } 81 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/test/unit/core/aortem_magic_api_key_manager_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:ds_tools_testing/ds_tools_testing.dart'; 2 | import 'package:magic_dart_auth_sdk/src/core/aortem_magic_api_key_manager.dart'; 3 | 4 | 5 | void main() { 6 | group('API Key Manager Tests', () { 7 | test('Initializes with a valid API key', () { 8 | final apiKeyManager = AortemMagicAuthApiKeyManagement('valid-key-123'); 9 | expect(apiKeyManager.verifyApiKey('valid-key-123'), isTrue); 10 | }); 11 | 12 | test('Throws error for invalid API key', () { 13 | expect(() => AortemMagicAuthApiKeyManagement(''), throwsA(isA())); 14 | }); 15 | 16 | test('Updates API key dynamically', () { 17 | final apiKeyManager = AortemMagicAuthApiKeyManagement('valid-key-123'); 18 | apiKeyManager.setApiKey('new-key-456'); 19 | expect(apiKeyManager.verifyApiKey('new-key-456'), isTrue); 20 | }); 21 | 22 | test('Fails validation for incorrect API key', () { 23 | final apiKeyManager = AortemMagicAuthApiKeyManagement('valid-key-123'); 24 | expect(apiKeyManager.verifyApiKey('wrong-key'), isFalse); 25 | }); 26 | }); 27 | } 28 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/test/unit/core/aortem_magic_constructor_test.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:ds_tools_testing/ds_tools_testing.dart'; 3 | import 'package:magic_dart_auth_sdk/src/core/aortem_magic_constructor.dart'; 4 | 5 | void main() { 6 | group('MagicAuth Constructor Tests', () { 7 | test('Initializes with valid API key', () { 8 | final magic = AortemMagicAuth('valid-api-key'); 9 | expect(magic.apiKey, equals('valid-api-key')); 10 | }); 11 | 12 | test('Throws error for empty API key', () { 13 | expect(() => AortemMagicAuth(''), throwsA(isA())); 14 | }); 15 | 16 | test('Throws error for invalid API key format', () { 17 | expect(() => AortemMagicAuth('invalid key!'), throwsA(isA())); 18 | }); 19 | }); 20 | 21 | group('MagicAuth API Key Update Tests', () { 22 | test('Updates API key successfully', () { 23 | final magic = AortemMagicAuth('valid-api-key'); 24 | magic.updateApiKey('new-valid-key'); 25 | expect(magic.apiKey, equals('new-valid-key')); 26 | }); 27 | 28 | test('Throws error for updating with empty API key', () { 29 | final magic = AortemMagicAuth('valid-api-key'); 30 | expect(() => magic.updateApiKey(''), throwsA(isA())); 31 | }); 32 | 33 | test('Throws error for updating with invalid API key format', () { 34 | final magic = AortemMagicAuth('valid-api-key'); 35 | expect(() => magic.updateApiKey('invalid key!'), throwsA(isA())); 36 | }); 37 | }); 38 | } 39 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/test/unit/logout/aortem_magic_logout_address_test.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:ds_tools_testing/ds_tools_testing.dart'; 4 | import 'package:ds_standard_features/ds_standard_features.dart' as http; 5 | import 'package:magic_dart_auth_sdk/src/logout/aortem_magic_logout_address.dart'; 6 | 7 | class MockHttpClient extends Mock implements http.Client {} 8 | 9 | void main() { 10 | late AortemMagicLogoutByPublicAddress logoutService; 11 | late MockHttpClient mockHttpClient; 12 | 13 | setUp(() { 14 | mockHttpClient = MockHttpClient(); 15 | logoutService = AortemMagicLogoutByPublicAddress( 16 | apiKey: "test_api_key", 17 | client: mockHttpClient, 18 | ); 19 | 20 | registerFallbackValue(Uri.parse("https://api.magic.com/v1/user/logout")); 21 | }); 22 | 23 | test("Returns success when logout by public address is successful", () async { 24 | const String testPublicAddress = 25 | "0x1234567890abcdef1234567890abcdef12345678"; 26 | final expectedResponse = { 27 | "success": true, 28 | "message": "Logged out successfully" 29 | }; 30 | 31 | when(() => mockHttpClient.post( 32 | any(), 33 | headers: any(named: "headers"), 34 | body: any(named: "body"), 35 | )) 36 | .thenAnswer( 37 | (_) async => http.Response(jsonEncode(expectedResponse), 200)); 38 | 39 | final result = await logoutService.logoutByPublicAddress(testPublicAddress); 40 | 41 | expect(result, expectedResponse); 42 | }); 43 | 44 | test("Throws an error when public address is empty or invalid", () async { 45 | expect( 46 | () => logoutService.logoutByPublicAddress("invalid_address"), 47 | throwsA(isA()), 48 | ); 49 | }); 50 | 51 | test("Throws an error when API response is not 200", () async { 52 | const String testPublicAddress = 53 | "0x1234567890abcdef1234567890abcdef12345678"; 54 | 55 | when(() => mockHttpClient.post( 56 | any(), 57 | headers: any(named: "headers"), 58 | body: any(named: "body"), 59 | )).thenAnswer((_) async => http.Response("Unauthorized", 401)); 60 | 61 | expect( 62 | () => logoutService.logoutByPublicAddress(testPublicAddress), 63 | throwsA(isA()), 64 | ); 65 | }); 66 | 67 | test("Returns mock response when useStub is true", () async { 68 | final stubLogoutService = 69 | AortemMagicLogoutByPublicAddress(apiKey: "test_api_key", useStub: true); 70 | 71 | final response = await stubLogoutService 72 | .logoutByPublicAddress("0x1234567890abcdef1234567890abcdef12345678"); 73 | 74 | expect(response["success"], true); 75 | expect(response["message"], contains("logged out successfully")); 76 | }); 77 | } 78 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/test/unit/logout/aortem_magic_logout_issuer_test.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'package:ds_standard_features/ds_standard_features.dart' as http; 3 | import 'package:ds_tools_testing/ds_tools_testing.dart'; 4 | import 'package:magic_dart_auth_sdk/src/logout/aortem_magic_logout_issuer.dart'; 5 | 6 | class MockHttpClient extends Mock implements http.Client {} 7 | 8 | void main() { 9 | late AortemMagicLogoutByIssuer logoutService; 10 | late MockHttpClient mockHttpClient; 11 | 12 | setUp(() { 13 | mockHttpClient = MockHttpClient(); 14 | logoutService = AortemMagicLogoutByIssuer( 15 | apiKey: "test_api_key", 16 | client: mockHttpClient, 17 | ); 18 | 19 | registerFallbackValue(Uri.parse("https://api.magic.com/v1/user/logout")); 20 | }); 21 | 22 | test("Returns success when logout is successful", () async { 23 | const String testIssuer = "did:magic:12345"; 24 | final expectedResponse = { 25 | "success": true, 26 | "message": "Logged out successfully" 27 | }; 28 | 29 | when(() => mockHttpClient.post( 30 | any(), 31 | headers: any(named: "headers"), 32 | body: any(named: "body"), 33 | )) 34 | .thenAnswer( 35 | (_) async => http.Response(jsonEncode(expectedResponse), 200)); 36 | 37 | final result = await logoutService.logoutByIssuer(testIssuer); 38 | 39 | expect(result, expectedResponse); 40 | }); 41 | 42 | test("Throws an error when issuer is empty", () async { 43 | expect( 44 | () => logoutService.logoutByIssuer(""), 45 | throwsA(isA()), 46 | ); 47 | }); 48 | 49 | test("Throws an error when API response is not 200", () async { 50 | const String testIssuer = "did:magic:invalid"; 51 | 52 | when(() => mockHttpClient.post( 53 | any(), 54 | headers: any(named: "headers"), 55 | body: any(named: "body"), 56 | )).thenAnswer((_) async => http.Response("Unauthorized", 401)); 57 | 58 | expect( 59 | () => logoutService.logoutByIssuer(testIssuer), 60 | throwsA(isA()), 61 | ); 62 | }); 63 | 64 | test("Returns mock response when useStub is true", () async { 65 | final stubLogoutService = 66 | AortemMagicLogoutByIssuer(apiKey: "test_api_key", useStub: true); 67 | 68 | final response = await stubLogoutService.logoutByIssuer("did:magic:12345"); 69 | 70 | expect(response["success"], true); 71 | expect(response["message"], contains("logged out successfully")); 72 | }); 73 | } 74 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/test/unit/logout/aortem_magic_logout_token_test.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:ds_tools_testing/ds_tools_testing.dart'; 4 | import 'package:ds_standard_features/ds_standard_features.dart' as http; 5 | import 'package:magic_dart_auth_sdk/src/logout/aortem_magic_logout_token.dart'; 6 | 7 | 8 | class MockHttpClient extends Mock implements http.Client {} 9 | 10 | void main() { 11 | late AortemMagicLogoutByToken logoutService; 12 | late MockHttpClient mockHttpClient; 13 | 14 | setUp(() { 15 | mockHttpClient = MockHttpClient(); 16 | logoutService = AortemMagicLogoutByToken( 17 | apiKey: "test_api_key", 18 | client: mockHttpClient, 19 | ); 20 | 21 | registerFallbackValue(Uri.parse("https://api.magic.com/v1/user/logout")); 22 | }); 23 | 24 | test("Returns success when logout by token is successful", () async { 25 | const String testToken = "valid_token_123"; 26 | final expectedResponse = {"success": true, "message": "Logged out successfully"}; 27 | 28 | when(() => mockHttpClient.post( 29 | any(), 30 | headers: any(named: "headers"), 31 | body: any(named: "body"), 32 | )).thenAnswer((_) async => http.Response(jsonEncode(expectedResponse), 200)); 33 | 34 | final result = await logoutService.logoutByToken(testToken); 35 | 36 | expect(result, expectedResponse); 37 | }); 38 | 39 | test("Throws an error when token is empty or invalid", () async { 40 | expect( 41 | () => logoutService.logoutByToken(""), 42 | throwsA(isA()), 43 | ); 44 | }); 45 | 46 | test("Throws an error when API response is not 200", () async { 47 | const String testToken = "valid_token_123"; 48 | 49 | when(() => mockHttpClient.post( 50 | any(), 51 | headers: any(named: "headers"), 52 | body: any(named: "body"), 53 | )).thenAnswer((_) async => http.Response("Unauthorized", 401)); 54 | 55 | expect( 56 | () => logoutService.logoutByToken(testToken), 57 | throwsA(isA()), 58 | ); 59 | }); 60 | 61 | test("Returns mock response when useStub is true", () async { 62 | final stubLogoutService = AortemMagicLogoutByToken(apiKey: "test_api_key", useStub: true); 63 | 64 | final response = await stubLogoutService.logoutByToken("valid_token_123"); 65 | 66 | expect(response["success"], true); 67 | expect(response["message"], contains("logged out successfully")); 68 | }); 69 | } 70 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/test/unit/metadata/aortem_magic_address_metadata_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:ds_tools_testing/ds_tools_testing.dart'; 2 | import 'package:magic_dart_auth_sdk/src/metadata/aortem_magic_address_metadata.dart'; 3 | 4 | import 'dart:convert'; 5 | import 'package:ds_standard_features/ds_standard_features.dart' as http; 6 | 7 | // Mock HTTP Client 8 | class MockHttpClient extends Mock implements http.Client {} 9 | 10 | void main() { 11 | late AortemMagicUserMetadataByPublicAddress userMetadata; 12 | late MockHttpClient mockHttpClient; 13 | 14 | const String apiKey = "test_api_key"; 15 | const String apiBaseUrl = "https://api.magic.com"; 16 | const String validPublicAddress = "0x123456789abcdef"; 17 | 18 | setUpAll(() { 19 | registerFallbackValue(Uri()); 20 | }); 21 | 22 | setUp(() { 23 | mockHttpClient = MockHttpClient(); 24 | userMetadata = AortemMagicUserMetadataByPublicAddress( 25 | apiKey: apiKey, apiBaseUrl: apiBaseUrl, client: mockHttpClient); 26 | }); 27 | 28 | test("✅ Successfully retrieves metadata when given a valid public address", 29 | () async { 30 | final mockResponse = { 31 | "issuer": "did:magic:$validPublicAddress", 32 | "email": "user@example.com", 33 | "publicAddress": validPublicAddress, 34 | "createdAt": 1700000000 35 | }; 36 | 37 | when(() => mockHttpClient.get(any(), headers: any(named: "headers"))) 38 | .thenAnswer( 39 | (_) async => http.Response(jsonEncode(mockResponse), 200), 40 | ); 41 | 42 | final metadata = 43 | await userMetadata.getMetadataByPublicAddress(validPublicAddress); 44 | expect(metadata, isA>()); 45 | expect(metadata["publicAddress"], equals(validPublicAddress)); 46 | }); 47 | 48 | test("❌ Throws ArgumentError when public address is empty", () async { 49 | expect( 50 | () => userMetadata.getMetadataByPublicAddress(""), throwsArgumentError); 51 | }); 52 | 53 | test("⚠️ Handles network failure properly", () async { 54 | when(() => mockHttpClient.get(any(), headers: any(named: "headers"))) 55 | .thenThrow(Exception("Network error")); 56 | 57 | expect(() => userMetadata.getMetadataByPublicAddress(validPublicAddress), 58 | throwsException); 59 | }); 60 | 61 | test("🛠️ Returns stub data when useStub=true", () async { 62 | final metadata = await userMetadata 63 | .getMetadataByPublicAddress(validPublicAddress, useStub: true); 64 | expect(metadata["publicAddress"], equals(validPublicAddress)); 65 | expect(metadata.containsKey("issuer"), isTrue); 66 | }); 67 | } 68 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/test/unit/metadata/aortem_magic_issuer_metadata_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:ds_tools_testing/ds_tools_testing.dart'; 2 | import 'package:magic_dart_auth_sdk/src/metadata/aortem_magic_issuer_metadata.dart'; 3 | 4 | import 'dart:convert'; 5 | import 'package:ds_standard_features/ds_standard_features.dart' as http; 6 | 7 | // Mock HTTP Client 8 | class MockHttpClient extends Mock implements http.Client {} 9 | 10 | void main() { 11 | late AortemMagicUserMetaDataByIssuer userMetadata; 12 | late MockHttpClient mockHttpClient; 13 | 14 | const String apiKey = "test_api_key"; 15 | const String apiBaseUrl = "https://api.magic.com"; 16 | const String validIssuer = "did:magic:12345"; 17 | 18 | setUpAll(() { 19 | registerFallbackValue(Uri()); // FIX: Register Uri fallback 20 | }); 21 | 22 | setUp(() { 23 | mockHttpClient = MockHttpClient(); 24 | userMetadata = AortemMagicUserMetaDataByIssuer( 25 | apiKey: apiKey, apiBaseUrl: apiBaseUrl, client: mockHttpClient); 26 | }); 27 | 28 | test("✅ Successfully retrieves metadata when given a valid issuer", () async { 29 | final mockResponse = { 30 | "issuer": validIssuer, 31 | "email": "user@example.com", 32 | "publicAddress": "0x123456789abcdef", 33 | "createdAt": 1700000000 34 | }; 35 | 36 | when(() => mockHttpClient.get(any(), headers: any(named: "headers"))) 37 | .thenAnswer( 38 | (_) async => http.Response(jsonEncode(mockResponse), 200), 39 | ); 40 | 41 | final metadata = await userMetadata.getMetadataByIssuer(validIssuer); 42 | expect(metadata, isA>()); 43 | expect(metadata["issuer"], equals(validIssuer)); 44 | }); 45 | 46 | test("❌ Throws ArgumentError when issuer is empty", () async { 47 | expect(() => userMetadata.getMetadataByIssuer(""), throwsArgumentError); 48 | }); 49 | 50 | test("⚠️ Handles network failure properly", () async { 51 | when(() => mockHttpClient.get(any(), headers: any(named: "headers"))) 52 | .thenThrow(Exception("Network error")); 53 | 54 | expect( 55 | () => userMetadata.getMetadataByIssuer(validIssuer), throwsException); 56 | }); 57 | } 58 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/test/unit/metadata/aortem_magic_token_metadata_test.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'package:ds_standard_features/ds_standard_features.dart' as http; 3 | import 'package:ds_tools_testing/ds_tools_testing.dart'; 4 | import 'package:magic_dart_auth_sdk/src/metadata/aortem_magic_token_metadata.dart'; 5 | 6 | class MockHttpClient extends Mock implements http.Client {} 7 | 8 | void main() { 9 | late AortemMagicUserMetadataByToken userMetadataByToken; 10 | late MockHttpClient mockHttpClient; 11 | 12 | setUp(() { 13 | mockHttpClient = MockHttpClient(); 14 | userMetadataByToken = AortemMagicUserMetadataByToken( 15 | apiKey: "test_api_key", 16 | client: mockHttpClient, 17 | ); 18 | 19 | // Register fallback value for Uri 20 | registerFallbackValue(Uri.parse("https://api.magic.com/v1/user/metadata")); 21 | }); 22 | 23 | test("Returns metadata successfully when token is valid", () async { 24 | const String testToken = "valid_token"; 25 | final expectedResponse = { 26 | "issuer": "did:magic:12345", 27 | "email": "user@example.com", 28 | "public_address": "0x123456789abcdef", 29 | "created_at": "2024-01-01T12:00:00Z" 30 | }; 31 | 32 | when(() => mockHttpClient.get( 33 | any(), 34 | headers: any(named: "headers"), 35 | )) 36 | .thenAnswer( 37 | (_) async => http.Response(jsonEncode(expectedResponse), 200)); 38 | 39 | final result = await userMetadataByToken.getMetadataByToken(testToken); 40 | 41 | expect(result, expectedResponse); 42 | }); 43 | 44 | test("Throws an error when token is empty", () async { 45 | expect( 46 | () => userMetadataByToken.getMetadataByToken(""), 47 | throwsA(isA()), 48 | ); 49 | }); 50 | 51 | test("Throws an error when API response is not 200", () async { 52 | const String testToken = "invalid_token"; 53 | 54 | when(() => mockHttpClient.get( 55 | any(), 56 | headers: any(named: "headers"), 57 | )).thenAnswer((_) async => http.Response("Unauthorized", 401)); 58 | 59 | expect( 60 | () => userMetadataByToken.getMetadataByToken(testToken), 61 | throwsA(isA()), 62 | ); 63 | }); 64 | } 65 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/test/unit/multichain/aortem_magic_multichain_metadata_test.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:ds_tools_testing/ds_tools_testing.dart'; 4 | 5 | import 'package:ds_standard_features/ds_standard_features.dart' as http; 6 | import 'package:magic_dart_auth_sdk/src/multichain/aortem_magic_multichain_metadata.dart'; 7 | 8 | class MockHttpClient extends Mock implements http.Client {} 9 | 10 | void main() { 11 | late AortemMagicMultichainMetadataService metadataService; 12 | late MockHttpClient mockHttpClient; 13 | 14 | setUp(() { 15 | mockHttpClient = MockHttpClient(); 16 | metadataService = AortemMagicMultichainMetadataService( 17 | apiKey: "test_api_key", 18 | client: mockHttpClient, 19 | ); 20 | 21 | registerFallbackValue(Uri.parse( 22 | "https://api.magic.com/v1/user/metadata/issuer/issuer_123?wallet=wallet_abc")); 23 | }); 24 | 25 | test("Returns metadata when retrieval is successful", () async { 26 | final expectedResponse = { 27 | "success": true, 28 | "data": { 29 | "issuer": "issuer_123", 30 | "wallet": "wallet_abc", 31 | "email": "test@example.com", 32 | "createdAt": "2025-02-21T12:00:00Z" 33 | } 34 | }; 35 | 36 | when(() => mockHttpClient.get( 37 | any(), 38 | headers: any(named: "headers"), 39 | )) 40 | .thenAnswer( 41 | (_) async => http.Response(jsonEncode(expectedResponse), 200)); 42 | 43 | final result = await metadataService.getMetadataByIssuerAndWallet( 44 | "issuer_123", "wallet_abc"); 45 | 46 | expect(result, expectedResponse); 47 | }); 48 | 49 | test("Throws an error when identifier or wallet is empty", () async { 50 | expect( 51 | () => metadataService.getMetadataByIssuerAndWallet("", "wallet_abc"), 52 | throwsA(isA()), 53 | ); 54 | 55 | expect( 56 | () => metadataService.getMetadataByIssuerAndWallet("issuer_123", ""), 57 | throwsA(isA()), 58 | ); 59 | }); 60 | 61 | test("Throws an error when API response is not 200", () async { 62 | when(() => mockHttpClient.get( 63 | any(), 64 | headers: any(named: "headers"), 65 | )).thenAnswer((_) async => http.Response("Unauthorized", 401)); 66 | 67 | expect( 68 | () => metadataService.getMetadataByIssuerAndWallet( 69 | "issuer_123", "wallet_abc"), 70 | throwsA(isA()), 71 | ); 72 | }); 73 | 74 | test("Returns mock response when useStub is true", () async { 75 | final stubMetadataService = AortemMagicMultichainMetadataService( 76 | apiKey: "test_api_key", useStub: true); 77 | 78 | final response = await stubMetadataService.getMetadataByIssuerAndWallet( 79 | "issuer_123", "wallet_abc"); 80 | 81 | expect(response["success"], true); 82 | expect(response["data"]["wallet"], "wallet_abc"); 83 | }); 84 | } 85 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/test/unit/utils/aortem_magic_parse_auth_header_test.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:ds_tools_testing/ds_tools_testing.dart'; 3 | import 'package:magic_dart_auth_sdk/src/utils/aortem_magic_parse_auth_header.dart'; 4 | 5 | void main() { 6 | group('MagicUtils.parseAuthorizationHeader', () { 7 | test('Extracts token from a valid Authorization header', () { 8 | const header = 'Bearer abc123tokenXYZ'; 9 | expect(AortemMagicAuthHeaderParse.parseAuthorizationHeader(header), equals('abc123tokenXYZ')); 10 | }); 11 | 12 | test('Handles extra spaces in Authorization header', () { 13 | const header = ' Bearer abc123tokenXYZ '; 14 | expect(AortemMagicAuthHeaderParse.parseAuthorizationHeader(header), equals('abc123tokenXYZ')); 15 | }); 16 | 17 | test('Throws ArgumentError for empty header', () { 18 | expect(() => AortemMagicAuthHeaderParse.parseAuthorizationHeader(''), throwsArgumentError); 19 | }); 20 | 21 | test('Throws ArgumentError for missing Bearer prefix', () { 22 | const header = 'Token abc123tokenXYZ'; 23 | expect(() => AortemMagicAuthHeaderParse.parseAuthorizationHeader(header), throwsArgumentError); 24 | }); 25 | 26 | test('Throws ArgumentError for malformed header', () { 27 | const header = 'Bearer123tokenXYZ'; 28 | expect(() => AortemMagicAuthHeaderParse.parseAuthorizationHeader(header), throwsArgumentError); 29 | }); 30 | 31 | test('Throws ArgumentError for multiple spaces but no valid token', () { 32 | const header = 'Bearer '; 33 | expect(() => AortemMagicAuthHeaderParse.parseAuthorizationHeader(header), throwsArgumentError); 34 | }); 35 | }); 36 | } 37 | -------------------------------------------------------------------------------- /magic-dart-auth-sdk/ui-debug.log: -------------------------------------------------------------------------------- 1 | Web / API server started at 127.0.0.1:5003 2 | Web / API server started at ::1:5003 3 | -------------------------------------------------------------------------------- /tools/README.md: -------------------------------------------------------------------------------- 1 | ## Overview 2 | 3 | The pipelines are organized by stage: 4 | - setup 5 | - unit_tests 6 | - integration_tests 7 | - e2e_tests 8 | 9 | ## Setup: 10 | - Setup pulls in all of the dependencies for dart to properly perform unit, integration, and e2e testing 11 | - Before making changes to any of the other pipelines, this file should be tested and checked. 12 | 13 | ## Unit Test: 14 | - Covers the unit testing for each feature and function in the SDK. 15 | 16 | ## Integration: 17 | - Covers group features and functions that work together to ensure seamless unit interoperatbility. 18 | 19 | ## E2E: 20 | - Covers each component above, both unit testing and integration testing and runs through the entire lifecycle of an application as a real end user might utilize the app. -------------------------------------------------------------------------------- /tools/pipelines/backend/child-ci-full-lifecycle.yml: -------------------------------------------------------------------------------- 1 | stages: 2 | - setup 3 | - unit_tests 4 | - integration_tests 5 | - e2e_tests 6 | 7 | # Setup Stage 8 | setup: 9 | stage: setup 10 | image: dart:stable 11 | # tags: 12 | # - dart 13 | rules: 14 | - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "development" && $GITLAB_USER_LOGIN == "alphabetacreatives" 15 | - if: $CI_COMMIT_REF_NAME == "development" && $GITLAB_USER_LOGIN == "alphabetacreatives" 16 | script: 17 | - echo "Setting up environment..." 18 | - cd magic_dart_auth_sdk 19 | - dart pub get 20 | artifacts: 21 | paths: 22 | - .dart_tool/ 23 | expire_in: 1h 24 | retry: 2 25 | 26 | # Unit Tests 27 | unit_tests: 28 | stage: unit_tests 29 | image: dart:stable 30 | # tags: 31 | # - dart 32 | rules: 33 | - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "development" && $GITLAB_USER_LOGIN == "alphabetacreatives" 34 | - if: $CI_COMMIT_REF_NAME == "development" && $GITLAB_USER_LOGIN == "alphabetacreatives" 35 | script: 36 | - echo "Running Unit Tests..." 37 | - cd magic_dart_auth_sdk/magic-dart-auth-sdk/test/test/unit # Navigate to the directory with pubspec.yaml 38 | - dart pub get 39 | - dart test test/unit/ --reporter expanded 40 | artifacts: 41 | paths: 42 | - test-reports/unit/ 43 | expire_in: 1d 44 | retry: 2 45 | 46 | # Integration Tests 47 | integration_tests: 48 | stage: integration_tests 49 | image: dart:stable 50 | # tags: 51 | # - dart 52 | rules: 53 | - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "development" && $GITLAB_USER_LOGIN == "alphabetacreatives" 54 | - if: $CI_COMMIT_REF_NAME == "development" && $GITLAB_USER_LOGIN == "alphabetacreatives" 55 | script: 56 | - echo "Running Integration Tests..." 57 | - dart test test/integration/ --reporter expanded 58 | artifacts: 59 | paths: 60 | - test-reports/integration/ 61 | expire_in: 1d 62 | retry: 2 63 | 64 | # End-to-End Tests 65 | e2e_tests: 66 | stage: e2e_tests 67 | image: dart:stable 68 | # tags: 69 | # - dart 70 | rules: 71 | - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "development" && $GITLAB_USER_LOGIN == "alphabetacreatives" 72 | - if: $CI_COMMIT_REF_NAME == "development" && $GITLAB_USER_LOGIN == "alphabetacreatives" 73 | script: 74 | - echo "Running E2E Tests..." 75 | - dart test test/e2e/ --reporter expanded 76 | artifacts: 77 | paths: 78 | - test-reports/e2e/ 79 | expire_in: 1d 80 | retry: 2 81 | -------------------------------------------------------------------------------- /tools/pipelines/backend/child-ci-integration-tests.yml: -------------------------------------------------------------------------------- 1 | stages: 2 | - setup 3 | - unit_tests 4 | - integration_tests 5 | - e2e_tests 6 | 7 | # Setup Stage 8 | setup: 9 | stage: setup 10 | image: dart:stable 11 | # tags: 12 | # - dart 13 | rules: 14 | - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "development" && $GITLAB_USER_LOGIN == "alphabetacreatives" 15 | - if: $CI_COMMIT_REF_NAME == "development" && $GITLAB_USER_LOGIN == "alphabetacreatives" 16 | script: 17 | - echo "Setting up environment..." 18 | - cd magic_dart_auth_sdk 19 | - dart pub get 20 | artifacts: 21 | paths: 22 | - .dart_tool/ 23 | expire_in: 1h 24 | retry: 2 25 | 26 | # Unit Tests 27 | unit_tests: 28 | stage: unit_tests 29 | image: dart:stable 30 | # tags: 31 | # - dart 32 | rules: 33 | - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "development" && $GITLAB_USER_LOGIN == "alphabetacreatives" 34 | - if: $CI_COMMIT_REF_NAME == "development" && $GITLAB_USER_LOGIN == "alphabetacreatives" 35 | script: 36 | - echo "Running Unit Tests..." 37 | - cd magic_dart_auth_sdk/magic-dart-auth-sdk/test/test/unit # Navigate to the directory with pubspec.yaml 38 | - dart pub get 39 | - dart test test/unit/ --reporter expanded 40 | artifacts: 41 | paths: 42 | - test-reports/unit/ 43 | expire_in: 1d 44 | retry: 2 45 | 46 | # Integration Tests 47 | integration_tests: 48 | stage: integration_tests 49 | image: dart:stable 50 | # tags: 51 | # - dart 52 | rules: 53 | - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "development" && $GITLAB_USER_LOGIN == "alphabetacreatives" 54 | - if: $CI_COMMIT_REF_NAME == "development" && $GITLAB_USER_LOGIN == "alphabetacreatives" 55 | script: 56 | - echo "Running Integration Tests..." 57 | - dart test test/integration/ --reporter expanded 58 | artifacts: 59 | paths: 60 | - test-reports/integration/ 61 | expire_in: 1d 62 | retry: 2 63 | -------------------------------------------------------------------------------- /tools/pipelines/backend/child-ci-production.yml: -------------------------------------------------------------------------------- 1 | TBD -------------------------------------------------------------------------------- /tools/pipelines/backend/child-ci-unit-tests.yml: -------------------------------------------------------------------------------- 1 | stages: 2 | - unit_tests 3 | 4 | # Transmit SDK Unit Tests 5 | unit_tests: 6 | stage: unit_tests 7 | image: dart:stable 8 | script: 9 | - echo "Running Unit Tests..." 10 | - cd magic-dart-auth-sdk/test/unit/ 11 | - dart pub get 12 | - dart test . --coverage=coverage --reporter expanded || echo "Some tests failed, proceeding with coverage upload..." 13 | - echo "Uploading coverage report to Codecov..." 14 | - curl -s https://codecov.io/bash | bash -s -- -t $CODECOV_TOKEN -R github.com/aortem/transmit-dart-admin-auth-sdk -f coverage/lcov.info || echo "Coverage upload failed." 15 | artifacts: 16 | paths: 17 | - coverage/ 18 | expire_in: 1d 19 | rules: 20 | - when: always 21 | retry: 2 22 | -------------------------------------------------------------------------------- /tools/pipelines/frontend/child-ci-analyze-flutter-mobile.yml: -------------------------------------------------------------------------------- 1 | stages: 2 | - analyze 3 | 4 | analyze_flutter_mobile: 5 | stage: analyze 6 | image: ghcr.io/cirruslabs/flutter:stable 7 | script: 8 | - echo "Analyzing example project..." 9 | - cd magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app 10 | - flutter pub get || { echo "Failed to install dependencies. Exiting..."; exit 1; } 11 | - dart analyze > analysis_report.txt 2> error_log.txt || true 12 | 13 | # Filter and summarize analysis results 14 | - echo "Separating issues into categories..." 15 | - grep -i "info" analysis_report.txt > info_issues.txt || true 16 | - grep -i "warning" analysis_report.txt > warning_issues.txt || true 17 | - grep -i "error" analysis_report.txt > error_issues.txt || true 18 | - echo "Summary of analysis issues:" 19 | - | 20 | info_count=$(wc -l < info_issues.txt || echo 0) 21 | warning_count=$(wc -l < warning_issues.txt || echo 0) 22 | error_count=$(wc -l < error_issues.txt || echo 0) 23 | echo "Info Issues: $info_count" 24 | echo "Warning Issues: $warning_count" 25 | echo "Error Issues: $error_count" 26 | 27 | # Check for outdated dependencies 28 | - echo "Checking for outdated dependencies..." 29 | - dart pub outdated || true 30 | 31 | # Encourage collaboration by highlighting contributors who worked on relevant areas. 32 | - echo "Collaboratively resolving identified issues..." 33 | - | 34 | while IFS= read -r line; do 35 | file=$(echo $line | awk -F ':' '{print $1}') 36 | if [[ -n "$file" ]]; then 37 | git_log=$(git log -n 1 --pretty=format:"%h by %an <%ae>" -- "$file") 38 | echo "File: $file - Last modified by: $git_log" 39 | echo "Suggested collaboration: Work with the contributor to address the issue." 40 | fi 41 | done < error_issues.txt 42 | - echo "Example project analysis complete. Check categorized issue files for details." 43 | 44 | rules: 45 | - when: always 46 | 47 | artifacts: 48 | paths: 49 | - magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/info_issues.txt 50 | - magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/warning_issues.txt 51 | - magic-dart-auth-sdk/example/magic-dart-auth-sdk-flutter-mobile-app/error_issues.txt 52 | expire_in: 1h 53 | --------------------------------------------------------------------------------