Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions strivacity_flutter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ import 'widgets/phone_widget.dart';
import 'widgets/select_widget.dart';
import 'widgets/static_widget.dart';
import 'widgets/submit_widget.dart';
import 'widgets/close_widget.dart';
import 'widgets/passkey_login_widget.dart';
import 'widgets/passkey_enroll_widget.dart';
import 'widgets/webauthn_login_widget.dart';
import 'widgets/webauthn_enroll_widget.dart';
import 'widgets/container_widget.dart';
import 'widgets/loading_widget.dart';

Expand Down Expand Up @@ -138,6 +143,31 @@ class CustomViewFactory implements ViewFactory {
return SubmitWidget(key: key, formId: formId, config: config, loginContext: loginContext);
}

@override
Widget getCloseWidget({required Key key, required String formId, required CloseWidgetModel config, required LoginContext loginContext}) {
return CloseWidget(key: key, formId: formId, config: config, loginContext: loginContext);
}

@override
Widget getPasskeyLoginWidget({required Key key, required String formId, required PasskeyLoginWidgetModel config, required LoginContext loginContext}) {
return PasskeyLoginWidget(key: key, formId: formId, config: config, loginContext: loginContext);
}

@override
Widget getPasskeyEnrollWidget({required Key key, required String formId, required PasskeyEnrollWidgetModel config, required LoginContext loginContext}) {
return PasskeyEnrollWidget(key: key, formId: formId, config: config, loginContext: loginContext);
}

@override
Widget getWebauthnLoginWidget({required Key key, required String formId, required WebauthnLoginWidgetModel config, required LoginContext loginContext}) {
return WebauthnLoginWidget(key: key, formId: formId, config: config, loginContext: loginContext);
}

@override
Widget getWebauthnEnrollWidget({required Key key, required String formId, required WebauthnEnrollWidgetModel config, required LoginContext loginContext}) {
return WebauthnEnrollWidget(key: key, formId: formId, config: config, loginContext: loginContext);
}

