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
3 changes: 0 additions & 3 deletions melos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ repository: https://github.com/corbado/flutter-passkeys
packages:
- packages/**

command:
bootstrap:
usePubspecOverrides: true

scripts:
format:
Expand Down
4 changes: 2 additions & 2 deletions packages/corbado_auth/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ repository: https://github.com/corbado/flutter-passkeys/tree/main/packages/corba
version: 3.7.1

environment:
sdk: ">=3.0.0 <4.0.0"
sdk: '>=3.8.0 <4.0.0'
flutter: ">=3.0.0"

dependencies:
Expand All @@ -18,7 +18,7 @@ dependencies:
sdk: flutter
flutter_secure_storage: "<=9.0.0 >8.0.0"
http: ^1.1.2
json_annotation: ^4.8.1
json_annotation: ^4.10.0
jwt_decoder: ^2.0.1
meta: ^1.15.0
passkeys: ^2.13.0
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 packages/passkeys/passkeys/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
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
1F5231B1C0B4B24BD6457DFB /* [CP] Embed Pods Frameworks */,
635C969084CC2623F9C369FA /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand Down Expand Up @@ -235,6 +236,23 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
};
635C969084CC2623F9C369FA /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
showEnvVarsInLog = 0;
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
Expand Down Expand Up @@ -347,7 +365,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 Down Expand Up @@ -430,7 +448,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 @@ -479,7 +497,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 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 All @@ -43,6 +44,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
35 changes: 13 additions & 22 deletions packages/passkeys/passkeys/lib/authenticator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ import 'package:passkeys_platform_interface/passkeys_platform_interface.dart';
/// flow.
class PasskeyAuthenticator {
/// Constructor
PasskeyAuthenticator({bool? debugMode})
: _platform = PasskeysPlatform.instance,
debugMode = debugMode ?? false;
PasskeyAuthenticator({bool? debugMode}) : _platform = PasskeysPlatform.instance, debugMode = debugMode ?? false;

/// The [PasskeysDoctor] instance for debugging and checking passkeys
final _doctor = PasskeysDoctor();
Expand All @@ -23,8 +21,10 @@ class PasskeyAuthenticator {
final bool debugMode;

/// Returns true only if passkeys are supported by the platform.
@Deprecated('Use PasskeyAvailability.isAvailable instead. '
'This method will be removed in a future release.')
@Deprecated(
'Use PasskeyAvailability.isAvailable instead. '
'This method will be removed in a future release.',
)
Future<bool> canAuthenticate() {
return _platform.canAuthenticate();
}
Expand All @@ -40,7 +40,7 @@ class PasskeyAuthenticator {
/// Creates a new passkey and stores it on the device.
/// Returns [RegisterResponseType] which must be sent to the relying party
/// server.
Future<RegisterResponseType> register(RegisterRequestType request) async {
Future<RegisterResponseType> register(RegisterRequestType request, {String? salt}) async {
if (debugMode) {
await _doctor.check(request.relyingParty.id);
}
Expand All @@ -56,7 +56,7 @@ class PasskeyAuthenticator {
_isValidCredentialID(credential.id);
}

final r = await _platform.register(request);
final r = await _platform.register(request, salt);

return r;
} on PlatformException catch (e) {
Expand Down Expand Up @@ -92,9 +92,7 @@ class PasskeyAuthenticator {
/// Authenticates a user with a passkey.
/// Returns [AuthenticateResponseType] which must be sent to the relying party
/// server.
Future<AuthenticateResponseType> authenticate(
AuthenticateRequestType request,
) async {
Future<AuthenticateResponseType> authenticate(AuthenticateRequestType request, {String? salt}) async {
if (debugMode) {
await _doctor.check(request.relyingPartyId);
}
Expand All @@ -110,7 +108,7 @@ class PasskeyAuthenticator {
}
}

final r = await _platform.authenticate(request);
final r = await _platform.authenticate(request, salt);

return r;
} on PlatformException catch (e) {
Expand Down Expand Up @@ -174,9 +172,7 @@ class PasskeyAuthenticator {
void _isValidChallenge(String challenge) {
if (!_isValidBase64Url(input: challenge)) {
if (debugMode) {
_doctor.recordException(
PlatformException(code: 'malformed-base64-url-challenge'),
);
_doctor.recordException(PlatformException(code: 'malformed-base64-url-challenge'));
}
throw MalformedBase64UrlChallenge();
}
Expand All @@ -186,9 +182,7 @@ class PasskeyAuthenticator {
void _isValidCredentialID(String credentialID) {
if (!_isValidBase64Url(input: credentialID)) {
if (debugMode) {
_doctor.recordException(
PlatformException(code: 'malformed-base64-url-credential-id'),
);
_doctor.recordException(PlatformException(code: 'malformed-base64-url-credential-id'));
}
throw MalformedBase64UrlCredentialID();
}
Expand All @@ -198,9 +192,7 @@ class PasskeyAuthenticator {
void _isValidUserID(String userID) {
if (!_isValidBase64Url(input: userID, allowPadding: true)) {
if (debugMode) {
_doctor.recordException(
PlatformException(code: 'malformed-base64-url-user-id'),
);
_doctor.recordException(PlatformException(code: 'malformed-base64-url-user-id'));
}
throw MalformedBase64UrlUserID();
}
Expand All @@ -227,8 +219,7 @@ class PasskeyAuthenticator {
if (!base64UrlRegex.hasMatch(input)) return false;

try {
String normalized =
input.padRight(input.length + (4 - input.length % 4) % 4, '=');
String normalized = input.padRight(input.length + (4 - input.length % 4) % 4, '=');
base64Url.decode(normalized);

return true;
Expand Down
26 changes: 19 additions & 7 deletions packages/passkeys/passkeys/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ description: Flutter plugin enabling simple passkey authentication. Can be eithe
homepage: https://docs.corbado.com/overview/welcome
repository: https://github.com/corbado/flutter-passkeys/tree/main/packages/passkeys/passkeys
version: 2.17.4
publish_to: none


environment:
sdk: ">=3.0.0 <4.0.0"
sdk: '>=3.8.0 <4.0.0'
flutter: ">=3.0.0"

flutter:
Expand All @@ -27,12 +29,18 @@ dependencies:
flutter:
sdk: flutter
json_annotation: ^4.8.1
passkeys_android: ^2.11.0
passkeys_darwin: ^0.3.0
passkeys_doctor: ^1.2.0
passkeys_platform_interface: ^2.6.0
passkeys_web: ^2.8.1
passkeys_windows: ^0.1.1
passkeys_android:
path: ../passkeys_android
passkeys_darwin:
path: ../passkeys_darwin
passkeys_doctor:
path: ../passkeys_doctor
passkeys_platform_interface:
path: ../passkeys_platform_interface
passkeys_web:
path: ../passkeys_web
passkeys_windows:
path: ../passkeys_windows
ua_client_hints: ^1.1.3

dev_dependencies:
Expand All @@ -43,3 +51,7 @@ dev_dependencies:
mocktail: ^1.0.0
plugin_platform_interface: ^2.0.0
very_good_analysis: ^5.0.0

dependency_overrides:
passkeys_platform_interface:
path: ../passkeys_platform_interface
Loading