Mono Prove Flutter SDK
The Mono Prove SDK is a quick and secure way to onboard your users from within your Flutter app. Mono Prove is a customer onboarding product that offers businesses faster customer onboarding and prevents fraudulent sign-ups, powered by the MDN and facial recognition technology.
For accessing customer accounts and interacting with Mono's API (Identity, Transactions, Income, DirectPay) use the server-side Mono API.
Documentation
For complete information about Mono Prove, head to the docs.
Getting Started
- Register on the Mono website and get your public and secret keys.
- Retrieve a
sessionId
for a customer by calling the initiate endpoint
Installation Guide
❗ In order to start using Mono Prove you must have the Flutter SDK installed on your machine.
Install via flutter pub add
:
flutter pub add mono_prove
Additional Setup
iOS
- Add the key
Privacy - Camera Usage Description
and a usage description to yourInfo.plist
.
If editing Info.plist
as text, add:
<key>NSCameraUsageDescription</key>
<string>your usage description here</string>
- Add the following to your
Podfile
file:
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',
## dart: PermissionGroup.camera
'PERMISSION_CAMERA=1',
]
end
end
end
Android
State the camera permission in your android/app/src/main/AndroidManifest.xml
file.
<uses-permission android:name="android.permission.CAMERA"/>
Usage
Import Mono Prove SDK
import 'package:mono_prove/mono_prove.dart';
Create a ProveConfiguration
final config = ProveConfiguration(
sessionId: 'PRV...',
onSuccess: () {
print('Successfully verified.');
},
reference: 'testref',
onEvent: (event) {
print(event);
},
onClose: () {
print('Widget closed.');
},
);
Show the Widget
ElevatedButton(
onPressed: () {
MonoProve.launch(
context,
config: config,
showLogs: true,
)
},
child: Text('Launch Prove Widget'),
)
For Web Support
- Add the following to your
index.html
file:
<script src="https://prove.mono.co/prove.js" async></script>
<script>
function setupMonoProve(requestId, config) {
const options = {
requestId,
config,
onSuccess: onSuccess,
onEvent: onEvent,
onClose: onClose,
};
const MonoProve = new Prove(options);
MonoProve.setup(config);
MonoProve.open();
}
</script>
Configuration Options
sesssionId
String: Required
This is the session ID returned after calling the initiate endpoint.
final config = ProveConfiguration(
sessionId: 'PRV...', // sessionId
onSuccess: () {
print('Successfully verified.');
}, // onSuccess function
);
onSuccess
void Function(): Required
The closure is called when a user has successfully verified their identity.
final config = ProveConfiguration(
sessionId: 'PRV...', // sessionId
onSuccess: () {
print('Successfully verified.');
}, // onSuccess function
);
onClose
void Function(): Optional
The optional closure is called when a user has specifically exited the Mono Prove flow. It does not take any arguments.
final config = ProveConfiguration(
sessionId: 'PRV...', // sessionId
onSuccess: () {
print('Successfully verified.');
}, // onSuccess function
onClose: () {
print('Widget closed.');
}, // onClose function
);
onEvent
void Function(ProveEvent): Optional
This optional closure is called when certain events in the Mono Prove flow have occurred, for example, when the user opens or closes the widget. This enables your application to gain further insight into what is going on as the user goes through the Mono Prove flow.
See the ProveEvent object below for details.
final config = ProveConfiguration(
sessionId: 'PRV...', // sessionId
onSuccess: () {
print('Successfully verified.');
}, // onSuccess function
onEvent: (event) {
print(event);
}, // onEvent function
);
reference
String: Optional
When passing a reference to the configuration it will be passed back on all onEvent calls.
final config = ProveConfiguration(
sessionId: 'PRV...', // sessionId
onSuccess: () {
print('Successfully verified.');
}, // onSuccess function
reference: 'random_string',
);
API Reference
MonoProve Object
The MonoProve Object exposes methods that take a ProveConfiguration for easy interaction with the Mono Prove Widget.
ProveConfiguration
The configuration option is passed to the different launch methods from the MonoProve Object.
sessionId: String // required
onSuccesss: VoidCallback // required
onClose: VoidCallback // optional
onEvent: void Function(ProveEvent) // optional
reference: String // optional
Usage
final config = ProveConfiguration(
sessionId: 'PRV...',
onSuccess: () {
print('Successfully verified.');
},
reference: 'testref',
onEvent: (event) {
print(event);
},
onClose: () {
print('Widget closed.');
},
);
ProveEvent
type: ProveEventType
Event types correspond to the type
key returned by the event data. Possible options are in the table below.
Event type | Description |
---|---|
opened | Triggered when the user opens the Prove Widget. |
loaded | Triggered when the the Prove Widget is loaded. |
closed | Triggered when the user closes the Prove Widget. |
identityVerified | Triggered when the user successfully verifies their identity. |
error | Triggered when the widget reports an error. |
data: ProveEventData
The data object of type ProveEventData returned from the onEvent callback.
eventType: String // type of event mono.prove.xxxx
reference: String? // reference passed through the prove config
pageName: String? // name of page the widget exited on
errorType: String? // error thrown by widget
errorMessage: String? // error message describing the error
reason: String? // reason for exiting the widget
timestamp: Date // timestamp of the event as a Date object
Support
If you're having general trouble with Mono Prove Flutter SDK or your Mono integration, please reach out to us at support@mono.co or come chat with us on Slack. We're proud of our level of service, and we're more than happy to help you out with your integration to Mono.
Contributing
If you would like to contribute to the Mono Prove Flutter SDK, please make sure to read our contributor guidelines.
License
MIT for more information.
Libraries
- mono_prove
- The Mono Prove SDK is a quick and secure way to onboard your users from within your Flutter app. Mono Prove is a customer onboarding product that offers businesses faster customer onboarding and prevents fraudulent sign-ups, powered by the MDN and facial recognition technology.