README.md 8.17 KB
Newer Older
Javohir Savriy's avatar
Javohir Savriy committed
1
2
3
# myid

MyID SDK flutter plugin.
Javohir Savriy's avatar
Javohir Savriy committed
4
5
6

## Table of contents

Javohir Savriy's avatar
Javohir Savriy committed
7
- [Project adjustments](#project-adjustments)
Javohir Savriy's avatar
Javohir Savriy committed
8
9
- [Usage](#usage)
- [SDK error codes](#sdk-error-codes)
Javohir Savriy's avatar
Javohir Savriy committed
10
- [Theme](#theme)
Javohir Savriy's avatar
Javohir Savriy committed
11

Javokhir's avatar
Javokhir committed
12
Android SDK: `2.3.7`
Javohir Savriy's avatar
Javohir Savriy committed
13

Javokhir's avatar
Javokhir committed
14
iOS SDK: `2.3.3`
Javohir Savriy's avatar
Javohir Savriy committed
15

Javohir Savriy's avatar
Javohir Savriy committed
16
## Project adjustments
Javohir Savriy's avatar
Javohir Savriy committed
17

Javohir Savriy's avatar
Javohir Savriy committed
18
### iOS
Javohir Savriy's avatar
Javohir Savriy committed
19

Javohir Savriy's avatar
Javohir Savriy committed
20
Update your iOS configuration files
Javohir Savriy's avatar
Javohir Savriy committed
21

Javokhir's avatar
Javokhir committed
22
Change `ios/Podfile` to use version 12:
Javohir Savriy's avatar
Javohir Savriy committed
23

Javohir Savriy's avatar
Javohir Savriy committed
24
```ruby
Javokhir's avatar
Javokhir committed
25
platform :ios, '12.0'
Javohir Savriy's avatar
Javohir Savriy committed
26
27
```

Javohir Savriy's avatar
Javohir Savriy committed
28
29
30
31
32
Add descriptions for camera permission to `ios/YourProjectName/Info.plist`:

```xml
<plist version="1.0">
<dict>
Javohir Savriy's avatar
Javohir Savriy committed
33
  <!-- Add these two elements: -->
Javohir Savriy's avatar
Javohir Savriy committed
34
35
36
37
38
    <key>NSCameraUsageDescription</key>
    <string>Required for document and facial capture</string>
  <!-- ... -->
</dict>
</plist>
Javohir Savriy's avatar
Javohir Savriy committed
39
40
41
42
```

## Usage

Javohir Savriy's avatar
Javohir Savriy committed
43
44
45
46
```dart
 var result = await MyIdClient.start(
    config: MyIdConfig(
        clientId: clientId,
Javokhir's avatar
1.1.1    
Javokhir committed
47
48
        clientHash: clientHash,
        clientHashId: clientHashId,
Javohir Savriy's avatar
Javohir Savriy committed
49
50
        passportData: 'AB1234567',
        dateOfBirth: '01.09.1991',
Javokhir's avatar
Javokhir committed
51
        buildMode: MyIdBuildMode.PRODUCTION
Javohir Savriy's avatar
Javohir Savriy committed
52
53
54
    ),
    iosAppearance: MyIdIOSAppearance(),
);
Javohir Savriy's avatar
Javohir Savriy committed
55
56
57

```

Javohir Savriy's avatar
Javohir Savriy committed
58
**Parameters details**:
Javohir Savriy's avatar
Javohir Savriy committed
59
60
61

Method | Notes | Default
--- | --- | ---
Javokhir's avatar
1.1.4    
Javokhir committed
62
63
`clientHash` | Client Hash | Provided by MyID sales team. Mandatory, if using entryType = MyIdEntryType.AUTH
`clientHashId` | Client Hash ID | Provided by MyID sales team. Mandatory, if using entryType = MyIdEntryType.AUTH
Javohir Savriy's avatar
Javohir Savriy committed
64
65
`passportData` | Passport serial number or PINFL data | Optional
`dateOfBirth` | Date of birth in. Format: `dd.MM.yyyy` | Optional
Javokhir's avatar
1.1.4    
Javokhir committed
66
67
`sdkHash` | 32 characters long string (Note 1.2) | Optional
`externalId` | 36 characters long. Should match with UUID4 regex (Note 1.3) | Optional
Javokhir's avatar
Javokhir committed
68
`threshold` | The value can be in the range of `0.55` - `0.99` | 0.55
Javokhir's avatar
1.1.4    
Javokhir committed
69
70
`buildMode` | Build mode (Note 1.4) | MyIdBuildMode.PRODUCTION
`entryType` | Customizing the SDK Entry types (Note 1.5) | MyIdEntryType.AUTH
Javohir Savriy's avatar
Javohir Savriy committed
71
`residency` | To set a specific resident type | MyIdResidentType.RESIDENT
Javokhir's avatar
1.1.4    
Javokhir committed
72
`locale` | To set a specific locale | MyIdLocale.UZBEK
Javohir Savriy's avatar
Javohir Savriy committed
73
74
75
76
`cameraShape` | To set a specific camera shape | MyIdCameraShape.CIRCLE
`resolution` | To set a specific camera resolution | MyIdResolution.RESOLUTION_480
`imageFormat` | To set a specific image format | MyIdImageFormat.PNG
`organizationDetails` | Custom Organization Details | Optional
Javohir Savriy's avatar
Javohir Savriy committed
77
78
79
80
81
82
83
84
85

**Note 1.1.** You can customize the screen for entering passport data and date of birth in your
application, in which case you can pass these parameters during initialization to the SDK, otherwise
the SDK requires the input of passport data and date of birth for user identification.

**Note 1.2.** If the `sdk_hash` is empty, blank or string with length other than 32 has been
provided, we will continue showing the credentials screen.

**Note 1.3.** If the `externalId` is not empty, has a length of 36 characters and corresponds to the
Javohir Savriy's avatar
Javohir Savriy committed
86
87
88
89
90
91
92
regular expression UUID4, we will not display a [recommendation](images/screen01.jpg) screen. If 5 unsuccessful identification attempts in MyID within one hour and the `externalId` is not empty, SDK returns to the parent app error message and TTL as `message` in `MyIdException`.

TTL error example:

```json
{"ttl": 362}
```
Javohir Savriy's avatar
Javohir Savriy committed
93
94
95
96
97
98
99
100
101
102
103

**Note 1.4.** `MyIdBuildMode` contains **DEBUG** and **PRODUCTION** modes.

- **DEBUG** is used to sandbox.
- **PRODUCTION** is used to production.

**Note 1.5.** `MyIdEntryType` contains **AUTH** and **FACE** types.

- **AUTH** is used to identify the user through the MyID services.
- **FACE** is used to detect a face and returns a picture (bitmap).

Javokhir's avatar
Javokhir committed
104
105
**Note 1.6.** `MyIdCameraShape` contains **[CIRCLE](images/screen03.jpg)**
and **[ELLIPSE](images/screen04.jpg)** types.
Javohir Savriy's avatar
Javohir Savriy committed
106

Javohir Savriy's avatar
Javohir Savriy committed
107
## Theme
Javohir Savriy's avatar
Javohir Savriy committed
108

Javokhir's avatar
Javokhir committed
109
For [**Android**](https://gitlab.myid.uz/myid-public-code/myid-sample-android/-/blob/master/CUSTOMIZATION.md)
Javohir Savriy's avatar
Javohir Savriy committed
110

Javohir Savriy's avatar
Javohir Savriy committed
111
For **iOS** theme config use `MyIdIOSAppearance` class and its properties.
Javohir Savriy's avatar
Javohir Savriy committed
112

Javohir Savriy's avatar
Javohir Savriy committed
113
* `primaryColor`: Defines the color of SDK which guides the user through the flow
Javohir Savriy's avatar
Javohir Savriy committed
114

Javohir Savriy's avatar
Javohir Savriy committed
115
116
117
118
119
* `errorColor`: Defines the color of the error buttons, icons and states

* `primaryButtonColor`: Defines the background color of the primary action buttons

* `primaryButtonColorDisabled`: Defines the background color of the primary disabled buttons
Javohir Savriy's avatar
Javohir Savriy committed
120

Javohir Savriy's avatar
Javohir Savriy committed
121
122
123
124
125
* `primaryButtonTextColor`: Defines the color of the text inside the primary action buttons

* `primaryButtonTextColorDisabled`: Defines the color of the text inside the primary disabled buttons

* `buttonCornerRadius`: Defines the radius dimension of all the corners of primary buttons
Javohir Savriy's avatar
Javohir Savriy committed
126

Javokhir's avatar
Javokhir committed
127
128
129
130
131
132
133
134
135
136
137
138
139
## Custom Organization Details

You can customize the SDK, for it to match your organization's brand book, by
providing `MyIdOrganizationDetails` object to `organizationDetails` method. The object allows you to
customize following fields:

- *phoneNumber* - by default 712022202, which is MyID's call center. If you would like the customer
  to call your own call center, you can display your own phone number on the error screen, by
  providing it in this field ([sample](images/screen01.jpg)).
- *logo* - the image drawable name, that will be displayed on the input screen. If you would like to
  display your own logo on the top of the screen, this is the place to provide it. Make sure it fits
  the imageView element, which has the *240x60* size.

Javohir Savriy's avatar
Javohir Savriy committed
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
## SDK error codes

The error code in the following list may appear during the call of SDK. The list below is for your
reference.

| Code |      Error message
|:----:|:-------------
|  2   |  Паспортные данные введены неправильно
|  3   |  Не удалось подтвердить жизненность
|  4   |  Не удалось распознать
|  5   |  Внешний сервис недоступен или работает некорректно
|  6   |  Запрашиваемый пользовател скончался
|  7   |  Фото с ресурсов не получено
|  8   |  Внутренняя ошибка MyID
|  9   |  Срок выполнения задачи истек
|  10  |  Срок ожидания задачи в очереди истек
|  11  |  Сервис MyID не может обработать запрос. Попробуйте повторить позже
|  12  |  Сервис MyID не может обработать запрос. Попробуйте повторить позже
|  13  |  Сервис MyID не может обработать запрос. Попробуйте повторить позже
|  14  |  Не удалось подтвердить жизненность. Некорректная фотография
|  15  |  Сервис MyID не может обработать запрос. Попробуйте повторить позже
|  16  |  Сервис MyID не может обработать запрос. Попробуйте повторить позже
|  17  |  Не удалось распознать. Некорректная фотография
|  18  |  Сервис проверки жизненности не может обработать запрос
|  19  |  Сервис распознования не может обработать запрос
|  20  |  Размытая фотография
|  21  |  Лицо не полностью изображено
|  22  |  Обнаружено несколько лиц
|  23  |  Представленное изображение в градациях серого, требуется цветное изображение
|  24  |  Обнаружены затемненные очки
|  25  |  Тип фотографии не поддерживается
|  26  |  Глаза закрыты либо не видны
|  27  |  Обнаружено вращение головы
|  28  |  Не удалось обнаружить все ориентиры
| 101  |  Непредвиденная ошибка
| 102  |  Доступ к камере запрещен
| 103  |  Ошибка при получении данных с сервера
Javohir Savriy's avatar
Javohir Savriy committed
177
178
179
180
181
182
183
184
185
186
187
| 120  |  Размытое фото обнаружено в SDK

## Getting Started with Flutter plugins

This project is a starting point for a Flutter
[plug-in package](https://flutter.dev/developing-packages/),
a specialized package that includes platform-specific implementation code for
Android and/or iOS.

For help getting started with Flutter, view our
[online documentation](https://flutter.dev/docs), which offers tutorials,
Javokhir's avatar
Javokhir committed
188
samples, guidance on mobile development, and a full API reference.