django-camera-kit 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- django_camera_kit/__init__.py +1 -0
- django_camera_kit/apps.py +7 -0
- django_camera_kit/kyc/__init__.py +0 -0
- django_camera_kit/kyc/apps.py +8 -0
- django_camera_kit/kyc/conf.py +24 -0
- django_camera_kit/kyc/embeddings.py +39 -0
- django_camera_kit/kyc/migrations/0001_initial.py +85 -0
- django_camera_kit/kyc/migrations/__init__.py +0 -0
- django_camera_kit/kyc/models.py +67 -0
- django_camera_kit/kyc/serializers.py +23 -0
- django_camera_kit/kyc/static/django_camera_kit/kyc/css/kyc_capture.css +59 -0
- django_camera_kit/kyc/static/django_camera_kit/kyc/js/face_kit.js +116 -0
- django_camera_kit/kyc/static/django_camera_kit/kyc/js/kyc_capture.js +347 -0
- django_camera_kit/kyc/static/django_camera_kit/kyc/vendor/face_detection_yunet_2023mar.onnx +0 -0
- django_camera_kit/kyc/templates/django_camera_kit/kyc/widgets/kyc_verification.html +7 -0
- django_camera_kit/kyc/throttling.py +20 -0
- django_camera_kit/kyc/urls.py +9 -0
- django_camera_kit/kyc/views.py +65 -0
- django_camera_kit/kyc/widgets.py +39 -0
- django_camera_kit/static/django_camera_kit/css/camera_kit.css +97 -0
- django_camera_kit/static/django_camera_kit/js/camera_kit.js +213 -0
- django_camera_kit/static/django_camera_kit/js/doc_scan.js +367 -0
- django_camera_kit/static/django_camera_kit/vendor/README.md +6 -0
- django_camera_kit/static/django_camera_kit/vendor/jspdf.umd.min.js +373 -0
- django_camera_kit/static/django_camera_kit/vendor/opencv.js +0 -0
- django_camera_kit/templates/django_camera_kit/widgets/document_scanner.html +6 -0
- django_camera_kit/widgets.py +25 -0
- django_camera_kit-0.1.0.dist-info/METADATA +129 -0
- django_camera_kit-0.1.0.dist-info/RECORD +32 -0
- django_camera_kit-0.1.0.dist-info/WHEEL +5 -0
- django_camera_kit-0.1.0.dist-info/licenses/LICENSE +21 -0
- django_camera_kit-0.1.0.dist-info/top_level.txt +1 -0
|
Binary file
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<div class="camera-kit-scanner" data-camera-kit-output="pdf">
|
|
2
|
+
<input type="{{ widget.type }}" name="{{ widget.name }}"{% include "django/forms/widgets/attrs.html" %}>
|
|
3
|
+
<button type="button" class="btn btn-outline-primary camera-kit-trigger">
|
|
4
|
+
Scanner un document
|
|
5
|
+
</button>
|
|
6
|
+
</div>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from django import forms
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class DocumentScannerWidget(forms.FileInput):
|
|
5
|
+
"""FileInput enhanced with in-browser document scanning.
|
|
6
|
+
|
|
7
|
+
Detects document edges live (OpenCV.js WASM, fully client-side), lets
|
|
8
|
+
the user drag the corners when auto-detection misses, and chains
|
|
9
|
+
multiple pages into a single PDF before writing the result back into
|
|
10
|
+
this input via the DataTransfer API. No server round-trip and no
|
|
11
|
+
extra models are required — drop it into any existing FileField or
|
|
12
|
+
ImageField and it behaves like a regular file input to the rest of
|
|
13
|
+
the form.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
template_name = "django_camera_kit/widgets/document_scanner.html"
|
|
17
|
+
|
|
18
|
+
class Media:
|
|
19
|
+
css = {"all": ("django_camera_kit/css/camera_kit.css",)}
|
|
20
|
+
js = (
|
|
21
|
+
"django_camera_kit/vendor/opencv.js",
|
|
22
|
+
"django_camera_kit/vendor/jspdf.umd.min.js",
|
|
23
|
+
"django_camera_kit/js/camera_kit.js",
|
|
24
|
+
"django_camera_kit/js/doc_scan.js",
|
|
25
|
+
)
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: django-camera-kit
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Document scanning and KYC face verification widgets for Django
|
|
5
|
+
Author: Altius Academy SNC
|
|
6
|
+
Author-email: Paul Guindo <paulguindo@altius-group.ch>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Project-URL: Homepage, https://github.com/Altius-Academy-SNC/django-camera-kit
|
|
9
|
+
Project-URL: Documentation, https://altius-academy-snc.github.io/django-camera-kit
|
|
10
|
+
Project-URL: Repository, https://github.com/Altius-Academy-SNC/django-camera-kit
|
|
11
|
+
Project-URL: Issues, https://github.com/Altius-Academy-SNC/django-camera-kit/issues
|
|
12
|
+
Keywords: django,camera,document-scanner,kyc,identity-verification
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Framework :: Django
|
|
15
|
+
Classifier: Framework :: Django :: 4.2
|
|
16
|
+
Classifier: Framework :: Django :: 5.0
|
|
17
|
+
Classifier: Framework :: Django :: 5.1
|
|
18
|
+
Classifier: Framework :: Django :: 6.0
|
|
19
|
+
Classifier: Intended Audience :: Developers
|
|
20
|
+
Classifier: Programming Language :: Python :: 3
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
25
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
26
|
+
Classifier: Topic :: Multimedia :: Graphics :: Capture
|
|
27
|
+
Classifier: Topic :: Security
|
|
28
|
+
Requires-Python: >=3.10
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
License-File: LICENSE
|
|
31
|
+
Requires-Dist: django>=4.2
|
|
32
|
+
Provides-Extra: kyc
|
|
33
|
+
Requires-Dist: djangorestframework>=3.14; extra == "kyc"
|
|
34
|
+
Requires-Dist: pgvector>=0.2; extra == "kyc"
|
|
35
|
+
Requires-Dist: psycopg[binary]>=3.1; extra == "kyc"
|
|
36
|
+
Requires-Dist: insightface>=0.7; extra == "kyc"
|
|
37
|
+
Requires-Dist: onnxruntime>=1.16; extra == "kyc"
|
|
38
|
+
Requires-Dist: pillow>=10.0; extra == "kyc"
|
|
39
|
+
Provides-Extra: dev
|
|
40
|
+
Requires-Dist: djangorestframework>=3.14; extra == "dev"
|
|
41
|
+
Requires-Dist: pgvector>=0.2; extra == "dev"
|
|
42
|
+
Requires-Dist: psycopg[binary]>=3.1; extra == "dev"
|
|
43
|
+
Requires-Dist: insightface>=0.7; extra == "dev"
|
|
44
|
+
Requires-Dist: onnxruntime>=1.16; extra == "dev"
|
|
45
|
+
Requires-Dist: pillow>=10.0; extra == "dev"
|
|
46
|
+
Requires-Dist: pytest; extra == "dev"
|
|
47
|
+
Requires-Dist: pytest-django; extra == "dev"
|
|
48
|
+
Dynamic: license-file
|
|
49
|
+
|
|
50
|
+
# Django Camera Kit
|
|
51
|
+
|
|
52
|
+
Document scanning and KYC face verification widgets for Django. Drop a real document scanner (live edge detection, manual corner adjustment, multi-page → PDF) into any existing `FileField`, no new models or endpoints required. Add live selfie/ID face verification with a server-side matching endpoint.
|
|
53
|
+
|
|
54
|
+
[](https://github.com/Altius-Academy-SNC/django-camera-kit/actions/workflows/tests.yml)
|
|
55
|
+
[](https://pypi.org/project/django-camera-kit/)
|
|
56
|
+
[](LICENSE)
|
|
57
|
+
|
|
58
|
+
**[Documentation](https://altius-academy-snc.github.io/django-camera-kit)** | **[PyPI](https://pypi.org/project/django-camera-kit/)** | **[Source](https://github.com/Altius-Academy-SNC/django-camera-kit)**
|
|
59
|
+
|
|
60
|
+
## Status
|
|
61
|
+
|
|
62
|
+
Document scanning (this package's base install) and KYC identity verification (the `kyc` extra) are both implemented and tested. See the [documentation](https://altius-academy-snc.github.io/django-camera-kit) for the full guide, including the KYC module's security model and known MVP limitations.
|
|
63
|
+
|
|
64
|
+
## Quick example
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
# forms.py — any existing ModelForm, any existing FileField/ImageField
|
|
68
|
+
from django import forms
|
|
69
|
+
from django_camera_kit.widgets import DocumentScannerWidget
|
|
70
|
+
|
|
71
|
+
from .models import Contract
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
class ContractForm(forms.ModelForm):
|
|
75
|
+
class Meta:
|
|
76
|
+
model = Contract
|
|
77
|
+
fields = ["signed_document"]
|
|
78
|
+
widgets = {"signed_document": DocumentScannerWidget()}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
```html
|
|
82
|
+
<!-- template -->
|
|
83
|
+
{{ form.media }}
|
|
84
|
+
<form method="post" enctype="multipart/form-data">
|
|
85
|
+
{% csrf_token %}
|
|
86
|
+
{{ form }}
|
|
87
|
+
<button type="submit">Enregistrer</button>
|
|
88
|
+
</form>
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
The widget replaces the plain file input with a "Scanner un document" button. Clicking it opens the camera, detects the document's edges live (OpenCV.js), lets the user drag the corners if detection misses, and supports adding several pages before assembling everything into a single PDF — written back into the same file input via the `DataTransfer` API. From the form's point of view, it's a normal file upload.
|
|
92
|
+
|
|
93
|
+
## KYC quick example
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
pip install django-camera-kit[kyc]
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
```python
|
|
100
|
+
# forms.py
|
|
101
|
+
from django import forms
|
|
102
|
+
from django_camera_kit.kyc.widgets import KYCVerificationWidget
|
|
103
|
+
|
|
104
|
+
class SignupForm(forms.Form):
|
|
105
|
+
kyc_verification_id = forms.IntegerField(
|
|
106
|
+
widget=KYCVerificationWidget(verify_url="/kyc/verify/")
|
|
107
|
+
)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Requires PostgreSQL with the `pgvector` extension. Matching (face embeddings via YuNet + insightface) only ever happens server-side. See [KYC & Identity Verification](https://altius-academy-snc.github.io/django-camera-kit/guides/kyc/) for the full setup and security model.
|
|
111
|
+
|
|
112
|
+
## Setup
|
|
113
|
+
|
|
114
|
+
Two vendor JS files are required for the scan widget and not committed to this repo (binary build artifacts, pinned separately) — see [`django_camera_kit/static/django_camera_kit/vendor/README.md`](django_camera_kit/static/django_camera_kit/vendor/README.md) for exact files and versions to download.
|
|
115
|
+
|
|
116
|
+
Requires Bootstrap (or Bootstrap Native) CSS/JS to already be loaded on the host page for button styling — `django-camera-kit` only ships the structural/positioning CSS for the scanner overlays themselves.
|
|
117
|
+
|
|
118
|
+
## Roadmap
|
|
119
|
+
|
|
120
|
+
1. ~~Scan MVP~~ — single page, manual corner adjustment, perspective warp
|
|
121
|
+
2. Auto contour detection refinements
|
|
122
|
+
3. Multi-page flow polish
|
|
123
|
+
4. ~~KYC MVP~~ — selfie + ID capture, embedding comparison, head-movement liveness challenge
|
|
124
|
+
5. Anti-deepfake hardening — server-verified liveness, passive scoring, multiple challenge types
|
|
125
|
+
6. ~~Docs site~~ + PyPI release
|
|
126
|
+
|
|
127
|
+
## License
|
|
128
|
+
|
|
129
|
+
MIT
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
django_camera_kit/__init__.py,sha256=kUR5RAFc7HCeiqdlX36dZOHkUI5wI6V_43RpEcD8b-0,22
|
|
2
|
+
django_camera_kit/apps.py,sha256=HBTH0VN0uoxVDjmPIooB-CX9BcuXTqBmlhzuACHGSzE,196
|
|
3
|
+
django_camera_kit/widgets.py,sha256=WFzIxWBuXXcrjSFCmgzIZJZ1BzXHT_qBGpwZs0F_pcU,970
|
|
4
|
+
django_camera_kit/kyc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
+
django_camera_kit/kyc/apps.py,sha256=WDbAHzfDb0lQiq7upKqHRz9XPOomeInw8htH3yB6WSU,240
|
|
6
|
+
django_camera_kit/kyc/conf.py,sha256=snLLKDOXeYRxH90IFEXZ-Fy9Ih-h9fUahop84W6wAsU,1060
|
|
7
|
+
django_camera_kit/kyc/embeddings.py,sha256=eODo2gjnJjAHy5Z12n06DeUb99hfttj2BrKHtTQvTDU,1164
|
|
8
|
+
django_camera_kit/kyc/models.py,sha256=dlqJmGt1Ded1DtCamdRiDSG89MFe7wpnjnYl5tMc-rM,2631
|
|
9
|
+
django_camera_kit/kyc/serializers.py,sha256=OVhJCcWvJtORdS_kM4vjv_llyhFuc0FLm5C5WCdUweg,805
|
|
10
|
+
django_camera_kit/kyc/throttling.py,sha256=Q1mck4X33GeNXSZ6yxIUgeD_Ozw1UcRbSp0ES-k6WQc,684
|
|
11
|
+
django_camera_kit/kyc/urls.py,sha256=6HKIk5_RyNqWL3AvuZns78PJdxLZVK0uJ1xfftb3Wso,172
|
|
12
|
+
django_camera_kit/kyc/views.py,sha256=0F3spbMcBpWOvAwNhKHnVc2SQMXaAcyp1io0SmTXEj0,2650
|
|
13
|
+
django_camera_kit/kyc/widgets.py,sha256=tYeLhqDz72oagM7p4oLFkRyJz-Y6bpvE1qIt6v4lKKc,1442
|
|
14
|
+
django_camera_kit/kyc/migrations/0001_initial.py,sha256=WKUC95RfJgGyxdehNnZCao2QPIDhFdiGJHtZCe3CjGY,2922
|
|
15
|
+
django_camera_kit/kyc/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
|
+
django_camera_kit/kyc/static/django_camera_kit/kyc/css/kyc_capture.css,sha256=bKgF0aA3M-SHBjeIiw0Rm6lx98s4wVrTokLq5ODJbgA,1258
|
|
17
|
+
django_camera_kit/kyc/static/django_camera_kit/kyc/js/face_kit.js,sha256=_omlD2IoQZCTA4h9MCZYEvi4g2nrr64bB53abcPyc_I,3432
|
|
18
|
+
django_camera_kit/kyc/static/django_camera_kit/kyc/js/kyc_capture.js,sha256=D7tTENPfcIkUICqDRP1k0kYIwExcaJihPDxjlrU3h-Y,12711
|
|
19
|
+
django_camera_kit/kyc/static/django_camera_kit/kyc/vendor/face_detection_yunet_2023mar.onnx,sha256=jyOD5N08-7RVPqhxgQf8BCMhDclk-fQoBgSATtJVL6Q,232589
|
|
20
|
+
django_camera_kit/kyc/templates/django_camera_kit/kyc/widgets/kyc_verification.html,sha256=kDqG2Uk5kC0OfWz6OwvrU1afi3j28CEL6T8DNdFIRm4,429
|
|
21
|
+
django_camera_kit/static/django_camera_kit/css/camera_kit.css,sha256=98MUQh7g6d12woTgi_Dckm07wVzqID16pTaXA-dhaIg,1851
|
|
22
|
+
django_camera_kit/static/django_camera_kit/js/camera_kit.js,sha256=1I-zDZuapmIMJzfNHxjURKuMuRx-N5oUQKAy70SWiE0,6297
|
|
23
|
+
django_camera_kit/static/django_camera_kit/js/doc_scan.js,sha256=5BzY6HYjtA285e2zhivTp0Y1GvQ25zCF1EyGbJ9XsaM,12005
|
|
24
|
+
django_camera_kit/static/django_camera_kit/vendor/README.md,sha256=Zu-9MhCUo7H2IYfgtIpkIR_OoHPTSxnhp3Q3iLHS5eQ,674
|
|
25
|
+
django_camera_kit/static/django_camera_kit/vendor/jspdf.umd.min.js,sha256=5lUfzcMvCdaFOyxRJtGNAdlEfg2mGKQaEevu4PbCDVQ,420165
|
|
26
|
+
django_camera_kit/static/django_camera_kit/vendor/opencv.js,sha256=uHPIIRQh2nub9BrhV6kj8FpGoLjT5ZBMRMbzrW05ob0,13298869
|
|
27
|
+
django_camera_kit/templates/django_camera_kit/widgets/document_scanner.html,sha256=iCZIxkuT0_itxxIaRVy6bAE3ZpvI8SPpQzrX3dgiGN4,288
|
|
28
|
+
django_camera_kit-0.1.0.dist-info/licenses/LICENSE,sha256=yZSOTYOKvZakrVPaBo6uivMeoc7YcxJnCHBWqTk6cLo,1065
|
|
29
|
+
django_camera_kit-0.1.0.dist-info/METADATA,sha256=5zDO1Hi0EloSooIXZ-t5B8SUS6QqsNhOlbmnQaBGO1U,5948
|
|
30
|
+
django_camera_kit-0.1.0.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
|
|
31
|
+
django_camera_kit-0.1.0.dist-info/top_level.txt,sha256=In8oaERMr_l15gHP9o1LiMr-Lbtxj0pNJciKXPsIAn8,18
|
|
32
|
+
django_camera_kit-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 AltiusAO
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
django_camera_kit
|