sunuid-sdk 1.0.56 → 1.0.58

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 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
@@ -639,11 +639,14 @@ function _unsupportedIterableToArray(r, a) {
639
639
  // Initialiser la connexion WebSocket si elle n'existe pas
640
640
  if (!this.socket) {
641
641
  console.log('🌐 Initialisation Socket.IO...');
642
- this.socket = io('wss://samasocket.fayma.sn:9443', {
642
+
643
+ // Générer un identifiant aléatoire pour la session WebSocket
644
+ var randomId = 'web_' + Math.random().toString(36).slice(2) + '_' + Date.now();
645
+ this.socket = io('wss://socket.sunuid.com:9446', {
643
646
  query: {
644
- token: this.config.clientId,
647
+ token: randomId,
645
648
  type: 'web',
646
- userId: this.config.clientId,
649
+ userId: randomId,
647
650
  username: ip
648
651
  },
649
652
  transports: ['websocket', 'polling']