quixxi 0.0.6
quixxi: ^0.0.6 copied to clipboard
Flutter plugin for adding SSL Pinning to application, Prevent copy and paste inside the application.
Quixxi Plugin #
A flutter plugin for iOS and Android on protecting your application from security threats and copying sensitive information from the application. Quixxi security shield should be applied to application after this plugin is added.
Note: Plugin will not validate SSL certificate in debug build. Quixxi shield must be added in release build to add SSL Pinning to your application.
Getting Started #
First, add quixxi as a dependency in your pubspec.yaml file.
dependencies:
...
quixxi: 0.0.6
Usage example #
SSL Pinning #
Using Dio
import 'package:quixxi/services.dart';
Dio dioClient = getDioClient('https://gorest.co.in',enableSSLPinning: true);
void apiCall() async {
var header = {'Content-type': 'application/json; charset=utf-8'};
try {
final response = await dio.get("https://yourdomain.com/yourapi",
options: Options(headers: header));
if (response.statusCode == 200) {
apiResponse.value = response.data.toString();
} else {
print('${response.statusCode} : ${response.data.toString()}');
apiResponse.value = response.data.toString();
}
} catch (error) {
apiResponse.value = error.toString();
}
}
Using Http
import 'package:quixxi/services.dart';
SecureHttpClient secureHttpClient = getSecureHttpClient(enableSSLPinning: true);
void apiCall2() async{
var header = {'Content-type': 'application/json; charset=utf-8'};
try {
Uri uri = Uri.parse("https://gorest.co.in/public/v2/todos");
final response = await secureHttpClient.get(uri, headers: header);
if (response.statusCode == 200) {
apiResponse.value = response.body.toString();
}else{
print('${response.statusCode} : ${response.body.toString()}');
apiResponse.value = response.body.toString();
}
} catch (error) {
apiResponse.value = error.toString();
}
}
Custom Implementation
import 'package:quixxi/services.dart';
Future myCustomImplementation(String url, Map<String,String> headers) async {
try{
final secure = await SSLCertificatePinning().check(
serverURL: url,
headerHttp: headers,
timeout : 50
);
if(secure.contains("CONNECTION_SECURE")){
return true;
}else{
return false;
}
}catch(e){
return false;
}
}
App Attestation #
With SSLPinning
Using Dio
import 'package:quixxi/services.dart';
// Send parametrer as 'true' to enable App Attestation
Dio dioClient = getDioClient('https://gorest.co.in',enableSSLPinning: true, enableAppAttestation: true);
void apicall_dio_app_attestation() async {
var header = {'Content-type': 'application/json; charset=utf-8'};
try {
final response = await dioClient.get(urlTextEditingController.text,
options: Options(headers: header));
isLoading.value = false;
if (response.statusCode == 200) {
apiResponse.value = response.data.toString();
} else {
print('${response.statusCode} : ${response.data.toString()}');
apiResponse.value = response.data.toString();
}
} catch (error) {
isLoading.value = false;
apiResponse.value = error.toString();
}
}
Using Http
import 'package:quixxi/services.dart';
// Send parametrer as 'true' to enable App Attestation
SecureHttpClient secureHttpClient = getSecureHttpClient(enableSSLPinning: true, enableAppAttestation: true);
void apicall_http_app_attestation() async{
var header = {'Content-type': 'application/json; charset=utf-8'};
try {
Uri uri = Uri.parse(urlTextEditingController.text);
final response = await secureHttpClient.get(uri,headers: header);
isLoading.value = false;
if (response.statusCode == 200) {
apiResponse.value = response.body.toString();
} else {
print('${response.statusCode} : ${response.toString()}');
apiResponse.value = response.body.toString();
}
} catch (error) {
isLoading.value = false;
apiResponse.value = error.toString();
}
}
Without SSLPinning
Using Dio
import 'package:quixxi/services.dart';
// Send parametrer as 'true' to enable App Attestation
Dio dioClient = getDioClient('https://gorest.co.in',enableAppAttestation: true);
void apicall_dio_app_attestation() async {
var header = {'Content-type': 'application/json; charset=utf-8'};
try {
final response = await dioClient.get(urlTextEditingController.text,
options: Options(headers: header));
isLoading.value = false;
if (response.statusCode == 200) {
apiResponse.value = response.data.toString();
} else {
print('${response.statusCode} : ${response.data.toString()}');
apiResponse.value = response.data.toString();
}
} catch (error) {
isLoading.value = false;
apiResponse.value = error.toString();
}
}
Using Http
import 'package:quixxi/services.dart';
// Send parametrer as 'true' to enable App Attestation
SecureHttpClient secureHttpClient = getSecureHttpClient(enableAppAttestation: true);
void apicall_http_app_attestation() async{
var header = {'Content-type': 'application/json; charset=utf-8'};
try {
Uri uri = Uri.parse(urlTextEditingController.text);
final response = await secureHttpClient.get(uri,headers: header);
isLoading.value = false;
if (response.statusCode == 200) {
apiResponse.value = response.body.toString();
} else {
print('${response.statusCode} : ${response.toString()}');
apiResponse.value = response.body.toString();
}
} catch (error) {
isLoading.value = false;
apiResponse.value = error.toString();
}
}
Copy & Paste Prevention #
Secure Text Field
import 'package:quixxi/text_field/quixxi_text_form_field.dart';
const customTxt(text: 'Quixxi Textfield'),
Container(
padding: const EdgeInsets.symmetric(vertical: 15),
child: QuixxiTextField(
decoration: const InputDecoration(
border: UnderlineInputBorder(),
hintText: 'https://yourdomain.com',
),
keyboardType: TextInputType.url,
textInputAction: TextInputAction.next,
controller: TextEditingController(
text: "https://yourdomain.com"),
),
)
Secure Text Form Field
import 'package:quixxi/text_field/quixxi_text_form_field.dart';
const customTxt(text: 'Quixxi TextFormfield'),
Container(
padding: const EdgeInsets.symmetric(vertical: 15),
child: QuixxiTextFormField(
decoration: const InputDecoration(
border: UnderlineInputBorder(),
hintText: 'https://yourdomain.com',
),
keyboardType: TextInputType.url,
textInputAction: TextInputAction.next,
controller: TextEditingController(
text: "https://yourdomain.com"),
onSaved: (value) {},
validator: (value) {},
),
)
Adding Quixxi Shield to application #
- Create an account in https://portal.quixxi.com
- Create application container in your account.
- Upload your application to portal for app protection.
- In Shield configuration, choose the option SSL certificate validation via SSLPinning
- After applying shield configurations, wait for Shielding to complete
- Download protected application from portal.