Skip to content

Commit 6d3f81d

Browse files
Merge pull request #32 from Keyri-Co/releases/1.8.0
Updated iOS SDK to 4.6.0-alpha04, updated Android SDK to 4.3.0-alpha0…
2 parents f1c4e4a + e2f05dd commit 6d3f81d

File tree

12 files changed

+129
-9
lines changed

12 files changed

+129
-9
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
## 1.8.0
2+
3+
- Updated iOS SDK
4+
to [4.6.0-alpha04](https://github.com/Keyri-Co/keyri-ios-whitelabel-sdk/releases/tag/4.6.0-alpha04)
5+
- Updated Android SDK
6+
to [4.3.0-alpha05](https://github.com/Keyri-Co/keyri-android-whitelabel-sdk/releases/tag/4.3.0-alpha05)
7+
- Fixed Keyri timestamps
8+
- Added `getCorrectedTimestampSeconds` method which checks time changes and get corrected NTP
9+
timestamp
10+
111
## 1.7.2
212

313
- Fixed `sendEvent` issue on Android

android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ android {
4848

4949
dependencies {
5050
// Keyri
51-
implementation 'com.keyri:keyrisdk:4.2.4'
52-
implementation 'com.keyri:scanner:4.2.4'
51+
implementation 'com.keyri:keyrisdk:4.3.0-alpha05'
52+
implementation 'com.keyri:scanner:4.3.0-alpha05'
5353

5454
// Gson
5555
implementation 'com.google.code.gson:gson:2.10.1'

android/src/main/kotlin/com/keyrico/keyri/KeyriPlugin.kt

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,26 @@ class KeyriPlugin : FlutterPlugin, MethodCallHandler, ActivityAware,
5454
val appKey = arguments?.get("appKey")
5555
val publicApiKey = arguments?.get("publicApiKey")
5656
val serviceEncryptionKey = arguments?.get("serviceEncryptionKey")
57-
val blockEmulatorDetection =
58-
arguments?.get("blockEmulatorDetection")?.toBoolean() ?: true
57+
val blockEmulatorDetection: Boolean = arguments?.get("blockEmulatorDetection")?.toBoolean() ?: true
58+
// val blockRootDetection: Boolean = arguments?.get("blockRootDetection")?.toBoolean() ?: false
59+
// val blockDangerousAppsDetection: Boolean = arguments?.get("blockDangerousAppsDetection")?.toBoolean() ?: false
60+
61+
// TODO: Uncommnet when available
62+
// val blockTamperDetection: Boolean = arguments?.get("blockTamperDetection")?.toBoolean() ?: true
63+
// val blockTamperDetection: Boolean = true
64+
65+
// val blockSwizzleDetection: Boolean = arguments?.get("blockSwizzleDetection")?.toBoolean() ?: false
5966

6067
logMessage("Keyri: initialize called")
6168
initialize(
6269
appKey,
6370
publicApiKey,
6471
serviceEncryptionKey,
6572
blockEmulatorDetection,
73+
// blockRootDetection,
74+
// blockDangerousAppsDetection,
75+
// blockTamperDetection,
76+
// blockSwizzleDetection
6677
result
6778
)
6879
}
@@ -164,6 +175,11 @@ class KeyriPlugin : FlutterPlugin, MethodCallHandler, ActivityAware,
164175
register(publicUserId, result)
165176
}
166177

178+
"getCorrectedTimestampSeconds" -> {
179+
logMessage("Keyri: getCorrectedTimestampSeconds called")
180+
getCorrectedTimestampSeconds(result)
181+
}
182+
167183
"initializeDefaultConfirmationScreen" -> {
168184
logMessage("Keyri: initializeDefaultConfirmationScreen called")
169185
initializeDefaultConfirmationScreen(arguments?.get("payload"), result)
@@ -227,6 +243,10 @@ class KeyriPlugin : FlutterPlugin, MethodCallHandler, ActivityAware,
227243
publicApiKey: String?,
228244
serviceEncryptionKey: String?,
229245
blockEmulatorDetection: Boolean,
246+
// blockRootDetection: Boolean,
247+
// blockDangerousAppsDetection: Boolean,
248+
// blockTamperDetection: Boolean,
249+
// blockSwizzleDetection: Boolean,
230250
result: MethodChannel.Result
231251
) {
232252
if (appKey == null) {
@@ -241,6 +261,14 @@ class KeyriPlugin : FlutterPlugin, MethodCallHandler, ActivityAware,
241261
publicApiKey,
242262
serviceEncryptionKey,
243263
blockEmulatorDetection
264+
// TODO: Add impl
265+
// KeyriDetectionsConfig(
266+
// blockEmulatorDetection,
267+
// false,
268+
// false,
269+
// true,
270+
// false,
271+
// )
244272
)
245273
}
246274

@@ -273,9 +301,11 @@ class KeyriPlugin : FlutterPlugin, MethodCallHandler, ActivityAware,
273301
appKey,
274302
publicApiKey,
275303
serviceEncryptionKey,
276-
blockEmulatorDetection,
304+
// TODO: Add impl
305+
// blockEmulatorDetection,
277306
payload,
278-
publicUserId
307+
publicUserId,
308+
// detectionsConfig = KeyriDetectionsConfig()
279309
)
280310

281311
easyKeyriAuthResult = result
@@ -467,6 +497,15 @@ class KeyriPlugin : FlutterPlugin, MethodCallHandler, ActivityAware,
467497
}
468498
}
469499