@override
Widget getStaticWidget({required Key key, required StaticWidgetModel config}) {
return StaticWidget(key: key, config: config);
Expand Down Expand Up @@ -233,6 +263,48 @@ class _LoginPageState extends State<LoginPage> {

The `LoginRenderer` widget is responsible for rendering the login UI using the provided `StrivacitySDK` and `CustomViewFactory`. It also handles various events such as login success, errors, fallback URLs, and global messages.

## Passkey Configuration

To enable passkey support in your Flutter application, you need to configure platform-specific settings for both iOS and Android.

### iOS Configuration

Add the associated domain to your `ios/Runner/Runner.entitlements` file:

```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.associated-domains</key>
<array>
<string>webcredentials:your-cluster-domain?mode=developer</string>
</array>
</dict>
</plist>
```

Replace `your-cluster-domain` with your Strivacity cluster domain (e.g., `example.strivacity.com`).

**Note:** Remove the `?mode=developer` parameter when deploying to production.

### Android Configuration

Add the Digital Asset Links intent filter to your `android/app/src/main/AndroidManifest.xml` file inside the `<activity>` tag:

```xml
<!-- Digital Asset Links for Passkey support -->
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
<data android:host="your-cluster-domain" />
</intent-filter>
```

Replace `your-cluster-domain` with your Strivacity cluster domain (e.g., `example.strivacity.com`).

## Contributing

Please see our [contributing guide](https://github.com/Strivacity/sdk-flutter/blob/main/strivacity_flutter/CONTRIBUTING.md).
2 changes: 1 addition & 1 deletion strivacity_flutter/example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ android {
applicationId = "com.example.example"
// You can update the following values to match your application needs.
// For more information, see: https://flutter.dev/to/review-gradle-config.
minSdk = flutter.minSdkVersion
minSdk = 28
targetSdk = flutter.targetSdkVersion
versionCode = flutter.versionCode
versionName = flutter.versionName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="sty" /> <!-- Replace 'sty' with your redirect uri scheme -->
</intent-filter>
<!-- Digital Asset Links for Passkey support -->
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
<data android:host="your-cluster-domain" />
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>12.0</string>
<string>13.0</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion strivacity_flutter/example/ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '12.0'
# platform :ios, '13.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down
21 changes: 10 additions & 11 deletions strivacity_flutter/example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ PODS:
- Flutter
- fluttertoast (0.0.2):
- Flutter
- Toast
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- Toast (4.1.1)
- strivacity_flutter_ios (1.0.0):
- Flutter
- url_launcher_ios (0.0.1):
- Flutter
- webview_flutter_wkwebview (0.0.1):
Expand All @@ -26,13 +26,10 @@ DEPENDENCIES:
- flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`)
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
- strivacity_flutter_ios (from `.symlinks/plugins/strivacity_flutter_ios/ios`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
- webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/darwin`)

SPEC REPOS:
trunk:
- Toast

EXTERNAL SOURCES:
app_links:
:path: ".symlinks/plugins/app_links/ios"
Expand All @@ -46,22 +43,24 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/fluttertoast/ios"
path_provider_foundation:
:path: ".symlinks/plugins/path_provider_foundation/darwin"
strivacity_flutter_ios:
:path: ".symlinks/plugins/strivacity_flutter_ios/ios"
url_launcher_ios:
:path: ".symlinks/plugins/url_launcher_ios/ios"
webview_flutter_wkwebview:
:path: ".symlinks/plugins/webview_flutter_wkwebview/darwin"

SPEC CHECKSUMS:
app_links: 3da4c36b46cac3bf24eb897f1a6ce80bda109874
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
app_links: 76b66b60cc809390ca1ad69bfd66b998d2387ac7
Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467
flutter_custom_tabs_ios: dd647919edd75e82ba6b00009eb3460a28c011b8
flutter_secure_storage: 1ed9476fba7e7a782b22888f956cce43e2c62f13
fluttertoast: 76fea30fcf04176325f6864c87306927bd7d2038
fluttertoast: 2c67e14dce98bbdb200df9e1acf610d7a6264ea1
path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564
Toast: 1f5ea13423a1e6674c4abdac5be53587ae481c4e
strivacity_flutter_ios: 4750b2a8b6932016928fb4b8ca611433bc9e4cdc
url_launcher_ios: 694010445543906933d732453a59da0a173ae33d
webview_flutter_wkwebview: 44d4dee7d7056d5ad185d25b38404436d56c547c

PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796
PODFILE CHECKSUM: 4f1c12611da7338d21589c0b2ecd6bd20b109694

COCOAPODS: 1.16.2
16 changes: 12 additions & 4 deletions strivacity_flutter/example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
B2D7677B52FFE4229FEFB2E6 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
B47D6C20D0B7BB700B9DCFE8 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = "<group>"; };
CF7CDE7AC9AD47A8926D13DC /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
D00740C22EC74265002E13AE /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
E802DDAF2E1F01DEA1DC7093 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -130,6 +131,7 @@
97C146F01CF9000F007C117D /* Runner */ = {
isa = PBXGroup;
children = (
D00740C22EC74265002E13AE /* Runner.entitlements */,
97C146FA1CF9000F007C117D /* Main.storyboard */,
97C146FD1CF9000F007C117D /* Assets.xcassets */,
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
Expand Down Expand Up @@ -161,7 +163,6 @@
505B5842CC5B1004AA6039BD /* Pods-RunnerTests.release.xcconfig */,
B47D6C20D0B7BB700B9DCFE8 /* Pods-RunnerTests.profile.xcconfig */,
);
name = Pods;
path = Pods;
sourceTree = "<group>";
};
Expand Down Expand Up @@ -316,10 +317,14 @@
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
Expand Down Expand Up @@ -455,7 +460,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand All @@ -470,6 +475,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
Expand Down Expand Up @@ -584,7 +590,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -635,7 +641,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand All @@ -652,6 +658,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
Expand All @@ -674,6 +681,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
Expand Down Expand Up @@ -54,6 +55,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
10 changes: 10 additions & 0 deletions strivacity_flutter/example/ios/Runner/Runner.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.associated-domains</key>
<array>
<string>webcredentials:your-cluster-domain?mode=developer</string>
</array>
</dict>
</plist>
6 changes: 5 additions & 1 deletion strivacity_flutter/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:strivacity_flutter/strivacity_flutter.dart';
import 'styles.dart';
import 'storage.dart';
import 'pages/init.dart';
import 'pages/entry.dart';
import 'pages/home.dart';
import 'pages/profile.dart';
import 'pages/login.dart';
Expand Down Expand Up @@ -66,7 +67,9 @@ class _MyAppState extends State<MyApp> {
_nav.currentState!.popUntil((r) => r.isFirst);

if (uri.queryParameters['session_id'] != null) {
_nav.currentState!.pushReplacementNamed('/login', arguments: {'session_id': uri.queryParameters['session_id']});
_nav.currentState!.pushReplacementNamed('/login', arguments: uri.queryParameters);
} else if (uri.queryParameters['challenge'] != null) {
_nav.currentState!.pushReplacementNamed('/entry', arguments: uri.queryParameters);
} else {
try {
await sdk.tokenExchange(uri.queryParameters);
Expand Down Expand Up @@ -114,6 +117,7 @@ class _MyAppState extends State<MyApp> {
routes: {
'/init': (context) => InitPage(sdk: sdk),
'/home': (context) => HomePage(),
'/entry': (context) => EntryPage(sdk: sdk),
'/profile': (context) => ProfilePage(sdk: sdk),
'/login': (context) => LoginPage(sdk: sdk),
'/login-fallback': (context) => LoginFallbackPage(sdk: sdk),
Expand Down
Loading
Loading