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/README.md
CHANGED
|
@@ -82,6 +82,50 @@ const sunuid = new SunuID(config);
|
|
|
82
82
|
await sunuid.init();
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
+
### Configuration Minimale avec Callbacks
|
|
86
|
+
|
|
87
|
+
```javascript
|
|
88
|
+
const config = {
|
|
89
|
+
clientId: 'VOTRE_CLIENT_ID',
|
|
90
|
+
secretId: 'VOTRE_SECRET_ID',
|
|
91
|
+
type: 2,
|
|
92
|
+
partnerName: 'MonApplication',
|
|
93
|
+
enableSecurityLogs: true,
|
|
94
|
+
validateInputs: true,
|
|
95
|
+
|
|
96
|
+
onSuccess: function(authData) {
|
|
97
|
+
console.log('🎉 Authentification réussie!', authData);
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
onError: function(error) {
|
|
101
|
+
console.error('❌ Erreur:', error);
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
onStatusUpdate: function(data) {
|
|
105
|
+
console.log('📊 Statut:', data.status);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
async function initSunuID() {
|
|
110
|
+
try {
|
|
111
|
+
const sunuid = new SunuID(config);
|
|
112
|
+
await sunuid.init();
|
|
113
|
+
await sunuid.generateQR('qr-area');
|
|
114
|
+
} catch (e) {
|
|
115
|
+
console.error('Erreur d\'initialisation:', e.message);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
document.addEventListener('DOMContentLoaded', initSunuID);
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
**HTML minimal :**
|
|
123
|
+
```html
|
|
124
|
+
<script src="https://cdn.socket.io/4.7.4/socket.io.min.js"></script>
|
|
125
|
+
<script src="https://unpkg.com/sunuid-sdk@1.0.57/dist/sunuid-sdk.min.js"></script>
|
|
126
|
+
<div id="qr-area"></div>
|
|
127
|
+
```
|
|
128
|
+
|
|
85
129
|
## 🎯 Utilisation
|
|
86
130
|
|
|
87
131
|
### Génération de QR Codes
|
|
@@ -150,7 +194,7 @@ Le SDK supporte l'initialisation sécurisée via un endpoint PHP qui génère de
|
|
|
150
194
|
$SUNUID_CONFIG = [
|
|
151
195
|
'client_id' => $_ENV['SUNUID_CLIENT_ID'],
|
|
152
196
|
'secret_id' => $_ENV['SUNUID_SECRET_ID'],
|
|
153
|
-
'api_url' => 'https://api.sunuid.
|
|
197
|
+
'api_url' => 'https://api.sunuid.com',
|
|
154
198
|
'token_expiry' => 3600,
|
|
155
199
|
'max_requests_per_token' => 100
|
|
156
200
|
];
|
package/dist/sunuid-sdk.esm.js
CHANGED
|
@@ -272,7 +272,7 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
272
272
|
|
|
273
273
|
// Configuration par défaut
|
|
274
274
|
var DEFAULT_CONFIG = {
|
|
275
|
-
apiUrl: ((_window$SunuIDConfig = window.SunuIDConfig) === null || _window$SunuIDConfig === void 0 ? void 0 : _window$SunuIDConfig.apiUrl) || 'https://api.sunuid.
|
|
275
|
+
apiUrl: ((_window$SunuIDConfig = window.SunuIDConfig) === null || _window$SunuIDConfig === void 0 ? void 0 : _window$SunuIDConfig.apiUrl) || 'https://api.sunuid.com',
|
|
276
276
|
clientId: null,
|
|
277
277
|
secretId: null,
|
|
278
278
|
type: 2,
|
|
@@ -300,10 +300,10 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
300
300
|
// Options d'initialisation sécurisée
|
|
301
301
|
secureInit: false,
|
|
302
302
|
secureInitUrl: function (_window$SunuIDConfig2, _window$SunuIDConfig3) {
|
|
303
|
-
if ((_window$SunuIDConfig2 = window.SunuIDConfig) !== null && _window$SunuIDConfig2 !== void 0 && (_window$SunuIDConfig2 = _window$SunuIDConfig2.apiUrl) !== null && _window$SunuIDConfig2 !== void 0 && _window$SunuIDConfig2.includes('api.sunuid.
|
|
304
|
-
return 'https://api.sunuid.
|
|
303
|
+
if ((_window$SunuIDConfig2 = window.SunuIDConfig) !== null && _window$SunuIDConfig2 !== void 0 && (_window$SunuIDConfig2 = _window$SunuIDConfig2.apiUrl) !== null && _window$SunuIDConfig2 !== void 0 && _window$SunuIDConfig2.includes('api.sunuid.com')) {
|
|
304
|
+
return 'https://api.sunuid.com/secure-init';
|
|
305
305
|
}
|
|
306
|
-
return ((_window$SunuIDConfig3 = window.SunuIDConfig) === null || _window$SunuIDConfig3 === void 0 || (_window$SunuIDConfig3 = _window$SunuIDConfig3.apiUrl) === null || _window$SunuIDConfig3 === void 0 ? void 0 : _window$SunuIDConfig3.replace('/api', '')) + '/secure-init' || 'https://api.sunuid.
|
|
306
|
+
return ((_window$SunuIDConfig3 = window.SunuIDConfig) === null || _window$SunuIDConfig3 === void 0 || (_window$SunuIDConfig3 = _window$SunuIDConfig3.apiUrl) === null || _window$SunuIDConfig3 === void 0 ? void 0 : _window$SunuIDConfig3.replace('/api', '')) + '/secure-init' || 'https://api.sunuid.com/secure-init';
|
|
307
307
|
}(),
|
|
308
308
|
token: null,
|
|
309
309
|
// Configuration pour forcer l'utilisation du serveur distant
|
|
@@ -642,7 +642,7 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
642
642
|
|
|
643
643
|
// Générer un identifiant aléatoire pour la session WebSocket
|
|
644
644
|
var randomId = 'web_' + Math.random().toString(36).slice(2) + '_' + Date.now();
|
|
645
|
-
this.socket = io('wss://
|
|
645
|
+
this.socket = io('wss://socket.sunuid.com:9446', {
|
|
646
646
|
query: {
|
|
647
647
|
token: randomId,
|
|
648
648
|
type: 'web',
|
|
@@ -1490,7 +1490,7 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
1490
1490
|
options = _args10.length > 3 && _args10[3] !== undefined ? _args10[3] : {};
|
|
1491
1491
|
_context10.p = 1;
|
|
1492
1492
|
_context10.n = 2;
|
|
1493
|
-
return fetch('https://api.sunuid.
|
|
1493
|
+
return fetch('https://api.sunuid.com/qr-generate', {
|
|
1494
1494
|
method: 'POST',
|
|
1495
1495
|
headers: {
|
|
1496
1496
|
'Content-Type': 'application/json'
|
|
@@ -1725,9 +1725,9 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
1725
1725
|
// Construire l'URL - Utiliser l'API principale qui fonctionne
|
|
1726
1726
|
|
|
1727
1727
|
if (this.config.forceRemoteServer) {
|
|
1728
|
-
qrGeneratorUrl = 'https://api.sunuid.
|
|
1729
|
-
} else if (this.config.apiUrl.includes('api.sunuid.
|
|
1730
|
-
qrGeneratorUrl = 'https://api.sunuid.
|
|
1728
|
+
qrGeneratorUrl = 'https://api.sunuid.com/qr-generate';
|
|
1729
|
+
} else if (this.config.apiUrl.includes('api.sunuid.com')) {
|
|
1730
|
+
qrGeneratorUrl = 'https://api.sunuid.com/qr-generate';
|
|
1731
1731
|
} else if (this.config.apiUrl.includes('localhost') || this.config.apiUrl.includes('127.0.0.1')) {
|
|
1732
1732
|
qrGeneratorUrl = 'http://localhost:8000/api/generate/text';
|
|
1733
1733
|
} else {
|