500+
private fun getCorrectedTimestampSeconds(result: MethodChannel.Result) {
501+
keyriCoroutineScope("getCorrectedTimestampSeconds", result::error).launch {
502+
val correctedTimestampSeconds = keyri.getCorrectedTimestampSeconds()
503+
504+
logMessage("Keyri getCorrectedTimestampSeconds: $correctedTimestampSeconds")
505+
result.success(correctedTimestampSeconds)
506+
}
507+
}
508+
470509
private fun initializeDefaultConfirmationScreen(
471510
payload: String?,
472511
result: MethodChannel.Result

example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@
138138
97C146EC1CF9000F007C117D /* Resources */,
139139
9705A1C41CF9048500538489 /* Embed Frameworks */,
140140
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
141+
33A10266DE373D3FFFE9596F /* [CP] Copy Pods Resources */,
141142
);
142143
buildRules = (
143144
);
@@ -196,6 +197,23 @@
196197
/* End PBXResourcesBuildPhase section */
197198

198199
/* Begin PBXShellScriptBuildPhase section */
200+
33A10266DE373D3FFFE9596F /* [CP] Copy Pods Resources */ = {
201+
isa = PBXShellScriptBuildPhase;
202+
buildActionMask = 2147483647;
203+
files = (
204+
);
205+
inputFileListPaths = (
206+
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist",
207+
);
208+
name = "[CP] Copy Pods Resources";
209+
outputFileListPaths = (
210+
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist",
211+
);
212+
runOnlyForDeploymentPostprocessing = 0;
213+
shellPath = /bin/sh;
214+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
215+
showEnvVarsInLog = 0;
216+
};
199217
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
200218
isa = PBXShellScriptBuildPhase;
201219
alwaysOutOfDate = 1;

