sunuid-sdk 1.0.51 → 1.0.53
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.
- package/README.md +429 -193
- package/dist/sunuid-sdk.esm.js +5 -5
- package/dist/sunuid-sdk.esm.js.map +1 -1
- package/dist/sunuid-sdk.js +5 -5
- package/dist/sunuid-sdk.js.map +1 -1
- package/dist/sunuid-sdk.min.js +1 -1
- package/dist/sunuid-sdk.min.js.map +1 -1
- package/docs/INTEGRATION_GUIDE.md +334 -0
- package/docs/SECURITY_GUIDE.md +369 -0
- package/examples/.htaccess.example +190 -0
- package/examples/README.md +192 -0
- package/examples/auto-code.js +234 -0
- package/examples/auto-integration.html +337 -0
- package/examples/callback-example.html +232 -0
- package/examples/config-example.js +41 -0
- package/examples/demo.html +323 -0
- package/examples/env.example +83 -0
- package/examples/minimal-code.js +147 -0
- package/examples/minimal-integration.html +157 -0
- package/examples/no-loop-example.html +250 -0
- package/examples/partner-name-config.js +123 -0
- package/examples/production-config.js +60 -0
- package/examples/secure-init.php +154 -0
- package/examples/secure-integration-example.js +186 -0
- package/examples/secure-integration.html +410 -0
- package/examples/simple-kyc.html +95 -0
- package/examples/simple-login.html +96 -0
- package/examples/test-partner-name.html +251 -0
- package/examples/test-production.html +200 -0
- package/examples/universal-kyc.html +199 -0
- package/examples/universal-login.html +148 -0
- package/package.json +24 -10
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="fr">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>Vérification KYC - Universel</title>
|
|
7
|
+
<style>
|
|
8
|
+
body {
|
|
9
|
+
font-family: Arial, sans-serif;
|
|
10
|
+
display: flex;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
align-items: center;
|
|
13
|
+
min-height: 100vh;
|
|
14
|
+
margin: 0;
|
|
15
|
+
background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
|
|
16
|
+
}
|
|
17
|
+
.kyc-card {
|
|
18
|
+
background: white;
|
|
19
|
+
padding: 40px;
|
|
20
|
+
border-radius: 15px;
|
|
21
|
+
box-shadow: 0 10px 30px rgba(0,0,0,0.2);
|
|
22
|
+
text-align: center;
|
|
23
|
+
max-width: 400px;
|
|
24
|
+
}
|
|
25
|
+
.qr-code {
|
|
26
|
+
margin: 20px 0;
|
|
27
|
+
}
|
|
28
|
+
.qr-code img {
|
|
29
|
+
max-width: 100%;
|
|
30
|
+
height: auto;
|
|
31
|
+
}
|
|
32
|
+
.status {
|
|
33
|
+
margin-top: 20px;
|
|
34
|
+
padding: 10px;
|
|
35
|
+
border-radius: 5px;
|
|
36
|
+
}
|
|
37
|
+
.status.loading {
|
|
38
|
+
background: #e3f2fd;
|
|
39
|
+
color: #1976d2;
|
|
40
|
+
}
|
|
41
|
+
.status.success {
|
|
42
|
+
background: #e8f5e8;
|
|
43
|
+
color: #2e7d32;
|
|
44
|
+
}
|
|
45
|
+
.status.error {
|
|
46
|
+
background: #ffebee;
|
|
47
|
+
color: #c62828;
|
|
48
|
+
}
|
|
49
|
+
.logo {
|
|
50
|
+
width: 80px;
|
|
51
|
+
height: 80px;
|
|
52
|
+
margin: 0 auto 20px;
|
|
53
|
+
background: #f093fb;
|
|
54
|
+
border-radius: 50%;
|
|
55
|
+
display: flex;
|
|
56
|
+
align-items: center;
|
|
57
|
+
justify-content: center;
|
|
58
|
+
font-size: 40px;
|
|
59
|
+
color: white;
|
|
60
|
+
}
|
|
61
|
+
.download-link {
|
|
62
|
+
margin-top: 20px;
|
|
63
|
+
padding: 10px 20px;
|
|
64
|
+
background: #f093fb;
|
|
65
|
+
color: white;
|
|
66
|
+
text-decoration: none;
|
|
67
|
+
border-radius: 25px;
|
|
68
|
+
display: inline-block;
|
|
69
|
+
transition: background 0.3s;
|
|
70
|
+
}
|
|
71
|
+
.download-link:hover {
|
|
72
|
+
background: #e085e8;
|
|
73
|
+
}
|
|
74
|
+
.steps {
|
|
75
|
+
text-align: left;
|
|
76
|
+
margin: 20px 0;
|
|
77
|
+
padding: 15px;
|
|
78
|
+
background: #f8f9fa;
|
|
79
|
+
border-radius: 10px;
|
|
80
|
+
}
|
|
81
|
+
.step {
|
|
82
|
+
margin: 10px 0;
|
|
83
|
+
display: flex;
|
|
84
|
+
align-items: center;
|
|
85
|
+
}
|
|
86
|
+
.step-number {
|
|
87
|
+
width: 25px;
|
|
88
|
+
height: 25px;
|
|
89
|
+
background: #f093fb;
|
|
90
|
+
color: white;
|
|
91
|
+
border-radius: 50%;
|
|
92
|
+
display: flex;
|
|
93
|
+
align-items: center;
|
|
94
|
+
justify-content: center;
|
|
95
|
+
font-size: 12px;
|
|
96
|
+
font-weight: bold;
|
|
97
|
+
margin-right: 10px;
|
|
98
|
+
}
|
|
99
|
+
</style>
|
|
100
|
+
</head>
|
|
101
|
+
<body>
|
|
102
|
+
<div class="kyc-card">
|
|
103
|
+
<div class="logo">📋</div>
|
|
104
|
+
<h1>Vérification KYC</h1>
|
|
105
|
+
<p>Scannez le QR code pour vérifier votre identité</p>
|
|
106
|
+
|
|
107
|
+
<div class="steps">
|
|
108
|
+
<div class="step">
|
|
109
|
+
<div class="step-number">1</div>
|
|
110
|
+
<span>Scannez le QR code avec SunuID</span>
|
|
111
|
+
</div>
|
|
112
|
+
<div class="step">
|
|
113
|
+
<div class="step-number">2</div>
|
|
114
|
+
<span>Suivez les instructions dans l'app</span>
|
|
115
|
+
</div>
|
|
116
|
+
<div class="step">
|
|
117
|
+
<div class="step-number">3</div>
|
|
118
|
+
<span>Votre identité sera vérifiée</span>
|
|
119
|
+
</div>
|
|
120
|
+
</div>
|
|
121
|
+
|
|
122
|
+
<div id="qr-container" class="qr-code">
|
|
123
|
+
<div class="status loading">⏳ Génération du QR code...</div>
|
|
124
|
+
</div>
|
|
125
|
+
|
|
126
|
+
<div id="status" class="status loading">
|
|
127
|
+
⏳ En attente de la vérification...
|
|
128
|
+
</div>
|
|
129
|
+
|
|
130
|
+
<a href="https://sunuid.sn/download" target="_blank" class="download-link">
|
|
131
|
+
📱 Télécharger SunuID
|
|
132
|
+
</a>
|
|
133
|
+
</div>
|
|
134
|
+
|
|
135
|
+
<!-- SunuID SDK -->
|
|
136
|
+
<script src="https://cdn.jsdelivr.net/npm/@sunuid/sdk@latest/dist/sunuid-sdk.min.js"></script>
|
|
137
|
+
|
|
138
|
+
<!-- QRCode library pour le fallback côté client -->
|
|
139
|
+
<script src="https://cdn.jsdelivr.net/npm/qrcode@1.5.3/lib/browser.min.js"></script>
|
|
140
|
+
|
|
141
|
+
<script>
|
|
142
|
+
// Configuration KYC - REMPLACEZ PAR VOS VALEURS
|
|
143
|
+
const config = {
|
|
144
|
+
client_id: 'VOTRE_CLIENT_ID', // ← Remplacez par votre CLIENT_ID
|
|
145
|
+
secret_id: 'VOTRE_SECRET_ID', // ← Remplacez par votre SECRET_ID
|
|
146
|
+
type: 1, // ← 1=KYC, 2=AUTH, 3=Signature
|
|
147
|
+
partner_name: 'Votre Entreprise', // ← Remplacez par votre nom
|
|
148
|
+
options: {
|
|
149
|
+
kyc_type: 'full',
|
|
150
|
+
required_fields: ['identity', 'address', 'phone'],
|
|
151
|
+
redirect_url: 'https://votre-site.com/kyc-complete'
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
// Initialiser SunuID
|
|
156
|
+
const sunuid = new SunuID(config);
|
|
157
|
+
|
|
158
|
+
// Démarrer automatiquement
|
|
159
|
+
sunuid.init().then(() => {
|
|
160
|
+
console.log('✅ SunuID KYC initialisé !');
|
|
161
|
+
document.getElementById('qr-container').innerHTML =
|
|
162
|
+
'<img src="' + sunuid.getQRCode() + '" alt="QR Code KYC SunuID">';
|
|
163
|
+
}).catch(error => {
|
|
164
|
+
console.error('❌ Erreur:', error);
|
|
165
|
+
document.getElementById('status').className = 'status error';
|
|
166
|
+
document.getElementById('status').innerHTML = '❌ Erreur de connexion: ' + error.message;
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
// Écouter les événements KYC
|
|
170
|
+
sunuid.on('kyc_completed', (kycData) => {
|
|
171
|
+
console.log('📋 KYC terminé:', kycData);
|
|
172
|
+
document.getElementById('status').className = 'status success';
|
|
173
|
+
document.getElementById('status').innerHTML = '✅ Vérification KYC réussie ! Redirection...';
|
|
174
|
+
|
|
175
|
+
// Redirection après 2 secondes
|
|
176
|
+
setTimeout(() => {
|
|
177
|
+
window.location.href = '/kyc-complete'; // ← Remplacez par votre URL
|
|
178
|
+
}, 2000);
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
sunuid.on('kyc_progress', (progress) => {
|
|
182
|
+
console.log('📊 Progression KYC:', progress);
|
|
183
|
+
document.getElementById('status').className = 'status loading';
|
|
184
|
+
document.getElementById('status').innerHTML = '📊 Vérification en cours... ' + progress.step;
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
sunuid.on('error', (error) => {
|
|
188
|
+
console.error('❌ Erreur:', error);
|
|
189
|
+
document.getElementById('status').className = 'status error';
|
|
190
|
+
document.getElementById('status').innerHTML = '❌ Erreur: ' + error.message;
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
sunuid.on('expired', () => {
|
|
194
|
+
document.getElementById('status').className = 'status error';
|
|
195
|
+
document.getElementById('status').innerHTML = '⏰ QR expiré. Actualisez la page.';
|
|
196
|
+
});
|
|
197
|
+
</script>
|
|
198
|
+
</body>
|
|
199
|
+
</html>
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="fr">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>Connexion SunuID - Universel</title>
|
|
7
|
+
<style>
|
|
8
|
+
body {
|
|
9
|
+
font-family: Arial, sans-serif;
|
|
10
|
+
display: flex;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
align-items: center;
|
|
13
|
+
min-height: 100vh;
|
|
14
|
+
margin: 0;
|
|
15
|
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
16
|
+
}
|
|
17
|
+
.login-card {
|
|
18
|
+
background: white;
|
|
19
|
+
padding: 40px;
|
|
20
|
+
border-radius: 15px;
|
|
21
|
+
box-shadow: 0 10px 30px rgba(0,0,0,0.2);
|
|
22
|
+
text-align: center;
|
|
23
|
+
max-width: 400px;
|
|
24
|
+
}
|
|
25
|
+
.qr-code {
|
|
26
|
+
margin: 20px 0;
|
|
27
|
+
}
|
|
28
|
+
.qr-code img {
|
|
29
|
+
max-width: 100%;
|
|
30
|
+
height: auto;
|
|
31
|
+
}
|
|
32
|
+
.status {
|
|
33
|
+
margin-top: 20px;
|
|
34
|
+
padding: 10px;
|
|
35
|
+
border-radius: 5px;
|
|
36
|
+
}
|
|
37
|
+
.status.loading {
|
|
38
|
+
background: #e3f2fd;
|
|
39
|
+
color: #1976d2;
|
|
40
|
+
}
|
|
41
|
+
.status.success {
|
|
42
|
+
background: #e8f5e8;
|
|
43
|
+
color: #2e7d32;
|
|
44
|
+
}
|
|
45
|
+
.status.error {
|
|
46
|
+
background: #ffebee;
|
|
47
|
+
color: #c62828;
|
|
48
|
+
}
|
|
49
|
+
.logo {
|
|
50
|
+
width: 80px;
|
|
51
|
+
height: 80px;
|
|
52
|
+
margin: 0 auto 20px;
|
|
53
|
+
background: #667eea;
|
|
54
|
+
border-radius: 50%;
|
|
55
|
+
display: flex;
|
|
56
|
+
align-items: center;
|
|
57
|
+
justify-content: center;
|
|
58
|
+
font-size: 40px;
|
|
59
|
+
color: white;
|
|
60
|
+
}
|
|
61
|
+
.download-link {
|
|
62
|
+
margin-top: 20px;
|
|
63
|
+
padding: 10px 20px;
|
|
64
|
+
background: #667eea;
|
|
65
|
+
color: white;
|
|
66
|
+
text-decoration: none;
|
|
67
|
+
border-radius: 25px;
|
|
68
|
+
display: inline-block;
|
|
69
|
+
transition: background 0.3s;
|
|
70
|
+
}
|
|
71
|
+
.download-link:hover {
|
|
72
|
+
background: #5a6fd8;
|
|
73
|
+
}
|
|
74
|
+
</style>
|
|
75
|
+
</head>
|
|
76
|
+
<body>
|
|
77
|
+
<div class="login-card">
|
|
78
|
+
<div class="logo">🔐</div>
|
|
79
|
+
<h1>Connexion Sécurisée</h1>
|
|
80
|
+
<p>Scannez le QR code avec l'application SunuID</p>
|
|
81
|
+
|
|
82
|
+
<div id="qr-container" class="qr-code">
|
|
83
|
+
<div class="status loading">⏳ Génération du QR code...</div>
|
|
84
|
+
</div>
|
|
85
|
+
|
|
86
|
+
<div id="status" class="status loading">
|
|
87
|
+
⏳ En attente du scan...
|
|
88
|
+
</div>
|
|
89
|
+
|
|
90
|
+
<a href="https://sunuid.sn/download" target="_blank" class="download-link">
|
|
91
|
+
📱 Télécharger SunuID
|
|
92
|
+
</a>
|
|
93
|
+
</div>
|
|
94
|
+
|
|
95
|
+
<!-- SunuID SDK -->
|
|
96
|
+
<script src="https://cdn.jsdelivr.net/npm/@sunuid/sdk@latest/dist/sunuid-sdk.min.js"></script>
|
|
97
|
+
|
|
98
|
+
<!-- QRCode library pour le fallback côté client -->
|
|
99
|
+
<script src="https://cdn.jsdelivr.net/npm/qrcode@1.5.3/lib/browser.min.js"></script>
|
|
100
|
+
|
|
101
|
+
<script>
|
|
102
|
+
// Configuration simple - REMPLACEZ PAR VOS VALEURS
|
|
103
|
+
const config = {
|
|
104
|
+
client_id: 'VOTRE_CLIENT_ID', // ← Remplacez par votre CLIENT_ID
|
|
105
|
+
secret_id: 'VOTRE_SECRET_ID', // ← Remplacez par votre SECRET_ID
|
|
106
|
+
type: 2, // ← 1=KYC, 2=AUTH, 3=Signature
|
|
107
|
+
partner_name: 'Votre Entreprise' // ← Remplacez par votre nom
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
// Initialiser SunuID
|
|
111
|
+
const sunuid = new SunuID(config);
|
|
112
|
+
|
|
113
|
+
// Démarrer automatiquement
|
|
114
|
+
sunuid.init().then(() => {
|
|
115
|
+
console.log('✅ SunuID initialisé !');
|
|
116
|
+
document.getElementById('qr-container').innerHTML =
|
|
117
|
+
'<img src="' + sunuid.getQRCode() + '" alt="QR Code SunuID">';
|
|
118
|
+
}).catch(error => {
|
|
119
|
+
console.error('❌ Erreur:', error);
|
|
120
|
+
document.getElementById('status').className = 'status error';
|
|
121
|
+
document.getElementById('status').innerHTML = '❌ Erreur de connexion: ' + error.message;
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
// Écouter les événements
|
|
125
|
+
sunuid.on('connected', (user) => {
|
|
126
|
+
console.log('👤 Utilisateur connecté:', user);
|
|
127
|
+
document.getElementById('status').className = 'status success';
|
|
128
|
+
document.getElementById('status').innerHTML = '✅ Connexion réussie ! Redirection...';
|
|
129
|
+
|
|
130
|
+
// Redirection après 2 secondes
|
|
131
|
+
setTimeout(() => {
|
|
132
|
+
window.location.href = '/dashboard'; // ← Remplacez par votre URL
|
|
133
|
+
}, 2000);
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
sunuid.on('error', (error) => {
|
|
137
|
+
console.error('❌ Erreur:', error);
|
|
138
|
+
document.getElementById('status').className = 'status error';
|
|
139
|
+
document.getElementById('status').innerHTML = '❌ Erreur: ' + error.message;
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
sunuid.on('expired', () => {
|
|
143
|
+
document.getElementById('status').className = 'status error';
|
|
144
|
+
document.getElementById('status').innerHTML = '⏰ QR expiré. Actualisez la page.';
|
|
145
|
+
});
|
|
146
|
+
</script>
|
|
147
|
+
</body>
|
|
148
|
+
</html>
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sunuid-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.53",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "SDK JavaScript pour l'intégration des QR codes d'authentification et KYC SunuID",
|
|
5
|
+
"description": "SDK JavaScript sécurisé pour l'intégration des QR codes d'authentification et KYC SunuID",
|
|
6
6
|
"main": "dist/sunuid-sdk.js",
|
|
7
7
|
"module": "dist/sunuid-sdk.esm.js",
|
|
8
8
|
"unpkg": "dist/sunuid-sdk.min.js",
|
|
@@ -10,16 +10,20 @@
|
|
|
10
10
|
"files": [
|
|
11
11
|
"dist",
|
|
12
12
|
"README.md",
|
|
13
|
-
"LICENSE"
|
|
13
|
+
"LICENSE",
|
|
14
|
+
"docs",
|
|
15
|
+
"examples"
|
|
14
16
|
],
|
|
15
17
|
"scripts": {
|
|
16
18
|
"build": "rollup -c",
|
|
17
19
|
"dev": "rollup -c -w",
|
|
18
20
|
"test": "jest",
|
|
21
|
+
"test:coverage": "jest --coverage",
|
|
22
|
+
"security-check": "node examples/secure-integration-example.js",
|
|
19
23
|
"lint": "eslint src/**/*.js",
|
|
20
24
|
"format": "prettier --write src/**/*.js",
|
|
21
25
|
"serve": "python3 -m http.server 8080",
|
|
22
|
-
"demo": "open http://localhost:8080/examples/
|
|
26
|
+
"demo": "open http://localhost:8080/examples/secure-integration.html"
|
|
23
27
|
},
|
|
24
28
|
"keywords": [
|
|
25
29
|
"sunuid",
|
|
@@ -29,12 +33,15 @@
|
|
|
29
33
|
"identity",
|
|
30
34
|
"verification",
|
|
31
35
|
"sdk",
|
|
32
|
-
"javascript"
|
|
36
|
+
"javascript",
|
|
37
|
+
"secure",
|
|
38
|
+
"websocket",
|
|
39
|
+
"socket.io"
|
|
33
40
|
],
|
|
34
41
|
"author": {
|
|
35
42
|
"name": "SunuID Team",
|
|
36
|
-
"email": "
|
|
37
|
-
"url": "https://sunuid.sn"
|
|
43
|
+
"email": "contact@sunuid.fayma.sn",
|
|
44
|
+
"url": "https://sunuid.fayma.sn"
|
|
38
45
|
},
|
|
39
46
|
"license": "MIT",
|
|
40
47
|
"repository": {
|
|
@@ -44,9 +51,9 @@
|
|
|
44
51
|
"bugs": {
|
|
45
52
|
"url": "https://github.com/sunuid/sunuid-sdk/issues"
|
|
46
53
|
},
|
|
47
|
-
"homepage": "https://
|
|
54
|
+
"homepage": "https://sunuid.fayma.sn/docs",
|
|
48
55
|
"dependencies": {
|
|
49
|
-
"socket.io-client": "^4.7.
|
|
56
|
+
"socket.io-client": "^4.7.4",
|
|
50
57
|
"qrcode": "^1.5.3"
|
|
51
58
|
},
|
|
52
59
|
"devDependencies": {
|
|
@@ -70,5 +77,12 @@
|
|
|
70
77
|
"last 2 versions",
|
|
71
78
|
"not dead",
|
|
72
79
|
"not ie 11"
|
|
73
|
-
]
|
|
80
|
+
],
|
|
81
|
+
"exports": {
|
|
82
|
+
".": {
|
|
83
|
+
"import": "./dist/sunuid-sdk.esm.js",
|
|
84
|
+
"require": "./dist/sunuid-sdk.js"
|
|
85
|
+
},
|
|
86
|
+
"./dist/sunuid-sdk.min.js": "./dist/sunuid-sdk.min.js"
|
|
87
|
+
}
|
|
74
88
|
}
|