49 lines
1.9 KiB
Dart
49 lines
1.9 KiB
Dart
import 'dart:convert';
|
|
import 'package:crypto/crypto.dart';
|
|
|
|
class AppCredintials {
|
|
static const String basicAuthCredentials = 'hamzaayedphp:malDEV@2101';
|
|
static const String serverAPI =
|
|
'AAAAinYllCo:APA91bF1shTpzSsSxqbfY6c60D8zs1ZsdIsl9ix6nl7GDdjCqWPRK0G0ub5SqFdb1jDpQDvQPxGg-697MWLo0sy3oYImBwBLObyhk0GjtNzyr0PbE3hI-pOvhf8Vp1xgUgBmofbZYXkH';
|
|
// AIzaSyCyfwRXTwSTLOFQSQgN5p7QZgGJVZnEKq0
|
|
static const String mapAPIKEY = 'AIzaSyCyfwRXTwSTLOFQSQgN5p7QZgGJVZnEKq0';
|
|
|
|
String getBasicAuthCredentials() {
|
|
return base64Encode(utf8.encode(basicAuthCredentials));
|
|
}
|
|
|
|
static const String transactionCloude =
|
|
'Authorization:API_EMDJX6BHQ67DBGT6WV:DG2XPU7YEN02M0VJ2F';
|
|
}
|
|
|
|
class MyClass {
|
|
static const String mapAPIKEY = 'AIzaSyCyfwRXTwSTLOFQSQgN5p7QZgGJVZnEKq0';
|
|
static const String additionalText = 'additional text';
|
|
|
|
String getBasicAuthCredentials() {
|
|
return base64Encode(utf8.encode(mapAPIKEY));
|
|
}
|
|
|
|
String removeAddedText(String apiKey, String addedText) {
|
|
final hashedText = sha256.convert(utf8.encode(addedText)).toString();
|
|
return apiKey.replaceAll(hashedText, '');
|
|
}
|
|
|
|
String addTextToAPIKey(String apiKey, String textToAdd) {
|
|
final hashedText = sha256.convert(utf8.encode(textToAdd)).toString();
|
|
final midIndex = apiKey.length ~/ 2;
|
|
final firstHalf = apiKey.substring(0, midIndex);
|
|
final secondHalf = apiKey.substring(midIndex);
|
|
return '$firstHalf$hashedText$secondHalf';
|
|
}
|
|
|
|
void exampleUsage() {
|
|
String modifiedAPIKey = addTextToAPIKey(mapAPIKEY, additionalText);
|
|
print('Modified API Key: $modifiedAPIKey');
|
|
|
|
String finalAPIKey = removeAddedText(modifiedAPIKey, additionalText);
|
|
print('Final API Key: $finalAPIKey');
|
|
}
|
|
}
|
|
// Modified API Key: AIzaSyCyfwRXTwSTLOFc57cb9e210a21def772cad3cd9ef83247e70bed77da89a64c9a5e91e7f3348dbQSQgN5p7QZgGJVZnEKq0
|
|
// I/flutter ( 5490): Final API Key: AIzaSyCyfwRXTwSTLOFc57cb9e210a21def772cad3cd9ef83247e70bed77da89a64c9a5e91e7f3348dbQSQgN5p7QZgGJVZnEKq0 |