example/lib/main.dart

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ class _KeyriHomePageState extends State<KeyriHomePage> {
9494
button(_sendEvent, 'Send event'),
9595
button(_login, 'Login'),
9696
button(_register, 'Register'),
97+
button(_getCorrectedTimestampSeconds, 'Get timestamp'),
9798
button(_generateAssociationKey, 'Generate association key'),
9899
button(_getAssociationKey, 'Get association key'),
99100
button(_removeAssociationKey, 'Remove association key'),
@@ -168,6 +169,23 @@ class _KeyriHomePageState extends State<KeyriHomePage> {
168169
.catchError((error, stackTrace) => _processError(error));
169170
}
170171

172+
Future<void> _getCorrectedTimestampSeconds() async {
173+
Keyri? keyri = initKeyri();
174+
175+
if (keyri == null) return;
176+
177+
String? publicUserId = usernameController.text;
178+
179+
if (publicUserId.isEmpty) {
180+
publicUserId = null;
181+
}
182+
183+
keyri
184+
.getCorrectedTimestampSeconds()
185+
.then((timestamp) => _showMessage('Timestamp: $timestamp'))
186+
.catchError((error, stackTrace) => _processError(error));
187+
}
188+
171189
void _generateAssociationKey() {
172190
Keyri? keyri = initKeyri();
173191

example/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: keyri_example
2-
version: 1.7.2
2+
version: 1.8.0
33
description: Demonstrates how to use the Keyri plugin.
44
publish_to: 'none'
55

ios/Classes/KeyriPlugin.m

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
5353
[self login:call result:result];
5454
} else if ([@"register" isEqualToString:call.method]) {
5555
[self register:call result:result];
56+
} else if ([@"getCorrectedTimestampSeconds" isEqualToString:call.method]) {
57+
[self getCorrectedTimestampSeconds:call result:result];
5658
} else if ([@"initializeDefaultConfirmationScreen" isEqualToString:call.method]) {
5759
[self initializeDefaultConfirmationScreen:call result:result];
5860
} else if ([@"processLink" isEqualToString:call.method]) {
@@ -71,6 +73,11 @@ - (void)initialize:(FlutterMethodCall*)call result:(FlutterResult)result {
7173
id publicApiKeyValue = call.arguments[@"publicApiKey"];
7274
id serviceEncryptionKeyValue = call.arguments[@"serviceEncryptionKey"];
7375
id blockEmulatorDetectionValue = call.arguments[@"blockEmulatorDetection"];
76+
// TODO: Uncomment and add implementation
77+
// id blockRootDetection = call.arguments[@"blockRootDetection"];
78+
// id blockDangerousAppsDetection = call.arguments[@"blockDangerousAppsDetection"];
79+
// id blockTamperDetection = call.arguments[@"blockTamperDetection"];
80+
// id blockSwizzleDetection = call.arguments[@"blockSwizzleDetection"];
7481

7582
if (appKey == nil || ![appKey isKindOfClass:[NSString class]]) {
7683
return [self sendErrorResult:result errorMessage:@"You need to provide appKey"];
@@ -85,6 +92,11 @@ - (void)initialize:(FlutterMethodCall*)call result:(FlutterResult)result {
8592
NSString *publicApiKey = [publicApiKeyValue isKindOfClass:[NSString class]] ? publicApiKeyValue : nil;
8693
NSString *serviceEncryptionKey = [serviceEncryptionKeyValue isKindOfClass:[NSString class]] ? serviceEncryptionKeyValue : nil;
8794

95+
// TODO: Add impl
96+
// KeyriDetectionsConfig *config = [[KeyriDetectionsConfig alloc] initWithBlockEmulatorDetection: blockEmulatorDetection blockRootDetection:blockRootDetection blockDangerousAppsDetection:blockDangerousAppsDetection blockTamperDetection:blockTamperDetection blockSwizzleDetection:blockSwizzleDetection];
97+
//
98+
// self.keyri = [[KeyriObjC alloc] initWithAppKey:appKey publicApiKey:publicApiKey serviceEncryptionKey:serviceEncryptionKey detectionsConfig:config];
99+
88100
[self.keyri initializeKeyriWithAppKey:appKey publicApiKey:publicApiKey serviceEncryptionKey:serviceEncryptionKey blockEmulatorDetection:blockEmulatorDetection];
89101
result(@(YES));
90102
}
@@ -296,6 +308,14 @@ - (void)register:(FlutterMethodCall*)call result:(FlutterResult)result {
296308
}];
297309
}
298310

311+
- (void)getCorrectedTimestampSeconds:(FlutterMethodCall*)call result:(FlutterResult)result {
312+
[self.keyri getCorrectedTimestampSecondsWithPubUserd:@"publicUserId" completion:^(double timestamp) {
313+
NSInteger timeInSeconds = (NSInteger)ceil(timestamp);
314+
315+
return result(@(timeInSeconds));
316+
}];
317+
}
318+
299319
- (void)initializeDefaultConfirmationScreen:(FlutterMethodCall*)call result:(FlutterResult)result {
300320
id payload = call.arguments[@"payload"];
301321

ios/keyri_v3.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Pod::Spec.new do |spec|
1818
spec.public_header_files = 'Classes/**/*.h'
1919

2020
spec.dependency 'Flutter'
21-
spec.dependency 'keyri-pod', '~> 4.5.1'
21+
spec.dependency 'keyri-pod', '~> 4.6.0-alpha04'
2222

2323
# Flutter.framework does not contain a i386 slice.
2424
spec.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }

lib/keyri.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,12 @@ class Keyri {
111111
return KeyriPlatform.instance.register(publicUserId);
112112
}
113113

114+
/// Call it to get timestamp synchronized with NTP.
115+
/// Returns Future of [Long] object or error.
116+
Future<int> getCorrectedTimestampSeconds() {
117+
return KeyriPlatform.instance.getCorrectedTimestampSeconds();
118+
}
119+
114120
/// Call it to show Confirmation screen with default UI.
115121
Future<bool> initializeDefaultConfirmationScreen(String payload) {
116122
return KeyriPlatform.instance.initializeDefaultConfirmationScreen(payload);

lib/src/keyri_method_channel.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,11 @@ class MethodChannelKeyri extends KeyriPlatform {
152152
return RegisterObject.fromJson(registerObject);
153153
}
154154

155+
@override
156+
Future<int> getCorrectedTimestampSeconds() async {
157+
return await methodChannel.invokeMethod('getCorrectedTimestampSeconds');
158+
}
159+
155160
@override
156161
Future<bool> initializeDefaultConfirmationScreen(String payload) async {
157162
return await methodChannel.invokeMethod<bool>(

lib/src/keyri_platform_interface.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ abstract class KeyriPlatform extends PlatformInterface {
9292
throw UnimplementedError('register() has not been implemented.');
9393
}
9494

95+
Future<int> getCorrectedTimestampSeconds() {
96+
throw UnimplementedError('getCorrectedTimestampSeconds() has not been implemented.');
97+
}
98+
9599
Future<bool> initializeDefaultConfirmationScreen(String payload) {
96100
throw UnimplementedError(
97101
'initializeDefaultConfirmationScreen() has not been implemented.');

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: keyri_v3
22
description: Keyri QR Login plugin for Flutter. Provides Keyri SDK capabilities for secure and passwordless login.
3-
version: 1.7.2
3+
version: 1.8.0
44
homepage: https://keyri.com
55

66
environment:

0 commit comments

Comments
 (0)