Skip to content

Commit

Permalink
Use the user update method to update email, phone, and identity after…
Browse files Browse the repository at this point in the history
… they are verified
  • Loading branch information
AhmedHanafy725 committed Jun 25, 2024
1 parent 4562bef commit 4112f84
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
3 changes: 2 additions & 1 deletion app/lib/helpers/kyc_helpers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ Future<void> handleKYCData(Map<dynamic, dynamic> emailData,
jsonDecode(identityData['identityDocumentMeta']),
identityData['signedIdentityDocumentMetaIdentifier'],
identityData['identityGender'],
identityData['signedIdentityGenderIdentifier']);
identityData['signedIdentityGenderIdentifier'],
identityData['referenceId']);
}
}

Expand Down
10 changes: 8 additions & 2 deletions app/lib/services/shared_preference_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:threebotlogin/helpers/globals.dart';
import 'package:threebotlogin/models/wallet_data.dart';
import 'package:threebotlogin/services/3bot_service.dart';
import 'package:threebotlogin/services/crypto_service.dart';
import 'package:threebotlogin/services/open_kyc_service.dart';
import 'package:threebotlogin/services/pkid_service.dart';
import 'package:pinenacl/api.dart';
import 'package:pinenacl/tweetnacl.dart' show TweetNaClExt;
Expand Down Expand Up @@ -160,6 +161,7 @@ Future<void> saveEmail(String email, String? signedEmailIdentifier) async {
prefs.setString('signedEmailIdentifier', signedEmailIdentifier);
client.setPKidDoc(
'email', json.encode({'email': email, 'sei': signedEmailIdentifier}));
updateUserData("email", email);
return;
}

Expand Down Expand Up @@ -207,6 +209,7 @@ Future<void> savePhone(String phone, String? signedPhoneIdentifier) async {
prefs.setString('signedPhoneIdentifier', signedPhoneIdentifier);
client.setPKidDoc(
'phone', json.encode({'phone': phone, 'spi': signedPhoneIdentifier}));
updateUserData("phone", phone);
return;
}

Expand Down Expand Up @@ -261,7 +264,8 @@ Future<void> saveIdentity(
Map<String, dynamic> identityDocumentMeta,
String signedIdentityDocumentMetaIdentifier,
String identityGender,
String signedIdentityGenderIdentifier) async {
String signedIdentityGenderIdentifier,
String referenceId) async {
final SharedPreferences prefs = await SharedPreferences.getInstance();
prefs.remove('identityName');
prefs.remove('identityCountry');
Expand Down Expand Up @@ -301,8 +305,10 @@ Future<void> saveIdentity(
'signedIdentityDocumentMetaIdentifier':
signedIdentityDocumentMetaIdentifier,
'identityGender': identityGender,
'signedIdentityGenderIdentifier': signedIdentityGenderIdentifier
'signedIdentityGenderIdentifier': signedIdentityGenderIdentifier,
'referenceId': referenceId
}));
updateUserData("identity_reference", referenceId);

Globals().identityVerified.value = true;
}
Expand Down
3 changes: 2 additions & 1 deletion app/lib/services/socket_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,8 @@ Future identityVerification(String reference) async {
verifiedSignedIdentityDocumentMetaIdentifier['document_meta_data'],
signedIdentityDocumentMetaIdentifier,
verifiedSignedIdentityGenderIdentifier['gender_data'],
signedIdentityGenderIdentifier);
signedIdentityGenderIdentifier,
reference);

return 'Verified';
}
Expand Down

0 comments on commit 4112f84

Please sign in to comment.