sunuid-sdk 1.0.57 → 1.0.59
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 +45 -1
- package/dist/sunuid-sdk.esm.js +9 -9
- package/dist/sunuid-sdk.esm.js.map +1 -1
- package/dist/sunuid-sdk.js +9 -9
- 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/SECURITY_GUIDE.md +3 -3
- package/examples/callback-example.html +1 -1
- package/examples/demo.html +3 -3
- package/examples/env.example +5 -1
- package/examples/no-loop-example.html +1 -1
- package/examples/partner-name-config.js +4 -4
- package/examples/production-config.js +2 -2
- package/examples/secure-init.php +5 -1
- package/examples/test-minimal-callback.html +117 -0
- package/examples/test-partner-name.html +1 -1
- package/examples/test-production.html +1 -1
- package/package.json +1 -1
package/docs/SECURITY_GUIDE.md
CHANGED
|
@@ -31,7 +31,7 @@ Le SDK dispose d'un système d'initialisation sécurisée qui récupère les cre
|
|
|
31
31
|
$SUNUID_CONFIG = [
|
|
32
32
|
'client_id' => 'VOTRE_CLIENT_ID',
|
|
33
33
|
'secret_id' => 'VOTRE_SECRET_ID',
|
|
34
|
-
'api_url' => 'https://api.sunuid.
|
|
34
|
+
'api_url' => 'https://api.sunuid.com',
|
|
35
35
|
'token_expiry' => 3600, // 1 heure
|
|
36
36
|
'max_requests_per_token' => 100
|
|
37
37
|
];
|
|
@@ -84,7 +84,7 @@ Pour une sécurité maximale en production, utilisez des variables d'environneme
|
|
|
84
84
|
```env
|
|
85
85
|
SUNUID_CLIENT_ID=1754166754_221A57B46843D755
|
|
86
86
|
SUNUID_SECRET_ID=56d40fe70507228b27f2640ae65894177c2fedbf246e2b30978fde1fc43953c5
|
|
87
|
-
SUNUID_API_URL=https://api.sunuid.
|
|
87
|
+
SUNUID_API_URL=https://api.sunuid.com
|
|
88
88
|
SUNUID_TOKEN_EXPIRY=3600
|
|
89
89
|
SUNUID_MAX_REQUESTS=100
|
|
90
90
|
```
|
|
@@ -125,7 +125,7 @@ header('Access-Control-Allow-Headers: Content-Type');
|
|
|
125
125
|
$config = [
|
|
126
126
|
'client_id' => $_ENV['SUNUID_CLIENT_ID'],
|
|
127
127
|
'secret_id' => $_ENV['SUNUID_SECRET_ID'],
|
|
128
|
-
'api_url' => 'https://api.sunuid.
|
|
128
|
+
'api_url' => 'https://api.sunuid.com'
|
|
129
129
|
];
|
|
130
130
|
|
|
131
131
|
// Récupérer les données de la requête
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
<script>
|
|
96
96
|
// Configuration du SDK avec gestion des callbacks
|
|
97
97
|
const config = {
|
|
98
|
-
apiUrl: 'https://api.sunuid.
|
|
98
|
+
apiUrl: 'https://api.sunuid.com',
|
|
99
99
|
clientId: '1754166754_221A57B46843D755',
|
|
100
100
|
secretId: '56d40fe70507228b27f2640ae65894177c2fedbf246e2b30978fde1fc43953c5',
|
|
101
101
|
type: 2, // AUTH
|
package/examples/demo.html
CHANGED
|
@@ -187,7 +187,7 @@
|
|
|
187
187
|
<div class="code-example">
|
|
188
188
|
// Initialisation
|
|
189
189
|
const sunuid = initSunuID({
|
|
190
|
-
apiUrl: 'https://api.sunuid.
|
|
190
|
+
apiUrl: 'https://api.sunuid.com',
|
|
191
191
|
clientId: 'VOTRE_CLIENT_ID',
|
|
192
192
|
secretId: 'VOTRE_SECRET_ID',
|
|
193
193
|
theme: 'light'
|
|
@@ -247,7 +247,7 @@ sunuid.generateKYCQR('kyc-qr-container', {
|
|
|
247
247
|
<h3>Options Avancées</h3>
|
|
248
248
|
<div class="code-example">
|
|
249
249
|
const config = {
|
|
250
|
-
apiUrl: 'https://api.sunuid.
|
|
250
|
+
apiUrl: 'https://api.sunuid.com',
|
|
251
251
|
clientId: 'VOTRE_CLIENT_ID',
|
|
252
252
|
secretId: 'VOTRE_SECRET_ID',
|
|
253
253
|
theme: 'light', // 'light' ou 'dark'
|
|
@@ -276,7 +276,7 @@ const config = {
|
|
|
276
276
|
<script>
|
|
277
277
|
// Configuration de démonstration
|
|
278
278
|
const sunuid = initSunuID({
|
|
279
|
-
apiUrl: 'https://api.sunuid.
|
|
279
|
+
apiUrl: 'https://api.sunuid.com',
|
|
280
280
|
clientId: 'test_client_123',
|
|
281
281
|
secretId: 'test_secret_456',
|
|
282
282
|
theme: 'light',
|
package/examples/env.example
CHANGED
|
@@ -8,7 +8,7 @@ SUNUID_CLIENT_ID=1754166754_221A57B46843D755
|
|
|
8
8
|
SUNUID_SECRET_ID=56d40fe70507228b27f2640ae65894177c2fedbf246e2b30978fde1fc43953c5
|
|
9
9
|
|
|
10
10
|
# URL de l'API SunuID
|
|
11
|
-
SUNUID_API_URL=https://api.sunuid.
|
|
11
|
+
SUNUID_API_URL=https://api.sunuid.com
|
|
12
12
|
|
|
13
13
|
# Configuration des tokens sécurisés
|
|
14
14
|
SUNUID_TOKEN_EXPIRY=3600
|
|
@@ -81,3 +81,7 @@ DEBUG=false
|
|
|
81
81
|
# SUNUID_MAX_REQUESTS=100
|
|
82
82
|
# SUNUID_RATE_LIMIT=5
|
|
83
83
|
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
|
|
102
102
|
// Configuration du SDK
|
|
103
103
|
const config = {
|
|
104
|
-
apiUrl: 'https://api.sunuid.
|
|
104
|
+
apiUrl: 'https://api.sunuid.com',
|
|
105
105
|
clientId: '1754166754_221A57B46843D755',
|
|
106
106
|
secretId: '56d40fe70507228b27f2640ae65894177c2fedbf246e2b30978fde1fc43953c5',
|
|
107
107
|
type: 2, // AUTH
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
// Configuration pour la production avec nom personnalisé
|
|
9
9
|
window.SunuIDConfig = {
|
|
10
10
|
// URL de l'API de production
|
|
11
|
-
apiUrl: 'https://api.sunuid.
|
|
11
|
+
apiUrl: 'https://api.sunuid.com',
|
|
12
12
|
|
|
13
13
|
// Endpoints spécifiques
|
|
14
14
|
endpoints: {
|
|
@@ -30,7 +30,7 @@ const banqueConfig = {
|
|
|
30
30
|
language: 'fr',
|
|
31
31
|
|
|
32
32
|
// Configuration pour la production
|
|
33
|
-
apiUrl: 'https://api.sunuid.
|
|
33
|
+
apiUrl: 'https://api.sunuid.com',
|
|
34
34
|
secureInitUrl: 'https://sunuid.fayma.sn/secure-init',
|
|
35
35
|
|
|
36
36
|
// Callbacks
|
|
@@ -52,7 +52,7 @@ const ecommerceConfig = {
|
|
|
52
52
|
language: 'fr',
|
|
53
53
|
|
|
54
54
|
// Configuration pour la production
|
|
55
|
-
apiUrl: 'https://api.sunuid.
|
|
55
|
+
apiUrl: 'https://api.sunuid.com',
|
|
56
56
|
secureInitUrl: 'https://sunuid.fayma.sn/secure-init',
|
|
57
57
|
|
|
58
58
|
// Callbacks
|
|
@@ -74,7 +74,7 @@ const adminConfig = {
|
|
|
74
74
|
language: 'fr',
|
|
75
75
|
|
|
76
76
|
// Configuration pour la production
|
|
77
|
-
apiUrl: 'https://api.sunuid.
|
|
77
|
+
apiUrl: 'https://api.sunuid.com',
|
|
78
78
|
secureInitUrl: 'https://sunuid.fayma.sn/secure-init',
|
|
79
79
|
|
|
80
80
|
// Callbacks
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
// Configuration pour la production
|
|
9
9
|
window.SunuIDConfig = {
|
|
10
10
|
// URL de l'API de production
|
|
11
|
-
apiUrl: 'https://api.sunuid.
|
|
11
|
+
apiUrl: 'https://api.sunuid.com',
|
|
12
12
|
|
|
13
13
|
// Endpoints spécifiques
|
|
14
14
|
endpoints: {
|
|
@@ -40,7 +40,7 @@ const sunuid = new SunuID({
|
|
|
40
40
|
language: 'fr',
|
|
41
41
|
|
|
42
42
|
// Configuration pour la production
|
|
43
|
-
apiUrl: 'https://api.sunuid.
|
|
43
|
+
apiUrl: 'https://api.sunuid.com',
|
|
44
44
|
secureInitUrl: 'https://sunuid.fayma.sn/secure-init',
|
|
45
45
|
|
|
46
46
|
// Callbacks
|
package/examples/secure-init.php
CHANGED
|
@@ -27,7 +27,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') {
|
|
|
27
27
|
$SUNUID_CONFIG = [
|
|
28
28
|
'client_id' => $_ENV['SUNUID_CLIENT_ID'] ?? 'your_client_id_here',
|
|
29
29
|
'secret_id' => $_ENV['SUNUID_SECRET_ID'] ?? 'your_secret_id_here',
|
|
30
|
-
'api_url' => $_ENV['SUNUID_API_URL'] ?? 'https://api.sunuid.
|
|
30
|
+
'api_url' => $_ENV['SUNUID_API_URL'] ?? 'https://api.sunuid.com',
|
|
31
31
|
'token_expiry' => $_ENV['SUNUID_TOKEN_EXPIRY'] ?? 300, // 5 minutes
|
|
32
32
|
'max_requests' => $_ENV['SUNUID_MAX_REQUESTS'] ?? 10
|
|
33
33
|
];
|
|
@@ -152,3 +152,7 @@ try {
|
|
|
152
152
|
]);
|
|
153
153
|
}
|
|
154
154
|
?>
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
@@ -0,0 +1,117 @@
|
|
|
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>Test SunuID SDK</title>
|
|
7
|
+
<style>
|
|
8
|
+
body {
|
|
9
|
+
font-family: Arial, sans-serif;
|
|
10
|
+
max-width: 600px;
|
|
11
|
+
margin: 20px auto;
|
|
12
|
+
padding: 20px;
|
|
13
|
+
}
|
|
14
|
+
.qr-area {
|
|
15
|
+
border: 2px dashed #ccc;
|
|
16
|
+
padding: 40px;
|
|
17
|
+
text-align: center;
|
|
18
|
+
margin: 20px 0;
|
|
19
|
+
border-radius: 10px;
|
|
20
|
+
background-color: #f8f9fa;
|
|
21
|
+
}
|
|
22
|
+
.results {
|
|
23
|
+
background-color: #e8f5e8;
|
|
24
|
+
border: 1px solid #28a745;
|
|
25
|
+
border-radius: 5px;
|
|
26
|
+
padding: 15px;
|
|
27
|
+
margin: 20px 0;
|
|
28
|
+
}
|
|
29
|
+
#user-data {
|
|
30
|
+
background-color: #f8f9fa;
|
|
31
|
+
border: 1px solid #dee2e6;
|
|
32
|
+
border-radius: 3px;
|
|
33
|
+
padding: 10px;
|
|
34
|
+
margin: 5px 0;
|
|
35
|
+
white-space: pre-wrap;
|
|
36
|
+
font-size: 11px;
|
|
37
|
+
max-height: 150px;
|
|
38
|
+
overflow-y: auto;
|
|
39
|
+
}
|
|
40
|
+
.logs {
|
|
41
|
+
background-color: #f8f9fa;
|
|
42
|
+
border: 1px solid #dee2e6;
|
|
43
|
+
border-radius: 5px;
|
|
44
|
+
padding: 15px;
|
|
45
|
+
margin: 20px 0;
|
|
46
|
+
max-height: 200px;
|
|
47
|
+
overflow-y: auto;
|
|
48
|
+
font-family: monospace;
|
|
49
|
+
font-size: 12px;
|
|
50
|
+
}
|
|
51
|
+
</style>
|
|
52
|
+
</head>
|
|
53
|
+
<body>
|
|
54
|
+
<h1>🧪 Test SunuID SDK</h1>
|
|
55
|
+
|
|
56
|
+
<div class="qr-area" id="qr-area">
|
|
57
|
+
Génération du QR Code...
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
<div class="results">
|
|
61
|
+
<strong>Données utilisateur:</strong>
|
|
62
|
+
<pre id="user-data">-</pre>
|
|
63
|
+
</div>
|
|
64
|
+
|
|
65
|
+
<div class="logs" id="logs"></div>
|
|
66
|
+
<!-- Socket.IO (requis) -->
|
|
67
|
+
<script src="https://cdn.socket.io/4.7.4/socket.io.min.js"></script>
|
|
68
|
+
<script src="https://unpkg.com/sunuid-sdk@1.0.57/dist/sunuid-sdk.min.js"></script>
|
|
69
|
+
|
|
70
|
+
<script>
|
|
71
|
+
function log(message) {
|
|
72
|
+
const logsDiv = document.getElementById('logs');
|
|
73
|
+
const timestamp = new Date().toLocaleTimeString();
|
|
74
|
+
logsDiv.innerHTML += `[${timestamp}] ${message}<br>`;
|
|
75
|
+
logsDiv.scrollTop = logsDiv.scrollHeight;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const config = {
|
|
79
|
+
clientId: '1754670914_A908AC4CA011F0C9',
|
|
80
|
+
secretId: '99710a0f318d695e8c96f10c4a55fad28ec3963c2ddada35737951bcb3c66d9b',
|
|
81
|
+
type: 2,
|
|
82
|
+
partnerName: 'MonApplication',
|
|
83
|
+
enableSecurityLogs: true,
|
|
84
|
+
validateInputs: true,
|
|
85
|
+
|
|
86
|
+
onSuccess: function(authData) {
|
|
87
|
+
log('🎉 Authentification réussie!');
|
|
88
|
+
document.getElementById('user-data').textContent = JSON.stringify(authData, null, 2);
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
onError: function(error) {
|
|
92
|
+
log(`❌ Erreur: ${error}`);
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
onStatusUpdate: function(data) {
|
|
96
|
+
log(`📊 Statut: ${data.status || 'inconnu'}`);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
async function initSunuID() {
|
|
101
|
+
try {
|
|
102
|
+
log('🚀 Initialisation...');
|
|
103
|
+
const sunuid = new SunuID(config);
|
|
104
|
+
await sunuid.init();
|
|
105
|
+
log('✅ SDK initialisé');
|
|
106
|
+
await sunuid.generateQR('qr-area');
|
|
107
|
+
log('✅ QR Code généré');
|
|
108
|
+
} catch (e) {
|
|
109
|
+
log(`❌ Erreur: ${e.message}`);
|
|
110
|
+
console.error('Init error:', e);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
document.addEventListener('DOMContentLoaded', initSunuID);
|
|
115
|
+
</script>
|
|
116
|
+
</body>
|
|
117
|
+
</html>
|